diff --git a/CHANGES.md b/CHANGES.md index 2b001cae7..aab79557a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -213,6 +213,14 @@ To be released. ### @fedify/vocab + - Added `deepClone()` to vocabulary objects to copy nested objects before + resolving their properties, keeping the source graph unchanged. Replacement + values are copied too. Use `clone()` when a shallow copy is sufficient. + Large sparse property arrays retain their length and holes without creating + per-slot trust bookkeeping. Keep arrays stable while copying; newly added + entries may not be visited. Accessor and serialization traversal costs are + unchanged. [[#1243], [#1337]] + - Added vocabulary support for the [FEP-6757] draft, which marks ActivityPub content with explicit copyright license URIs. [[#1212], [#1241]] @@ -233,6 +241,8 @@ To be released. [FEP-6757]: https://w3id.org/fep/6757 [#1212]: https://github.com/fedify-dev/fedify/issues/1212 [#1241]: https://github.com/fedify-dev/fedify/pull/1241 +[#1243]: https://github.com/fedify-dev/fedify/issues/1243 +[#1337]: https://github.com/fedify-dev/fedify/pull/1337 ### @fedify/vocab-runtime diff --git a/changes.d/vocab/deep-clone.md b/changes.d/vocab/deep-clone.md new file mode 100644 index 000000000..ea4773757 --- /dev/null +++ b/changes.d/vocab/deep-clone.md @@ -0,0 +1,12 @@ +--- +links: + '#1243': https://github.com/fedify-dev/fedify/issues/1243 + '#1337': https://github.com/fedify-dev/fedify/pull/1337 +--- + - Added `deepClone()` to vocabulary objects to copy nested objects before + resolving their properties, keeping the source graph unchanged. Replacement + values are copied too. Use `clone()` when a shallow copy is sufficient. + Large sparse property arrays retain their length and holes without creating + per-slot trust bookkeeping. Keep arrays stable while copying; newly added + entries may not be visited. Accessor and serialization traversal costs are + unchanged. [[#1243], [#1337]] diff --git a/claude-plugin/skills/fedify/SKILL.md b/claude-plugin/skills/fedify/SKILL.md index a6f9d121e..f8420b508 100644 --- a/claude-plugin/skills/fedify/SKILL.md +++ b/claude-plugin/skills/fedify/SKILL.md @@ -265,6 +265,18 @@ in-tree *src/webfinger*. `fromJsonLd()` and `toJsonLd()` are asynchronous; always `await` them. +`clone()` is shallow: it copies property arrays but shares nested vocabulary +objects and URLs. In Fedify 2.5.0 and later, use synchronous `deepClone()` to +resolve nested properties without hydrating the source's objects. Replacement +values are copied too. Each copied node keeps its own default loaders and +verifier; second-argument options override only the root. The copy drops cached +JSON-LD and retained signed representations, so retain the received document +when its exact representation matters and sign copies again when needed. +Keep property arrays stable during copying, including inside custom `clone()` +overrides: `deepClone()` snapshots the existing indices of large sparse arrays. +Entries added during copying are not visited, so their nested objects may +remain shared. Copying preserves array length and holes. + > [!WARNING] > `crossOrigin: "trust"` on vocabulary deserialization trusts embedded > objects without re-fetching. Treat it as you would diff --git a/docs/manual/vocab.md b/docs/manual/vocab.md index 5ddced37a..b244425c1 100644 --- a/docs/manual/vocab.md +++ b/docs/manual/vocab.md @@ -951,31 +951,73 @@ if its cached JSON-LD contains an embedded object with its own `@context`, the accessor re-parses that object on each call. Hydrating that returned object does not update the nested instance stored in the source or clone. -If you need to preserve the received representation while resolving properties, -keep the received JSON-LD document. To resolve properties in a separate object -graph, serialize and re-parse the object before hydrating any properties rather -than using `clone()`: +### Deep copies + +*This API is available since Fedify 2.5.0.* + +Use `deepClone()` when you need to resolve properties without hydrating nested +objects held by the source. It copies the stored vocabulary graph, including +any objects you supply as replacement values. For example, you can inspect a +quote request through a copy while keeping the original to echo in a response: ~~~~ typescript twoslash -import { Create } from "@fedify/vocab"; -import type { DocumentLoader } from "@fedify/vocab-runtime"; -declare const original: Create; -declare const documentLoader: DocumentLoader; -declare const contextLoader: DocumentLoader; +import { Accept, QuoteRequest } from "@fedify/vocab"; +declare const request: QuoteRequest; // ---cut-before--- -const options = { documentLoader, contextLoader }; -const copy = await Create.fromJsonLd(await original.toJsonLd(), options); -// Resolve properties on copy while keeping original separate: -const note = await copy.getObject(options); -if (note != null) await note.getAttribution(options); +const resolving = request.deepClone(); +const instrument = await resolving.getInstrument(); +if (instrument != null) await instrument.getAttribution(); + +// The response embeds the original, whose nested objects were not hydrated: +const response = new Accept({ object: request }); ~~~~ -This round trip separates nested vocabulary objects; it does not preserve the -original JSON bytes. Pass any custom loaders again, as in the example above. -The copy also does not inherit trust in embedded objects. Under the -[origin-based security model](#origin-based-security-model), accessors may fetch -cross-origin objects again, even if the original already hydrated them. The -fetched data may have changed, or the fetch may fail. +Like `clone()`, `deepClone()` accepts constructor-compatible replacement values, +such as `request.deepClone({ summary: "Updated" })`. Nested vocabulary objects, +URLs and byte arrays are copied; immutable scalar values and opaque +cryptographic keys are shared. Repeated references to one object remain shared +within the copy. If the graph refers back to the source itself, including when +you pass the source as a replacement value, that reference becomes a separate +copy of the source's pre-update values. It does not point at the updated root. + +Each copied object retains its own default document loader, context loader, +tracer, portable-object verifier and base URL. The optional second argument +accepts the same loader and verifier options as `clone()`, but it overrides +only the root's defaults. An option left `undefined` keeps the root's existing +default for that option. By contrast, `clone()` uses only the options passed +to it. + +The copy retains embedded-object trust and the portable restrictions that +`clone()` preserves, but does not inherit positive verification evidence. +Historical portable referrers within the graph are copied without applying +replacement values; referrers outside the graph continue to point at the +original external objects. + +`deepClone()` does not fetch remote objects or serialize and re-parse JSON-LD. +It walks the entire stored graph synchronously. Prefer `clone()` when a +shallow copy is sufficient. When copying a subclass, `deepClone()` calls its +`clone()` override. Such overrides must return fresh, compatible instances +and are responsible for their own side effects. + +Property arrays keep their length and holes when copied. Large sparse +arrays with ordinary data entries use a snapshot of their existing indices. +Entries added after that snapshot are not visited, while deleted entries are +skipped. Keep property arrays stable during copying, including inside custom +`clone()` overrides, to preserve isolation of the copied graph. Indexed +getters, array subclasses and custom species use the existing array operations +when detected; Proxy traps can observe different reads and reflection +operations. + +Trust for constructor-supplied objects follows the length of the stored +array. Building that trust does not read non-scalar plural input getters once +per slot. Sparse arrays can still be expensive to traverse through accessors +or to serialize. + +Cached JSON-LD and retained signed representations are discarded at every +copied node. The copy therefore reflects modeled property values, not unknown +JSON-LD properties or the original document's formatting. Sign the copy again +if it needs a valid proof. To preserve the exact received representation, +keep the received JSON-LD document and use the copy only for inspection. Looking up remote objects diff --git a/packages/vocab-runtime/src/internal/portable-dereference.test.ts b/packages/vocab-runtime/src/internal/portable-dereference.test.ts index 3dc49e647..5c2c2a0e2 100644 --- a/packages/vocab-runtime/src/internal/portable-dereference.test.ts +++ b/packages/vocab-runtime/src/internal/portable-dereference.test.ts @@ -4,15 +4,49 @@ import type { DocumentLoader } from "../docloader.ts"; import { parseIri, withGatewayHints } from "../url.ts"; import { createScopedContextLoader } from "./jsonld-cache.ts"; import { + copyPortableProvenance, createSnapshotContextLoader, getPortableGatewayCandidates, getReferrerGateways, + isInPortableChain, isPortableIri, recordPortableReferrer, + retargetPortableReferrer, } from "./portable-dereference.ts"; const hrefs = (urls: URL[]) => urls.map((url) => url.href); +test("retargetPortableReferrer() only reconnects existing provenance", () => { + const id = parseIri("ap://did:key:z6Mkabc/actor"); + const parent = { id, gateways: [new URL("https://original.example")] }; + const copiedParent = { id, gateways: [new URL("https://copy.example")] }; + const source = {}; + const copy = {}; + let calls = 0; + retargetPortableReferrer(copy, () => { + calls++; + return copiedParent; + }); + deepStrictEqual(calls, 0); + ok(!isInPortableChain(copy)); + recordPortableReferrer(parent, source, "https://example.com/property"); + copyPortableProvenance(source, copy); + retargetPortableReferrer(copy, () => undefined); + deepStrictEqual(hrefs(getReferrerGateways(copy, id)!), [ + "https://original.example/", + ]); + retargetPortableReferrer(copy, (original) => { + ok(original === parent); + return copiedParent; + }); + deepStrictEqual(hrefs(getReferrerGateways(copy, id)!), [ + "https://copy.example/", + ]); + deepStrictEqual(hrefs(getReferrerGateways(source, id)!), [ + "https://original.example/", + ]); +}); + test("isPortableIri()", () => { ok(isPortableIri(parseIri("ap://did:key:z6Mkabc/actor"))); ok(isPortableIri(parseIri("ap+ef61://did:key:z6Mkabc/actor"))); diff --git a/packages/vocab-runtime/src/internal/portable-dereference.ts b/packages/vocab-runtime/src/internal/portable-dereference.ts index 532042b3a..20d1bf866 100644 --- a/packages/vocab-runtime/src/internal/portable-dereference.ts +++ b/packages/vocab-runtime/src/internal/portable-dereference.ts @@ -198,6 +198,27 @@ export function copyPortableProvenance(from: object, to: object): void { }); } +/** + * Reconnects an existing historical referrer to its independent graph copy. + * Does not create provenance or add verification or collection-context evidence. + * An unresolved referrer remains external history. Like the other provenance + * helpers, this is for generated vocabulary code, not a public trust API. + * @internal + */ +export function retargetPortableReferrer( + copy: object, + resolve: (original: object) => object | undefined, +): void { + const provenance = provenances.get(copy); + if (provenance?.referrer == null) return; + const object = resolve(provenance.referrer.object); + if (object == null) return; + provenances.set(copy, { + ...provenance, + referrer: { ...provenance.referrer, object }, + }); +} + /** * Recognizes an FEP-ef61 compatible identifier to dereference as a portable * object. diff --git a/packages/vocab-tools/src/__snapshots__/class.test.ts.deno.snap b/packages/vocab-tools/src/__snapshots__/class.test.ts.deno.snap index 36da7f438..67a576d05 100644 --- a/packages/vocab-tools/src/__snapshots__/class.test.ts.deno.snap +++ b/packages/vocab-tools/src/__snapshots__/class.test.ts.deno.snap @@ -52,6 +52,7 @@ import { parseCompatibleEf61Reference, type PortableResponseClaim, recordPortableReferrer, + retargetPortableReferrer, rejectMalformedCompatibleReference, warnUnverifiableEmbeddedObject } from \\"@fedify/vocab-runtime/internal/portable-dereference\\"; @@ -81,6 +82,293 @@ function inspectIri(iri: URL): string { try { return formatIri(iri); } catch { return iri.href; } } +interface VocabSparseArraySnapshot { + length: number; + indices: number[]; +} + +interface VocabArrayValidation { + valid: boolean; + sparse: boolean; +} + +type VocabArrayCopy = { ok: true; array: T[] } | { ok: false }; + +// Most fields have no trusted prefix. Keep that metadata on the existing Set +// so empty fields need neither another object nor another instance slot. +const vocabTrustPrefix: unique symbol = Symbol(\\"vocabulary trust prefix\\"); +type VocabTrustSet = Set & { [vocabTrustPrefix]?: number }; + +function vocabSetTrustPrefix(trust: VocabTrustSet, prefix: number): void { + if (prefix > 0) trust[vocabTrustPrefix] = prefix; +} + +function vocabCopyTrustSet( + trust: VocabTrustSet, + destination: VocabTrustSet, +): VocabTrustSet { + // clone() already constructed the destination. Reuse its empty Set only + // when constructor defaults cannot contribute trust to the copied field. + const copy: VocabTrustSet = trust !== destination && trust.size === 0 && + destination.size === 0 && destination[vocabTrustPrefix] == null + ? destination : new Set(trust); + const prefix = trust[vocabTrustPrefix]; + if (prefix != null && prefix > 0) copy[vocabTrustPrefix] = prefix; + return copy; +} + +// These thresholds select an optimization, not a limit on property arrays. +const vocabSparseArrayMinimumLength = 4096; +const vocabSparseArrayProbeCount = 8; +const vocabSparseArrayPresentProbeLimit = 4; +const vocabArrayPrototype = Array.prototype; +const vocabObjectPrototype = globalThis.Object.prototype; +const vocabArrayDescriptors = [\\"constructor\\", \\"every\\", \\"slice\\"].map( + key => globalThis.Object.getOwnPropertyDescriptor(vocabArrayPrototype, key), +); +const vocabArraySpeciesDescriptor = globalThis.Object.getOwnPropertyDescriptor( + Array, Symbol.species, +); + +function vocabSameArrayDescriptor( + actual: PropertyDescriptor | undefined, + expected: PropertyDescriptor | undefined, +): boolean { + return actual?.value === expected?.value && actual?.get === expected?.get && + actual?.set === expected?.set && actual?.writable === expected?.writable && + actual?.enumerable === expected?.enumerable && + actual?.configurable === expected?.configurable; +} + +function vocabArrayIndex(key: string): number | undefined { + const index = Number(key); + return Number.isInteger(index) && index >= 0 && index < 0xffffffff && + String(index) === key + ? index + : undefined; +} + +function vocabSparseArraySnapshot( + array: unknown[], +): VocabSparseArraySnapshot | undefined { + if (!Array.isArray(array)) return undefined; + const length = array.length; + // Small dense fields take no prototype or key-enumeration overhead. + if (length < vocabSparseArrayMinimumLength) return undefined; + if (!Number.isInteger(length) || length > 0xffffffff || + globalThis.Object.getPrototypeOf(array) !== vocabArrayPrototype || + globalThis.Object.getPrototypeOf(vocabArrayPrototype) !== + vocabObjectPrototype || + globalThis.Object.getPrototypeOf(vocabObjectPrototype) !== null) { + return undefined; + } + const methods = [\\"constructor\\", \\"every\\", \\"slice\\"]; + for (let i = 0; i < methods.length; i++) { + const key = methods[i]; + if (globalThis.Object.hasOwn(array, key) || + !vocabSameArrayDescriptor( + globalThis.Object.getOwnPropertyDescriptor(vocabArrayPrototype, key), + vocabArrayDescriptors[i], + )) return undefined; + } + if (!vocabSameArrayDescriptor( + globalThis.Object.getOwnPropertyDescriptor(Array, Symbol.species), + vocabArraySpeciesDescriptor, + )) return undefined; + + // Descriptor probes do not invoke element getters. Plainly dense arrays + // keep native iteration without enumerating all their keys. + let present = 0; + for (let i = 0; i < vocabSparseArrayProbeCount; i++) { + const index = Math.floor(i * (length - 1) / (vocabSparseArrayProbeCount - 1)); + if (globalThis.Object.getOwnPropertyDescriptor(array, index) != null && + ++present >= vocabSparseArrayPresentProbeLimit) return undefined; + } + for (const prototype of [vocabArrayPrototype, vocabObjectPrototype]) { + for (const key of globalThis.Object.getOwnPropertyNames(prototype)) { + if (vocabArrayIndex(key) != null) return undefined; + } + } + const indices: number[] = []; + for (const key of globalThis.Object.getOwnPropertyNames(array)) { + const index = vocabArrayIndex(key); + if (index != null && index < length) indices.push(index); + } + if (indices.length >= length / 2) return undefined; + for (const index of indices) { + const descriptor = globalThis.Object.getOwnPropertyDescriptor(array, index); + if (descriptor == null || !(\\"value\\" in descriptor)) return undefined; + } + // Ordinary array keys already have canonical index order. This guard is + // not a Proxy detector; reflection traps and errors remain observable. + return { length, indices }; +} + +function vocabValidatePropertyArray( + array: T[], + test: (value: T) => boolean, +): VocabArrayValidation { + const snapshot = vocabSparseArraySnapshot(array); + if (snapshot == null) return { valid: array.every(test), sparse: false }; + for (const index of snapshot.indices) { + if (globalThis.Object.hasOwn(array, index) && !test(array[index])) { + return { valid: false, sparse: true }; + } + } + return { valid: true, sparse: true }; +} + +function vocabDefineArrayEntry(array: T[], index: number, value: T): void { + globalThis.Object.defineProperty(array, index, { + value, writable: true, enumerable: true, configurable: true, + }); +} + +function vocabCopySparsePropertyArray( + array: T[], + snapshot: VocabSparseArraySnapshot, + test?: (value: T) => boolean, +): VocabArrayCopy { + const copy: T[] = []; + // Seed dictionary storage before low indices or the final length can + // allocate storage for every hole. The temporary entry stays private. + if (snapshot.indices[snapshot.indices.length - 1] !== snapshot.length - 1) { + globalThis.Object.defineProperty(copy, snapshot.length - 1, { + value: undefined, writable: true, enumerable: true, configurable: true, + }); + delete copy[snapshot.length - 1]; + } + for (const index of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, index)) continue; + const value = array[index]; + if (test != null && !test(value)) return { ok: false }; + vocabDefineArrayEntry(copy, index, value); + } + // A validation callback may have deleted the last snapshot entry. + if (copy.length < snapshot.length) { + globalThis.Object.defineProperty(copy, snapshot.length - 1, { + value: undefined, writable: true, enumerable: true, configurable: true, + }); + delete copy[snapshot.length - 1]; + } + copy.length = snapshot.length; + return { ok: true, array: copy }; +} + +function vocabCopyPropertyArray(array: T[]): T[] { + const snapshot = vocabSparseArraySnapshot(array); + if (snapshot == null) return array.slice(); + const copied = vocabCopySparsePropertyArray(array, snapshot); + // Without a predicate the private copy cannot fail validation. + return (copied as { ok: true; array: T[] }).array; +} + +function vocabCopyValidatedPropertyArray( + array: T[], + test: (value: T) => boolean, + previous: VocabArrayValidation, +): VocabArrayCopy { + const snapshot = vocabSparseArraySnapshot(array); + if (snapshot != null) return vocabCopySparsePropertyArray(array, snapshot, test); + // Sparse validation may have changed the next input's density, descriptors + // or prototype. Validate that native-copy input before falling back. + if (previous.sparse && !array.every(test)) return { ok: false }; + return { ok: true, array: array.slice() }; +} + +interface DeepCloneContext { + value(value: T): T; +} + +interface DeepCloneDescriptor { + create(source: object): object; + copy(destination: object, context: DeepCloneContext): void; +} + +const deepCloneDescriptors = new Map(); + +function getDeepCloneDescriptor(value: object): DeepCloneDescriptor | undefined { + let prototype: object | null = globalThis.Object.getPrototypeOf(value); + while (prototype != null) { + const descriptor = deepCloneDescriptors.get(prototype); + if (descriptor != null) return descriptor; + prototype = globalThis.Object.getPrototypeOf(prototype); + } + return undefined; +} + +function deepCloneGraph(source: object, root: T): T { + const memo = new Map(); + const destinations = new Set(); + const shells: object[] = []; + let next = 0; + + function enqueue(original: object, destination: object): void { + if (destination == null || typeof destination !== \\"object\\" || + original === destination || destinations.has(destination) || + !globalThis.Object.prototype.isPrototypeOf.call( + globalThis.Object.getPrototypeOf(original), destination + ) || getDeepCloneDescriptor(destination) == null) { + throw new TypeError(\\"clone() must return a fresh, compatible instance.\\"); + } + destinations.add(destination); + shells.push(destination); + } + + const context: DeepCloneContext = { + value(value: V): V { + if (value == null || typeof value !== \\"object\\") return value; + const existing = memo.get(value); + if (existing != null) return existing as V; + if (value instanceof URL) { + const copy = new URL(value.href); + memo.set(value, copy); + return copy as V; + } + if (value instanceof Uint8Array) { + const copy = new Uint8Array(value); + memo.set(value, copy); + return copy as V; + } + const descriptor = getDeepCloneDescriptor(value); + // Other supported scalars (Temporal, LanguageString, Intl.Locale, + // CryptoKey and class constructors) are shared as immutable values. + if (descriptor == null) return value; + const copy = descriptor.create(value); + enqueue(value, copy); + memo.set(value, copy); + return copy as V; + }, + }; + + function drain(): void { + while (next < shells.length) { + const shell = shells[next++]; + getDeepCloneDescriptor(shell)!.copy(shell, context); + } + } + + // The effective root includes replacements. References to the source root + // instead receive a separate copy of its pre-update values. + enqueue(source, root); + drain(); + + // Discover historical root ancestry without substituting replacement values + // into it. The resolver deliberately returns undefined in this first pass. + const count = shells.length; + for (let i = 0; i < count; i++) { + retargetPortableReferrer(shells[i], (original) => { + if (original === source) context.value(source); + return undefined; + }); + } + drain(); + for (const shell of shells) { + retargetPortableReferrer(shell, (original) => memo.get(original)); + } + return root; +} + function isValidLanguageTag(language: string): boolean { try { new Intl.Locale(normalizeLanguageTag(language)); @@ -242,87 +530,87 @@ export class Object { } #_49BipA5dq9eoH8LX8xdsVumveTca_attachment: (Object | Link | PropertyValue | URL)[] = []; - #_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment: Set = new Set(); + #_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment: VocabTrustSet = new Set(); #_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: Set = new Set(); + #_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: VocabTrustSet = new Set(); #_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience: (Object | URL)[] = []; - #_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience: Set = new Set(); + #_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience: VocabTrustSet = new Set(); #_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content: ((string | LanguageString))[] = []; #_3mhZzGXSpQ431mBSz2kvych22v4e_context: (Object | Link | URL)[] = []; - #_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context: Set = new Set(); + #_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context: VocabTrustSet = new Set(); #_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = []; #_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime: (Temporal.Instant)[] = []; #_86xFhmgBapoMvYqjbjRuDPayTrS_generator: (Object | Link | URL)[] = []; - #_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator: Set = new Set(); + #_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator: VocabTrustSet = new Set(); #_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon: (Image | URL)[] = []; - #_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon: Set = new Set(); + #_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon: VocabTrustSet = new Set(); #_3dXrUdkARxwyJLtJcYi1AJ92H41U_image: (Image | URL)[] = []; - #_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image: Set = new Set(); + #_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image: VocabTrustSet = new Set(); #_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo: (Object | Link | URL)[] = []; - #_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo: Set = new Set(); + #_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo: VocabTrustSet = new Set(); #_31k5MUZJsnsPNg8dQQJieWaXTFnR_location: (Object | Link | URL)[] = []; - #_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location: Set = new Set(); + #_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location: VocabTrustSet = new Set(); #_gCVTegXxWWCw6wWRxa1QF65zusg_preview: (Link | Object | URL)[] = []; - #_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: Set = new Set(); + #_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: VocabTrustSet = new Set(); #_5e258TDXtuhaFRPZiGoDfEpjdMr_published: (Temporal.Instant)[] = []; #_7UpwM3JWcXhADcscukEehBorf6k_replies: (Collection | URL)[] = []; - #_trust_7UpwM3JWcXhADcscukEehBorf6k_replies: Set = new Set(); + #_trust_7UpwM3JWcXhADcscukEehBorf6k_replies: VocabTrustSet = new Set(); #_3kAfck9PcEYt2L7xug5y99YPbANs_shares: (Collection | URL)[] = []; - #_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares: Set = new Set(); + #_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares: VocabTrustSet = new Set(); #_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes: (Collection | URL)[] = []; - #_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes: Set = new Set(); + #_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes: VocabTrustSet = new Set(); #_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: (Collection | URL)[] = []; - #_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: Set = new Set(); + #_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: VocabTrustSet = new Set(); #_2w3Jmue4up8iVDUA51WZqomEF438_startTime: (Temporal.Instant)[] = []; #_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary: ((string | LanguageString))[] = []; #_5chuqj6s95p5gg2sk1HntGfarRf_tag: (Object | Link | URL)[] = []; - #_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag: Set = new Set(); + #_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag: VocabTrustSet = new Set(); #_385aB7ySixcf5Un6z3VsWmThgCzQ_updated: (Temporal.Instant)[] = []; #_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url: ((URL | Link))[] = []; #_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to: (Object | URL)[] = []; - #_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to: Set = new Set(); + #_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to: VocabTrustSet = new Set(); #_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto: (Object | URL)[] = []; - #_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto: Set = new Set(); + #_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto: VocabTrustSet = new Set(); #_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc: (Object | URL)[] = []; - #_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc: Set = new Set(); + #_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc: VocabTrustSet = new Set(); #_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc: (Object | URL)[] = []; - #_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc: Set = new Set(); + #_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc: VocabTrustSet = new Set(); #_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType: (string)[] = []; #_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration: (Temporal.Duration)[] = []; #_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive: (boolean)[] = []; #_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source: (Source)[] = []; #_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: (DataIntegrityProof | URL)[] = []; - #_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: Set = new Set(); + #_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: VocabTrustSet = new Set(); #_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy: (InteractionPolicy)[] = []; #_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy: (URL)[] = []; #_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: (LikeAuthorization | URL)[] = []; - #_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: Set = new Set(); + #_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: VocabTrustSet = new Set(); #_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: (ReplyAuthorization | URL)[] = []; - #_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: Set = new Set(); + #_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: VocabTrustSet = new Set(); #_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: (AnnounceAuthorization | URL)[] = []; - #_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: Set = new Set(); + #_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: VocabTrustSet = new Set(); #_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations: (Translation)[] = []; #_2rzkBRS4gNPrkJk9DohHAMUAxA2d: (URL)[] = []; @@ -382,14 +670,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu if (\\"attachments\\" in values && values.attachments != null) { - if (Array.isArray(values.attachments) && - values.attachments.every(v => v instanceof Object || v instanceof Link || v instanceof PropertyValue || v instanceof URL)) { + let copied!: (Object | Link | PropertyValue | URL)[]; + let valid = false; + if (Array.isArray(values.attachments)) { + const array = values.attachments; + const test = (v: Object | Link | PropertyValue | URL): boolean => v instanceof Object || v instanceof Link || v instanceof PropertyValue || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.attachments; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = values.attachments.slice(); + this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = copied; - for (let i = 0; i < values.attachments.length; i++) { - this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.add(i); - } + vocabSetTrustPrefix(this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment, this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.length); } else { throw new TypeError( @@ -422,14 +732,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.attributions) && - values.attributions.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.attributions)) { + const array = values.attributions; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.attributions; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = values.attributions.slice(); + this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = copied; - for (let i = 0; i < values.attributions.length; i++) { - this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.add(i); - } + vocabSetTrustPrefix(this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo, this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length); } else { throw new TypeError( @@ -462,14 +794,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.audiences) && - values.audiences.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.audiences)) { + const array = values.audiences; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.audiences; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = values.audiences.slice(); + this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = copied; - for (let i = 0; i < values.audiences.length; i++) { - this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.add(i); - } + vocabSetTrustPrefix(this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience, this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length); } else { throw new TypeError( @@ -502,10 +856,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.contents) && - values.contents.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.contents)) { + const array = values.contents; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.contents; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = values.contents.slice(); + this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = copied; } else { throw new TypeError( @@ -517,14 +895,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu if (\\"contexts\\" in values && values.contexts != null) { - if (Array.isArray(values.contexts) && - values.contexts.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.contexts)) { + const array = values.contexts; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.contexts; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = values.contexts.slice(); + this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = copied; - for (let i = 0; i < values.contexts.length; i++) { - this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context.add(i); - } + vocabSetTrustPrefix(this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context, this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context.length); } else { throw new TypeError( @@ -557,10 +957,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.names) && - values.names.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.names)) { + const array = values.names; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.names; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = values.names.slice(); + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = copied; } else { throw new TypeError( @@ -585,14 +1009,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu if (\\"generators\\" in values && values.generators != null) { - if (Array.isArray(values.generators) && - values.generators.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.generators)) { + const array = values.generators; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.generators; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = values.generators.slice(); + this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = copied; - for (let i = 0; i < values.generators.length; i++) { - this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator.add(i); - } + vocabSetTrustPrefix(this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator, this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator.length); } else { throw new TypeError( @@ -625,14 +1071,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.icons) && - values.icons.every(v => v instanceof Image || v instanceof URL)) { + let copied!: (Image | URL)[]; + let valid = false; + if (Array.isArray(values.icons)) { + const array = values.icons; + const test = (v: Image | URL): boolean => v instanceof Image || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.icons; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = values.icons.slice(); + this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = copied; - for (let i = 0; i < values.icons.length; i++) { - this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.add(i); - } + vocabSetTrustPrefix(this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon, this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length); } else { throw new TypeError( @@ -665,14 +1133,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.images) && - values.images.every(v => v instanceof Image || v instanceof URL)) { + let copied!: (Image | URL)[]; + let valid = false; + if (Array.isArray(values.images)) { + const array = values.images; + const test = (v: Image | URL): boolean => v instanceof Image || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.images; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = values.images.slice(); + this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = copied; - for (let i = 0; i < values.images.length; i++) { - this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.add(i); - } + vocabSetTrustPrefix(this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image, this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length); } else { throw new TypeError( @@ -705,14 +1195,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.replyTargets) && - values.replyTargets.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.replyTargets)) { + const array = values.replyTargets; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.replyTargets; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = values.replyTargets.slice(); + this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = copied; - for (let i = 0; i < values.replyTargets.length; i++) { - this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.add(i); - } + vocabSetTrustPrefix(this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo, this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length); } else { throw new TypeError( @@ -745,14 +1257,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.locations) && - values.locations.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.locations)) { + const array = values.locations; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.locations; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = values.locations.slice(); + this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = copied; - for (let i = 0; i < values.locations.length; i++) { - this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.add(i); - } + vocabSetTrustPrefix(this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location, this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length); } else { throw new TypeError( @@ -785,14 +1319,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.previews) && - values.previews.every(v => v instanceof Link || v instanceof Object || v instanceof URL)) { + let copied!: (Link | Object | URL)[]; + let valid = false; + if (Array.isArray(values.previews)) { + const array = values.previews; + const test = (v: Link | Object | URL): boolean => v instanceof Link || v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.previews; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = values.previews.slice(); + this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = copied; - for (let i = 0; i < values.previews.length; i++) { - this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.add(i); - } + vocabSetTrustPrefix(this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length); } else { throw new TypeError( @@ -903,10 +1459,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.summaries) && - values.summaries.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.summaries)) { + const array = values.summaries; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.summaries; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = values.summaries.slice(); + this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = copied; } else { throw new TypeError( @@ -918,14 +1498,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu if (\\"tags\\" in values && values.tags != null) { - if (Array.isArray(values.tags) && - values.tags.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.tags)) { + const array = values.tags; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.tags; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = values.tags.slice(); + this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = copied; - for (let i = 0; i < values.tags.length; i++) { - this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.add(i); - } + vocabSetTrustPrefix(this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag, this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag.length); } else { throw new TypeError( @@ -971,10 +1573,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.urls) && - values.urls.every(v => v instanceof URL || v instanceof Link)) { + let copied!: (URL | Link)[]; + let valid = false; + if (Array.isArray(values.urls)) { + const array = values.urls; + const test = (v: URL | Link): boolean => v instanceof URL || v instanceof Link; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.urls; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls.slice(); + this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = copied; } else { throw new TypeError( @@ -1007,14 +1633,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.tos) && - values.tos.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.tos)) { + const array = values.tos; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.tos; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = values.tos.slice(); + this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = copied; - for (let i = 0; i < values.tos.length; i++) { - this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.add(i); - } + vocabSetTrustPrefix(this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to, this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length); } else { throw new TypeError( @@ -1047,14 +1695,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.btos) && - values.btos.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.btos)) { + const array = values.btos; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.btos; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = values.btos.slice(); + this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = copied; - for (let i = 0; i < values.btos.length; i++) { - this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.add(i); - } + vocabSetTrustPrefix(this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto, this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length); } else { throw new TypeError( @@ -1087,14 +1757,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.ccs) && - values.ccs.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.ccs)) { + const array = values.ccs; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.ccs; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = values.ccs.slice(); + this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = copied; - for (let i = 0; i < values.ccs.length; i++) { - this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.add(i); - } + vocabSetTrustPrefix(this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc, this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length); } else { throw new TypeError( @@ -1127,14 +1819,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.bccs) && - values.bccs.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.bccs)) { + const array = values.bccs; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.bccs; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = values.bccs.slice(); + this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = copied; - for (let i = 0; i < values.bccs.length; i++) { - this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.add(i); - } + vocabSetTrustPrefix(this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc, this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length); } else { throw new TypeError( @@ -1219,14 +1933,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.proofs) && - values.proofs.every(v => v instanceof DataIntegrityProof || v instanceof URL)) { + let copied!: (DataIntegrityProof | URL)[]; + let valid = false; + if (Array.isArray(values.proofs)) { + const array = values.proofs; + const test = (v: DataIntegrityProof | URL): boolean => v instanceof DataIntegrityProof || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.proofs; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = values.proofs.slice(); + this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = copied; - for (let i = 0; i < values.proofs.length; i++) { - this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.add(i); - } + vocabSetTrustPrefix(this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof, this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length); } else { throw new TypeError( @@ -1303,10 +2039,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu if (\\"translations\\" in values && values.translations != null) { - if (Array.isArray(values.translations) && - values.translations.every(v => v instanceof Translation)) { + let copied!: (Translation)[]; + let valid = false; + if (Array.isArray(values.translations)) { + const array = values.translations; + const test = (v: Translation): boolean => v instanceof Translation; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.translations; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = values.translations.slice(); + this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = copied; } else { throw new TypeError( @@ -1318,10 +2078,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu if (\\"licenses\\" in values && values.licenses != null) { - if (Array.isArray(values.licenses) && - values.licenses.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.licenses)) { + const array = values.licenses; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.licenses; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = values.licenses.slice(); + this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = copied; } else { throw new TypeError( @@ -1343,8 +2127,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Object.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -1403,18 +2187,43 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu options ); copyPortableProvenance(this, clone); - clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.slice();clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment = new Set(this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment); + clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.length < vocabSparseArrayMinimumLength + ? this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.slice() : vocabCopyPropertyArray(this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment);clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment = vocabCopyTrustSet( + this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment, clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment, + ); if (\\"attachments\\" in values && values.attachments != null) { - if (Array.isArray(values.attachments) && - values.attachments.every(v => v instanceof Object || v instanceof Link || v instanceof PropertyValue || v instanceof URL)) { + let copied!: (Object | Link | PropertyValue | URL)[]; + let valid = false; + if (Array.isArray(values.attachments)) { + const array = values.attachments; + const test = (v: Object | Link | PropertyValue | URL): boolean => v instanceof Object || v instanceof Link || v instanceof PropertyValue || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.attachments; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = values.attachments.slice(); + clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = copied; clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment = new Set(); - for (let i = 0; i < values.attachments.length; i++) { - clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.add(i); - } + vocabSetTrustPrefix(clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment, clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.length); } else { throw new TypeError( @@ -1423,12 +2232,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.slice();clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = new Set(this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo); + clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length < vocabSparseArrayMinimumLength + ? this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.slice() : vocabCopyPropertyArray(this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo);clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = vocabCopyTrustSet( + this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo, clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo, + ); if (\\"attribution\\" in values && values.attribution != null) { if (values.attribution instanceof Application || values.attribution instanceof Group || values.attribution instanceof Organization || values.attribution instanceof Person || values.attribution instanceof Service || values.attribution instanceof URL) { // @ts-ignore: type is checked above. clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = [values.attribution]; - clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = new Set([0]); + clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = new Set(); + clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The attribution must be of type \\" + @@ -1447,15 +2260,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.attributions) && - values.attributions.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.attributions)) { + const array = values.attributions; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.attributions; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = values.attributions.slice(); + clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = copied; clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = new Set(); - for (let i = 0; i < values.attributions.length; i++) { - clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.add(i); - } + vocabSetTrustPrefix(clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo, clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length); } else { throw new TypeError( @@ -1464,12 +2299,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.slice();clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = new Set(this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience); + clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length < vocabSparseArrayMinimumLength + ? this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.slice() : vocabCopyPropertyArray(this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience);clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = vocabCopyTrustSet( + this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience, clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience, + ); if (\\"audience\\" in values && values.audience != null) { if (values.audience instanceof Object || values.audience instanceof URL) { // @ts-ignore: type is checked above. clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = [values.audience]; - clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = new Set([0]); + clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = new Set(); + clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The audience must be of type \\" + @@ -1488,15 +2327,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.audiences) && - values.audiences.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.audiences)) { + const array = values.audiences; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.audiences; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = values.audiences.slice(); + clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = copied; clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = new Set(); - for (let i = 0; i < values.audiences.length; i++) { - clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience, clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length); } else { throw new TypeError( @@ -1505,7 +2366,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.slice(); + clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length < vocabSparseArrayMinimumLength + ? this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.slice() : vocabCopyPropertyArray(this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content); if (\\"content\\" in values && values.content != null) { if (typeof values.content === \\"string\\" || values.content instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -1529,10 +2391,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.contents) && - values.contents.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.contents)) { + const array = values.contents; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.contents; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = values.contents.slice(); + clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = copied; } else { throw new TypeError( @@ -1541,18 +2427,43 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context.slice();clone.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context = new Set(this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context); + clone.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context.length < vocabSparseArrayMinimumLength + ? this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context.slice() : vocabCopyPropertyArray(this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context);clone.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context = vocabCopyTrustSet( + this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context, clone.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context, + ); if (\\"contexts\\" in values && values.contexts != null) { - if (Array.isArray(values.contexts) && - values.contexts.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.contexts)) { + const array = values.contexts; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.contexts; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = values.contexts.slice(); + clone.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = copied; clone.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context = new Set(); - for (let i = 0; i < values.contexts.length; i++) { - clone.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context, clone.#_3mhZzGXSpQ431mBSz2kvych22v4e_context.length); } else { throw new TypeError( @@ -1561,7 +2472,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.slice(); + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length < vocabSparseArrayMinimumLength + ? this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.slice() : vocabCopyPropertyArray(this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name); if (\\"name\\" in values && values.name != null) { if (typeof values.name === \\"string\\" || values.name instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -1585,10 +2497,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.names) && - values.names.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.names)) { + const array = values.names; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.names; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = values.names.slice(); + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = copied; } else { throw new TypeError( @@ -1597,7 +2533,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime.slice(); + clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime.length < vocabSparseArrayMinimumLength + ? this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime.slice() : vocabCopyPropertyArray(this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime); if (\\"endTime\\" in values && values.endTime != null) { if (isTemporalInstant(values.endTime)) { // @ts-ignore: type is checked above. @@ -1610,18 +2547,43 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator.slice();clone.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator = new Set(this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator); + clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator.length < vocabSparseArrayMinimumLength + ? this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator.slice() : vocabCopyPropertyArray(this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator);clone.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator = vocabCopyTrustSet( + this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator, clone.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator, + ); if (\\"generators\\" in values && values.generators != null) { - if (Array.isArray(values.generators) && - values.generators.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.generators)) { + const array = values.generators; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.generators; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = values.generators.slice(); + clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = copied; clone.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator = new Set(); - for (let i = 0; i < values.generators.length; i++) { - clone.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator.add(i); - } + vocabSetTrustPrefix(clone.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator, clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator.length); } else { throw new TypeError( @@ -1630,12 +2592,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.slice();clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = new Set(this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon); + clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length < vocabSparseArrayMinimumLength + ? this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.slice() : vocabCopyPropertyArray(this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon);clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = vocabCopyTrustSet( + this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon, clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon, + ); if (\\"icon\\" in values && values.icon != null) { if (values.icon instanceof Image || values.icon instanceof URL) { // @ts-ignore: type is checked above. clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = [values.icon]; - clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = new Set([0]); + clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = new Set(); + clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The icon must be of type \\" + @@ -1654,15 +2620,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.icons) && - values.icons.every(v => v instanceof Image || v instanceof URL)) { + let copied!: (Image | URL)[]; + let valid = false; + if (Array.isArray(values.icons)) { + const array = values.icons; + const test = (v: Image | URL): boolean => v instanceof Image || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.icons; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = values.icons.slice(); + clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = copied; clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = new Set(); - for (let i = 0; i < values.icons.length; i++) { - clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.add(i); - } + vocabSetTrustPrefix(clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon, clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length); } else { throw new TypeError( @@ -1671,12 +2659,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.slice();clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = new Set(this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image); + clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length < vocabSparseArrayMinimumLength + ? this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.slice() : vocabCopyPropertyArray(this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image);clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = vocabCopyTrustSet( + this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image, clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image, + ); if (\\"image\\" in values && values.image != null) { if (values.image instanceof Image || values.image instanceof URL) { // @ts-ignore: type is checked above. clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = [values.image]; - clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = new Set([0]); + clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = new Set(); + clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The image must be of type \\" + @@ -1695,15 +2687,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.images) && - values.images.every(v => v instanceof Image || v instanceof URL)) { + let copied!: (Image | URL)[]; + let valid = false; + if (Array.isArray(values.images)) { + const array = values.images; + const test = (v: Image | URL): boolean => v instanceof Image || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.images; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = values.images.slice(); + clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = copied; clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = new Set(); - for (let i = 0; i < values.images.length; i++) { - clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image, clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length); } else { throw new TypeError( @@ -1712,12 +2726,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.slice();clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = new Set(this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo); + clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length < vocabSparseArrayMinimumLength + ? this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.slice() : vocabCopyPropertyArray(this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo);clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = vocabCopyTrustSet( + this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo, clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo, + ); if (\\"replyTarget\\" in values && values.replyTarget != null) { if (values.replyTarget instanceof Object || values.replyTarget instanceof Link || values.replyTarget instanceof URL) { // @ts-ignore: type is checked above. clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = [values.replyTarget]; - clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = new Set([0]); + clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = new Set(); + clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The replyTarget must be of type \\" + @@ -1736,15 +2754,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.replyTargets) && - values.replyTargets.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.replyTargets)) { + const array = values.replyTargets; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.replyTargets; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = values.replyTargets.slice(); + clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = copied; clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = new Set(); - for (let i = 0; i < values.replyTargets.length; i++) { - clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo, clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length); } else { throw new TypeError( @@ -1753,12 +2793,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.slice();clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = new Set(this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location); + clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length < vocabSparseArrayMinimumLength + ? this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.slice() : vocabCopyPropertyArray(this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location);clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = vocabCopyTrustSet( + this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location, clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location, + ); if (\\"location\\" in values && values.location != null) { if (values.location instanceof Object || values.location instanceof Link || values.location instanceof URL) { // @ts-ignore: type is checked above. clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = [values.location]; - clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = new Set([0]); + clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = new Set(); + clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The location must be of type \\" + @@ -1777,15 +2821,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.locations) && - values.locations.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.locations)) { + const array = values.locations; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.locations; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = values.locations.slice(); + clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = copied; clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = new Set(); - for (let i = 0; i < values.locations.length; i++) { - clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.add(i); - } + vocabSetTrustPrefix(clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location, clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length); } else { throw new TypeError( @@ -1794,12 +2860,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.slice();clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = new Set(this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview); + clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length < vocabSparseArrayMinimumLength + ? this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.slice() : vocabCopyPropertyArray(this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview);clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = vocabCopyTrustSet( + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, + ); if (\\"preview\\" in values && values.preview != null) { if (values.preview instanceof Link || values.preview instanceof Object || values.preview instanceof URL) { // @ts-ignore: type is checked above. clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = [values.preview]; - clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = new Set([0]); + clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = new Set(); + clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The preview must be of type \\" + @@ -1818,15 +2888,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.previews) && - values.previews.every(v => v instanceof Link || v instanceof Object || v instanceof URL)) { + let copied!: (Link | Object | URL)[]; + let valid = false; + if (Array.isArray(values.previews)) { + const array = values.previews; + const test = (v: Link | Object | URL): boolean => v instanceof Link || v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.previews; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = values.previews.slice(); + clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = copied; clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = new Set(); - for (let i = 0; i < values.previews.length; i++) { - clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.add(i); - } + vocabSetTrustPrefix(clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length); } else { throw new TypeError( @@ -1835,7 +2927,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published.slice(); + clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published.length < vocabSparseArrayMinimumLength + ? this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published.slice() : vocabCopyPropertyArray(this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published); if (\\"published\\" in values && values.published != null) { if (isTemporalInstant(values.published)) { // @ts-ignore: type is checked above. @@ -1848,12 +2941,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_7UpwM3JWcXhADcscukEehBorf6k_replies = this.#_7UpwM3JWcXhADcscukEehBorf6k_replies.slice();clone.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies = new Set(this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies); + clone.#_7UpwM3JWcXhADcscukEehBorf6k_replies = this.#_7UpwM3JWcXhADcscukEehBorf6k_replies.length < vocabSparseArrayMinimumLength + ? this.#_7UpwM3JWcXhADcscukEehBorf6k_replies.slice() : vocabCopyPropertyArray(this.#_7UpwM3JWcXhADcscukEehBorf6k_replies);clone.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies = vocabCopyTrustSet( + this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies, clone.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies, + ); if (\\"replies\\" in values && values.replies != null) { if (values.replies instanceof Collection || values.replies instanceof URL) { // @ts-ignore: type is checked above. clone.#_7UpwM3JWcXhADcscukEehBorf6k_replies = [values.replies]; - clone.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies = new Set([0]); + clone.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies = new Set(); + clone.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The replies must be of type \\" + @@ -1861,12 +2958,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares = this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares.slice();clone.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares = new Set(this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares); + clone.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares = this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares.length < vocabSparseArrayMinimumLength + ? this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares.slice() : vocabCopyPropertyArray(this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares);clone.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares = vocabCopyTrustSet( + this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares, clone.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares, + ); if (\\"shares\\" in values && values.shares != null) { if (values.shares instanceof Collection || values.shares instanceof URL) { // @ts-ignore: type is checked above. clone.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares = [values.shares]; - clone.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares = new Set([0]); + clone.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares = new Set(); + clone.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The shares must be of type \\" + @@ -1874,12 +2975,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.slice();clone.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = new Set(this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes); + clone.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.length < vocabSparseArrayMinimumLength + ? this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.slice() : vocabCopyPropertyArray(this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes);clone.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = vocabCopyTrustSet( + this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes, clone.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes, + ); if (\\"likes\\" in values && values.likes != null) { if (values.likes instanceof Collection || values.likes instanceof URL) { // @ts-ignore: type is checked above. clone.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = [values.likes]; - clone.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = new Set([0]); + clone.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = new Set(); + clone.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The likes must be of type \\" + @@ -1887,12 +2992,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.slice();clone.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = new Set(this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions); + clone.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.length < vocabSparseArrayMinimumLength + ? this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.slice() : vocabCopyPropertyArray(this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions);clone.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = vocabCopyTrustSet( + this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions, clone.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions, + ); if (\\"emojiReactions\\" in values && values.emojiReactions != null) { if (values.emojiReactions instanceof Collection || values.emojiReactions instanceof URL) { // @ts-ignore: type is checked above. clone.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = [values.emojiReactions]; - clone.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = new Set([0]); + clone.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = new Set(); + clone.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The emojiReactions must be of type \\" + @@ -1900,7 +3009,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime.slice(); + clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime.length < vocabSparseArrayMinimumLength + ? this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime.slice() : vocabCopyPropertyArray(this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime); if (\\"startTime\\" in values && values.startTime != null) { if (isTemporalInstant(values.startTime)) { // @ts-ignore: type is checked above. @@ -1913,7 +3023,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.slice(); + clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.length < vocabSparseArrayMinimumLength + ? this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.slice() : vocabCopyPropertyArray(this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary); if (\\"summary\\" in values && values.summary != null) { if (typeof values.summary === \\"string\\" || values.summary instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -1937,10 +3048,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.summaries) && - values.summaries.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.summaries)) { + const array = values.summaries; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.summaries; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = values.summaries.slice(); + clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = copied; } else { throw new TypeError( @@ -1949,18 +3084,43 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag.slice();clone.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag = new Set(this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag); + clone.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag.length < vocabSparseArrayMinimumLength + ? this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag.slice() : vocabCopyPropertyArray(this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag);clone.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag = vocabCopyTrustSet( + this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag, clone.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag, + ); if (\\"tags\\" in values && values.tags != null) { - if (Array.isArray(values.tags) && - values.tags.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.tags)) { + const array = values.tags; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.tags; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = values.tags.slice(); + clone.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = copied; clone.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag = new Set(); - for (let i = 0; i < values.tags.length; i++) { - clone.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.add(i); - } + vocabSetTrustPrefix(clone.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag, clone.#_5chuqj6s95p5gg2sk1HntGfarRf_tag.length); } else { throw new TypeError( @@ -1969,7 +3129,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated.slice(); + clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated.length < vocabSparseArrayMinimumLength + ? this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated.slice() : vocabCopyPropertyArray(this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated); if (\\"updated\\" in values && values.updated != null) { if (isTemporalInstant(values.updated)) { // @ts-ignore: type is checked above. @@ -1982,7 +3143,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.slice(); + clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length < vocabSparseArrayMinimumLength + ? this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.slice() : vocabCopyPropertyArray(this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url); if (\\"url\\" in values && values.url != null) { if (values.url instanceof URL || values.url instanceof Link) { // @ts-ignore: type is checked above. @@ -2006,10 +3168,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.urls) && - values.urls.every(v => v instanceof URL || v instanceof Link)) { + let copied!: (URL | Link)[]; + let valid = false; + if (Array.isArray(values.urls)) { + const array = values.urls; + const test = (v: URL | Link): boolean => v instanceof URL || v instanceof Link; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.urls; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls.slice(); + clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = copied; } else { throw new TypeError( @@ -2018,12 +3204,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.slice();clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = new Set(this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to); + clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length < vocabSparseArrayMinimumLength + ? this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.slice() : vocabCopyPropertyArray(this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to);clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = vocabCopyTrustSet( + this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to, clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to, + ); if (\\"to\\" in values && values.to != null) { if (values.to instanceof Object || values.to instanceof URL) { // @ts-ignore: type is checked above. clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = [values.to]; - clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = new Set([0]); + clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = new Set(); + clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The to must be of type \\" + @@ -2042,15 +3232,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.tos) && - values.tos.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.tos)) { + const array = values.tos; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.tos; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = values.tos.slice(); + clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = copied; clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = new Set(); - for (let i = 0; i < values.tos.length; i++) { - clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to, clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length); } else { throw new TypeError( @@ -2059,12 +3271,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.slice();clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = new Set(this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto); + clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length < vocabSparseArrayMinimumLength + ? this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.slice() : vocabCopyPropertyArray(this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto);clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = vocabCopyTrustSet( + this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto, clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto, + ); if (\\"bto\\" in values && values.bto != null) { if (values.bto instanceof Object || values.bto instanceof URL) { // @ts-ignore: type is checked above. clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = [values.bto]; - clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = new Set([0]); + clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = new Set(); + clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The bto must be of type \\" + @@ -2083,15 +3299,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.btos) && - values.btos.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.btos)) { + const array = values.btos; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.btos; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = values.btos.slice(); + clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = copied; clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = new Set(); - for (let i = 0; i < values.btos.length; i++) { - clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.add(i); - } + vocabSetTrustPrefix(clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto, clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length); } else { throw new TypeError( @@ -2100,12 +3338,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.slice();clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = new Set(this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc); + clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length < vocabSparseArrayMinimumLength + ? this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.slice() : vocabCopyPropertyArray(this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc);clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = vocabCopyTrustSet( + this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc, clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc, + ); if (\\"cc\\" in values && values.cc != null) { if (values.cc instanceof Object || values.cc instanceof URL) { // @ts-ignore: type is checked above. clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = [values.cc]; - clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = new Set([0]); + clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = new Set(); + clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The cc must be of type \\" + @@ -2124,15 +3366,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.ccs) && - values.ccs.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.ccs)) { + const array = values.ccs; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.ccs; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = values.ccs.slice(); + clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = copied; clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = new Set(); - for (let i = 0; i < values.ccs.length; i++) { - clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.add(i); - } + vocabSetTrustPrefix(clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc, clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length); } else { throw new TypeError( @@ -2141,12 +3405,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.slice();clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = new Set(this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc); + clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length < vocabSparseArrayMinimumLength + ? this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.slice() : vocabCopyPropertyArray(this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc);clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = vocabCopyTrustSet( + this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc, clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc, + ); if (\\"bcc\\" in values && values.bcc != null) { if (values.bcc instanceof Object || values.bcc instanceof URL) { // @ts-ignore: type is checked above. clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = [values.bcc]; - clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = new Set([0]); + clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = new Set(); + clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The bcc must be of type \\" + @@ -2165,15 +3433,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.bccs) && - values.bccs.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.bccs)) { + const array = values.bccs; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.bccs; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = values.bccs.slice(); + clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = copied; clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = new Set(); - for (let i = 0; i < values.bccs.length; i++) { - clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc, clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length); } else { throw new TypeError( @@ -2182,7 +3472,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.slice(); + clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.length < vocabSparseArrayMinimumLength + ? this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.slice() : vocabCopyPropertyArray(this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType); if (\\"mediaType\\" in values && values.mediaType != null) { if (typeof values.mediaType === \\"string\\") { // @ts-ignore: type is checked above. @@ -2195,7 +3486,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration.slice(); + clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration.length < vocabSparseArrayMinimumLength + ? this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration.slice() : vocabCopyPropertyArray(this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration); if (\\"duration\\" in values && values.duration != null) { if (isTemporalDuration(values.duration)) { // @ts-ignore: type is checked above. @@ -2208,7 +3500,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive.slice(); + clone.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive.length < vocabSparseArrayMinimumLength + ? this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive.slice() : vocabCopyPropertyArray(this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive); if (\\"sensitive\\" in values && values.sensitive != null) { if (typeof values.sensitive === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -2221,7 +3514,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.slice(); + clone.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.length < vocabSparseArrayMinimumLength + ? this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.slice() : vocabCopyPropertyArray(this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source); if (\\"source\\" in values && values.source != null) { if (values.source instanceof Source) { // @ts-ignore: type is checked above. @@ -2234,12 +3528,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.slice();clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = new Set(this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof); + clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length < vocabSparseArrayMinimumLength + ? this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.slice() : vocabCopyPropertyArray(this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof);clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = vocabCopyTrustSet( + this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof, clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof, + ); if (\\"proof\\" in values && values.proof != null) { if (values.proof instanceof DataIntegrityProof || values.proof instanceof URL) { // @ts-ignore: type is checked above. clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = [values.proof]; - clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = new Set([0]); + clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = new Set(); + clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The proof must be of type \\" + @@ -2258,15 +3556,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.proofs) && - values.proofs.every(v => v instanceof DataIntegrityProof || v instanceof URL)) { + let copied!: (DataIntegrityProof | URL)[]; + let valid = false; + if (Array.isArray(values.proofs)) { + const array = values.proofs; + const test = (v: DataIntegrityProof | URL): boolean => v instanceof DataIntegrityProof || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.proofs; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = values.proofs.slice(); + clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = copied; clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = new Set(); - for (let i = 0; i < values.proofs.length; i++) { - clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.add(i); - } + vocabSetTrustPrefix(clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof, clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length); } else { throw new TypeError( @@ -2275,7 +3595,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy = this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.slice(); + clone.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy = this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.length < vocabSparseArrayMinimumLength + ? this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.slice() : vocabCopyPropertyArray(this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy); if (\\"interactionPolicy\\" in values && values.interactionPolicy != null) { if (values.interactionPolicy instanceof InteractionPolicy) { // @ts-ignore: type is checked above. @@ -2288,7 +3609,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.slice(); + clone.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.length < vocabSparseArrayMinimumLength + ? this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.slice() : vocabCopyPropertyArray(this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy); if (\\"approvedBy\\" in values && values.approvedBy != null) { if (values.approvedBy instanceof URL) { // @ts-ignore: type is checked above. @@ -2301,12 +3623,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.slice();clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = new Set(this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization); + clone.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.slice() : vocabCopyPropertyArray(this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization);clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = vocabCopyTrustSet( + this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization, clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization, + ); if (\\"likeAuthorization\\" in values && values.likeAuthorization != null) { if (values.likeAuthorization instanceof LikeAuthorization || values.likeAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = [values.likeAuthorization]; - clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = new Set([0]); + clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = new Set(); + clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The likeAuthorization must be of type \\" + @@ -2314,12 +3640,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.slice();clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = new Set(this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization); + clone.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.slice() : vocabCopyPropertyArray(this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization);clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = vocabCopyTrustSet( + this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization, clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization, + ); if (\\"replyAuthorization\\" in values && values.replyAuthorization != null) { if (values.replyAuthorization instanceof ReplyAuthorization || values.replyAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = [values.replyAuthorization]; - clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = new Set([0]); + clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = new Set(); + clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The replyAuthorization must be of type \\" + @@ -2327,12 +3657,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.slice();clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = new Set(this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization); + clone.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.slice() : vocabCopyPropertyArray(this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization);clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = vocabCopyTrustSet( + this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization, clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization, + ); if (\\"announceAuthorization\\" in values && values.announceAuthorization != null) { if (values.announceAuthorization instanceof AnnounceAuthorization || values.announceAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = [values.announceAuthorization]; - clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = new Set([0]); + clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = new Set(); + clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The announceAuthorization must be of type \\" + @@ -2340,13 +3674,38 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.slice(); + clone.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.length < vocabSparseArrayMinimumLength + ? this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.slice() : vocabCopyPropertyArray(this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations); if (\\"translations\\" in values && values.translations != null) { - if (Array.isArray(values.translations) && - values.translations.every(v => v instanceof Translation)) { + let copied!: (Translation)[]; + let valid = false; + if (Array.isArray(values.translations)) { + const array = values.translations; + const test = (v: Translation): boolean => v instanceof Translation; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.translations; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = values.translations.slice(); + clone.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = copied; } else { throw new TypeError( @@ -2355,13 +3714,38 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.slice(); + clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.length < vocabSparseArrayMinimumLength + ? this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.slice() : vocabCopyPropertyArray(this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d); if (\\"licenses\\" in values && values.licenses != null) { - if (Array.isArray(values.licenses) && - values.licenses.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.licenses)) { + const array = values.licenses; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.licenses; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = values.licenses.slice(); + clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = copied; } else { throw new TypeError( @@ -2373,7 +3757,733 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Object { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Object; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Object; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.length; i++) { + const value = node.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment[i]; + if (value != null && typeof value === \\"object\\") { + node.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment[i] = context.value(value); + } + } + } + } + + { + const array = node.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length; i++) { + const value = node.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[i]; + if (value != null && typeof value === \\"object\\") { + node.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length; i++) { + const value = node.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3mhZzGXSpQ431mBSz2kvych22v4e_context; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3mhZzGXSpQ431mBSz2kvych22v4e_context.length; i++) { + const value = node.#_3mhZzGXSpQ431mBSz2kvych22v4e_context[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3mhZzGXSpQ431mBSz2kvych22v4e_context[i] = context.value(value); + } + } + } + } + + { + const array = node.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator.length; i++) { + const value = node.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator[i]; + if (value != null && typeof value === \\"object\\") { + node.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator[i] = context.value(value); + } + } + } + } + + { + const array = node.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length; i++) { + const value = node.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[i]; + if (value != null && typeof value === \\"object\\") { + node.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length; i++) { + const value = node.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length; i++) { + const value = node.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length; i++) { + const value = node.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[i]; + if (value != null && typeof value === \\"object\\") { + node.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[i] = context.value(value); + } + } + } + } + + { + const array = node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length; i++) { + const value = node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview[i]; + if (value != null && typeof value === \\"object\\") { + node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview[i] = context.value(value); + } + } + } + } + + { + const array = node.#_7UpwM3JWcXhADcscukEehBorf6k_replies; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_7UpwM3JWcXhADcscukEehBorf6k_replies.length; i++) { + const value = node.#_7UpwM3JWcXhADcscukEehBorf6k_replies[i]; + if (value != null && typeof value === \\"object\\") { + node.#_7UpwM3JWcXhADcscukEehBorf6k_replies[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares.length; i++) { + const value = node.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares[i] = context.value(value); + } + } + } + } + + { + const array = node.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.length; i++) { + const value = node.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[i]; + if (value != null && typeof value === \\"object\\") { + node.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[i] = context.value(value); + } + } + } + } + + { + const array = node.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.length; i++) { + const value = node.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[i]; + if (value != null && typeof value === \\"object\\") { + node.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[i] = context.value(value); + } + } + } + } + + { + const array = node.#_5chuqj6s95p5gg2sk1HntGfarRf_tag; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_5chuqj6s95p5gg2sk1HntGfarRf_tag.length; i++) { + const value = node.#_5chuqj6s95p5gg2sk1HntGfarRf_tag[i]; + if (value != null && typeof value === \\"object\\") { + node.#_5chuqj6s95p5gg2sk1HntGfarRf_tag[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length; i++) { + const value = node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length; i++) { + const value = node.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[i] = context.value(value); + } + } + } + } + + { + const array = node.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length; i++) { + const value = node.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[i]; + if (value != null && typeof value === \\"object\\") { + node.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[i] = context.value(value); + } + } + } + } + + { + const array = node.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length; i++) { + const value = node.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[i]; + if (value != null && typeof value === \\"object\\") { + node.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length; i++) { + const value = node.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.length; i++) { + const value = node.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source[i] = context.value(value); + } + } + } + } + + { + const array = node.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length; i++) { + const value = node.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[i]; + if (value != null && typeof value === \\"object\\") { + node.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.length; i++) { + const value = node.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy[i] = context.value(value); + } + } + } + } + + { + const array = node.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.length; i++) { + const value = node.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy[i]; + if (value != null && typeof value === \\"object\\") { + node.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.length; i++) { + const value = node.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[i] = context.value(value); + } + } + } + } + + { + const array = node.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.length; i++) { + const value = node.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[i]; + if (value != null && typeof value === \\"object\\") { + node.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[i] = context.value(value); + } + } + } + } + + { + const array = node.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.length; i++) { + const value = node.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[i]; + if (value != null && typeof value === \\"object\\") { + node.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[i] = context.value(value); + } + } + } + } + + { + const array = node.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.length; i++) { + const value = node.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations[i]; + if (value != null && typeof value === \\"object\\") { + node.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.length; i++) { + const value = node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d[i] = context.value(value); + } + } + } + } +} }); } + async #fetchAttachment( url: URL, options: { @@ -2732,7 +4842,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(i)) { + !(i < (this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment[vocabTrustPrefix] ?? 0) || + this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#attachment\\"); @@ -2804,7 +4915,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(i)) { + !(i < (this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment[vocabTrustPrefix] ?? 0) || + this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -3217,7 +5329,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0]; if (!(v instanceof URL) && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { + !(0 < (this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#attributedTo\\"); @@ -3285,7 +5398,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { + !(0 < (this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -3375,7 +5489,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(i)) { + !(i < (this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#attributedTo\\"); @@ -3447,7 +5562,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(i)) { + !(i < (this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -3799,7 +5915,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0]; if (!(v instanceof URL) && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + !(0 < (this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[vocabTrustPrefix] ?? 0) || + this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#audience\\"); @@ -3867,7 +5984,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + !(0 < (this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[vocabTrustPrefix] ?? 0) || + this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -3956,7 +6074,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(i)) { + !(i < (this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[vocabTrustPrefix] ?? 0) || + this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#audience\\"); @@ -4028,7 +6147,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(i)) { + !(i < (this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[vocabTrustPrefix] ?? 0) || + this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -4429,7 +6549,8 @@ get contents(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context.has(i)) { + !(i < (this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context[vocabTrustPrefix] ?? 0) || + this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#context\\"); @@ -4501,7 +6622,8 @@ get contents(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context.has(i)) { + !(i < (this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context[vocabTrustPrefix] ?? 0) || + this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -4909,7 +7031,8 @@ get names(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator.has(i)) { + !(i < (this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator[vocabTrustPrefix] ?? 0) || + this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#generator\\"); @@ -4981,7 +7104,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator.has(i)) { + !(i < (this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator[vocabTrustPrefix] ?? 0) || + this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -5356,7 +7480,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[0]; if (!(v instanceof URL) && - !this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(0)) { + !(0 < (this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[vocabTrustPrefix] ?? 0) || + this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#icon\\"); @@ -5424,7 +7549,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(0)) { + !(0 < (this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[vocabTrustPrefix] ?? 0) || + this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -5514,7 +7640,8 @@ get names(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(i)) { + !(i < (this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[vocabTrustPrefix] ?? 0) || + this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#icon\\"); @@ -5586,7 +7713,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(i)) { + !(i < (this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[vocabTrustPrefix] ?? 0) || + this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -5961,7 +8089,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[0]; if (!(v instanceof URL) && - !this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(0)) { + !(0 < (this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[vocabTrustPrefix] ?? 0) || + this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#image\\"); @@ -6029,7 +8158,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(0)) { + !(0 < (this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[vocabTrustPrefix] ?? 0) || + this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -6119,7 +8249,8 @@ get names(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(i)) { + !(i < (this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[vocabTrustPrefix] ?? 0) || + this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#image\\"); @@ -6191,7 +8322,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(i)) { + !(i < (this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[vocabTrustPrefix] ?? 0) || + this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -6558,7 +8690,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[0]; if (!(v instanceof URL) && - !this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(0)) { + !(0 < (this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[vocabTrustPrefix] ?? 0) || + this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#inReplyTo\\"); @@ -6626,7 +8759,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(0)) { + !(0 < (this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[vocabTrustPrefix] ?? 0) || + this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -6715,7 +8849,8 @@ get names(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(i)) { + !(i < (this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[vocabTrustPrefix] ?? 0) || + this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#inReplyTo\\"); @@ -6787,7 +8922,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(i)) { + !(i < (this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[vocabTrustPrefix] ?? 0) || + this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -7154,7 +9290,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[0]; if (!(v instanceof URL) && - !this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(0)) { + !(0 < (this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[vocabTrustPrefix] ?? 0) || + this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#location\\"); @@ -7222,7 +9359,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(0)) { + !(0 < (this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[vocabTrustPrefix] ?? 0) || + this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -7311,7 +9449,8 @@ get names(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(i)) { + !(i < (this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[vocabTrustPrefix] ?? 0) || + this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#location\\"); @@ -7383,7 +9522,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(i)) { + !(i < (this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[vocabTrustPrefix] ?? 0) || + this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -7749,7 +9889,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview[0]; if (!(v instanceof URL) && - !this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(0)) { + !(0 < (this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview[vocabTrustPrefix] ?? 0) || + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#preview\\"); @@ -7817,7 +9958,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(0)) { + !(0 < (this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview[vocabTrustPrefix] ?? 0) || + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -7905,7 +10047,8 @@ get names(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i)) { + !(i < (this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview[vocabTrustPrefix] ?? 0) || + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#preview\\"); @@ -7977,7 +10120,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i)) { + !(i < (this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview[vocabTrustPrefix] ?? 0) || + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -8342,7 +10486,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_7UpwM3JWcXhADcscukEehBorf6k_replies[0]; if (!(v instanceof URL) && - !this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies.has(0)) { + !(0 < (this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies[vocabTrustPrefix] ?? 0) || + this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#replies\\"); @@ -8410,7 +10555,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies.has(0)) { + !(0 < (this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies[vocabTrustPrefix] ?? 0) || + this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -8767,7 +10913,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares[0]; if (!(v instanceof URL) && - !this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares.has(0)) { + !(0 < (this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares[vocabTrustPrefix] ?? 0) || + this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#shares\\"); @@ -8835,7 +10982,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares.has(0)) { + !(0 < (this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares[vocabTrustPrefix] ?? 0) || + this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -9192,7 +11340,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[0]; if (!(v instanceof URL) && - !this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.has(0)) { + !(0 < (this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[vocabTrustPrefix] ?? 0) || + this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#likes\\"); @@ -9260,7 +11409,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.has(0)) { + !(0 < (this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[vocabTrustPrefix] ?? 0) || + this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -9611,7 +11761,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[0]; if (!(v instanceof URL) && - !this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.has(0)) { + !(0 < (this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[vocabTrustPrefix] ?? 0) || + this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://fedibird.com/ns#emojiReactions\\"); @@ -9679,7 +11830,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.has(0)) { + !(0 < (this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[vocabTrustPrefix] ?? 0) || + this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -10087,7 +12239,8 @@ get summaries(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.has(i)) { + !(i < (this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag[vocabTrustPrefix] ?? 0) || + this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#tag\\"); @@ -10159,7 +12312,8 @@ get summaries(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.has(i)) { + !(i < (this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag[vocabTrustPrefix] ?? 0) || + this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -10545,7 +12699,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[0]; if (!(v instanceof URL) && - !this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(0)) { + !(0 < (this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[vocabTrustPrefix] ?? 0) || + this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#to\\"); @@ -10613,7 +12768,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(0)) { + !(0 < (this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[vocabTrustPrefix] ?? 0) || + this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -10702,7 +12858,8 @@ get urls(): ((URL | Link))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(i)) { + !(i < (this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[vocabTrustPrefix] ?? 0) || + this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#to\\"); @@ -10774,7 +12931,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(i)) { + !(i < (this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[vocabTrustPrefix] ?? 0) || + this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -11126,7 +13284,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[0]; if (!(v instanceof URL) && - !this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(0)) { + !(0 < (this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[vocabTrustPrefix] ?? 0) || + this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#bto\\"); @@ -11194,7 +13353,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(0)) { + !(0 < (this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[vocabTrustPrefix] ?? 0) || + this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -11283,7 +13443,8 @@ get urls(): ((URL | Link))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(i)) { + !(i < (this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[vocabTrustPrefix] ?? 0) || + this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#bto\\"); @@ -11355,7 +13516,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(i)) { + !(i < (this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[vocabTrustPrefix] ?? 0) || + this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -11707,7 +13869,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[0]; if (!(v instanceof URL) && - !this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(0)) { + !(0 < (this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[vocabTrustPrefix] ?? 0) || + this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#cc\\"); @@ -11775,7 +13938,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(0)) { + !(0 < (this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[vocabTrustPrefix] ?? 0) || + this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -11864,7 +14028,8 @@ get urls(): ((URL | Link))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(i)) { + !(i < (this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[vocabTrustPrefix] ?? 0) || + this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#cc\\"); @@ -11936,7 +14101,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(i)) { + !(i < (this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[vocabTrustPrefix] ?? 0) || + this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -12288,7 +14454,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[0]; if (!(v instanceof URL) && - !this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(0)) { + !(0 < (this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[vocabTrustPrefix] ?? 0) || + this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#bcc\\"); @@ -12356,7 +14523,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(0)) { + !(0 < (this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[vocabTrustPrefix] ?? 0) || + this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -12445,7 +14613,8 @@ get urls(): ((URL | Link))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(i)) { + !(i < (this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[vocabTrustPrefix] ?? 0) || + this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#bcc\\"); @@ -12517,7 +14686,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(i)) { + !(i < (this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[vocabTrustPrefix] ?? 0) || + this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -12932,7 +15102,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[0]; if (!(v instanceof URL) && - !this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(0)) { + !(0 < (this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[vocabTrustPrefix] ?? 0) || + this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#proof\\"); @@ -13000,7 +15171,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(0)) { + !(0 < (this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[vocabTrustPrefix] ?? 0) || + this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -13088,7 +15260,8 @@ get urls(): ((URL | Link))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(i)) { + !(i < (this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[vocabTrustPrefix] ?? 0) || + this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#proof\\"); @@ -13160,7 +15333,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(i)) { + !(i < (this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[vocabTrustPrefix] ?? 0) || + this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -13551,7 +15725,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.has(0)) { + !(0 < (this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#likeAuthorization\\"); @@ -13619,7 +15794,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.has(0)) { + !(0 < (this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -13970,7 +16146,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.has(0)) { + !(0 < (this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#replyAuthorization\\"); @@ -14038,7 +16215,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.has(0)) { + !(0 < (this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -14389,7 +16567,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.has(0)) { + !(0 < (this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#announceAuthorization\\"); @@ -14457,7 +16636,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.has(0)) { + !(0 < (this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -16669,7 +18849,7 @@ get licenses(): (URL)[] { let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _49BipA5dq9eoH8LX8xdsVumveTca_attachment: (Object | Link | PropertyValue | URL)[] = []; - const _trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment: Set = new Set(); + const _trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment: VocabTrustSet = new Set(); let _49BipA5dq9eoH8LX8xdsVumveTca_attachment__array = values[\\"https://www.w3.org/ns/activitystreams#attachment\\"]; @@ -16721,7 +18901,7 @@ get licenses(): (URL)[] { instance.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = _49BipA5dq9eoH8LX8xdsVumveTca_attachment; const _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: Set = new Set(); + const _trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: VocabTrustSet = new Set(); let _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo__array = values[\\"https://www.w3.org/ns/activitystreams#attributedTo\\"]; @@ -16779,7 +18959,7 @@ get licenses(): (URL)[] { instance.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo; const _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience: (Object | URL)[] = []; - const _trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience: Set = new Set(); + const _trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience: VocabTrustSet = new Set(); let _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience__array = values[\\"https://www.w3.org/ns/activitystreams#audience\\"]; @@ -16853,7 +19033,7 @@ get licenses(): (URL)[] { instance.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content; const _3mhZzGXSpQ431mBSz2kvych22v4e_context: (Object | Link | URL)[] = []; - const _trust_3mhZzGXSpQ431mBSz2kvych22v4e_context: Set = new Set(); + const _trust_3mhZzGXSpQ431mBSz2kvych22v4e_context: VocabTrustSet = new Set(); let _3mhZzGXSpQ431mBSz2kvych22v4e_context__array = values[\\"https://www.w3.org/ns/activitystreams#context\\"]; @@ -16967,7 +19147,7 @@ get licenses(): (URL)[] { instance.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime; const _86xFhmgBapoMvYqjbjRuDPayTrS_generator: (Object | Link | URL)[] = []; - const _trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator: Set = new Set(); + const _trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator: VocabTrustSet = new Set(); let _86xFhmgBapoMvYqjbjRuDPayTrS_generator__array = values[\\"https://www.w3.org/ns/activitystreams#generator\\"]; @@ -17015,7 +19195,7 @@ get licenses(): (URL)[] { instance.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = _86xFhmgBapoMvYqjbjRuDPayTrS_generator; const _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon: (Image | URL)[] = []; - const _trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon: Set = new Set(); + const _trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon: VocabTrustSet = new Set(); let _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon__array = values[\\"https://www.w3.org/ns/activitystreams#icon\\"]; @@ -17079,7 +19259,7 @@ get licenses(): (URL)[] { instance.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon; const _3dXrUdkARxwyJLtJcYi1AJ92H41U_image: (Image | URL)[] = []; - const _trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image: Set = new Set(); + const _trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image: VocabTrustSet = new Set(); let _3dXrUdkARxwyJLtJcYi1AJ92H41U_image__array = values[\\"https://www.w3.org/ns/activitystreams#image\\"]; @@ -17143,7 +19323,7 @@ get licenses(): (URL)[] { instance.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = _3dXrUdkARxwyJLtJcYi1AJ92H41U_image; const _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo: (Object | Link | URL)[] = []; - const _trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo: Set = new Set(); + const _trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo: VocabTrustSet = new Set(); let _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo__array = values[\\"https://www.w3.org/ns/activitystreams#inReplyTo\\"]; @@ -17191,7 +19371,7 @@ get licenses(): (URL)[] { instance.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo; const _31k5MUZJsnsPNg8dQQJieWaXTFnR_location: (Object | Link | URL)[] = []; - const _trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location: Set = new Set(); + const _trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location: VocabTrustSet = new Set(); let _31k5MUZJsnsPNg8dQQJieWaXTFnR_location__array = values[\\"https://www.w3.org/ns/activitystreams#location\\"]; @@ -17239,7 +19419,7 @@ get licenses(): (URL)[] { instance.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = _31k5MUZJsnsPNg8dQQJieWaXTFnR_location; const _gCVTegXxWWCw6wWRxa1QF65zusg_preview: (Link | Object | URL)[] = []; - const _trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: Set = new Set(); + const _trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: VocabTrustSet = new Set(); let _gCVTegXxWWCw6wWRxa1QF65zusg_preview__array = values[\\"https://www.w3.org/ns/activitystreams#preview\\"]; @@ -17320,7 +19500,7 @@ get licenses(): (URL)[] { instance.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = _5e258TDXtuhaFRPZiGoDfEpjdMr_published; const _7UpwM3JWcXhADcscukEehBorf6k_replies: (Collection | URL)[] = []; - const _trust_7UpwM3JWcXhADcscukEehBorf6k_replies: Set = new Set(); + const _trust_7UpwM3JWcXhADcscukEehBorf6k_replies: VocabTrustSet = new Set(); let _7UpwM3JWcXhADcscukEehBorf6k_replies__array = values[\\"https://www.w3.org/ns/activitystreams#replies\\"]; @@ -17361,7 +19541,7 @@ get licenses(): (URL)[] { instance.#_7UpwM3JWcXhADcscukEehBorf6k_replies = _7UpwM3JWcXhADcscukEehBorf6k_replies; const _3kAfck9PcEYt2L7xug5y99YPbANs_shares: (Collection | URL)[] = []; - const _trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares: Set = new Set(); + const _trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares: VocabTrustSet = new Set(); let _3kAfck9PcEYt2L7xug5y99YPbANs_shares__array = values[\\"https://www.w3.org/ns/activitystreams#shares\\"]; @@ -17402,7 +19582,7 @@ get licenses(): (URL)[] { instance.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares = _3kAfck9PcEYt2L7xug5y99YPbANs_shares; const _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes: (Collection | URL)[] = []; - const _trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes: Set = new Set(); + const _trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes: VocabTrustSet = new Set(); let _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes__array = values[\\"https://www.w3.org/ns/activitystreams#likes\\"]; @@ -17443,7 +19623,7 @@ get licenses(): (URL)[] { instance.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes; const _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: (Collection | URL)[] = []; - const _trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: Set = new Set(); + const _trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: VocabTrustSet = new Set(); let _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions__array = values[\\"http://fedibird.com/ns#emojiReactions\\"]; @@ -17550,7 +19730,7 @@ get licenses(): (URL)[] { instance.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary; const _5chuqj6s95p5gg2sk1HntGfarRf_tag: (Object | Link | URL)[] = []; - const _trust_5chuqj6s95p5gg2sk1HntGfarRf_tag: Set = new Set(); + const _trust_5chuqj6s95p5gg2sk1HntGfarRf_tag: VocabTrustSet = new Set(); let _5chuqj6s95p5gg2sk1HntGfarRf_tag__array = values[\\"https://www.w3.org/ns/activitystreams#tag\\"]; @@ -17667,7 +19847,7 @@ get licenses(): (URL)[] { instance.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; const _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to: (Object | URL)[] = []; - const _trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to: Set = new Set(); + const _trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to: VocabTrustSet = new Set(); let _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to__array = values[\\"https://www.w3.org/ns/activitystreams#to\\"]; @@ -17708,7 +19888,7 @@ get licenses(): (URL)[] { instance.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to; const _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto: (Object | URL)[] = []; - const _trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto: Set = new Set(); + const _trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto: VocabTrustSet = new Set(); let _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto__array = values[\\"https://www.w3.org/ns/activitystreams#bto\\"]; @@ -17749,7 +19929,7 @@ get licenses(): (URL)[] { instance.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto; const _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc: (Object | URL)[] = []; - const _trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc: Set = new Set(); + const _trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc: VocabTrustSet = new Set(); let _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc__array = values[\\"https://www.w3.org/ns/activitystreams#cc\\"]; @@ -17790,7 +19970,7 @@ get licenses(): (URL)[] { instance.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc; const _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc: (Object | URL)[] = []; - const _trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc: Set = new Set(); + const _trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc: VocabTrustSet = new Set(); let _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc__array = values[\\"https://www.w3.org/ns/activitystreams#bcc\\"]; @@ -17950,7 +20130,7 @@ get licenses(): (URL)[] { instance.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source; const _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: (DataIntegrityProof | URL)[] = []; - const _trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: Set = new Set(); + const _trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: VocabTrustSet = new Set(); let _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof__array = values[\\"https://w3id.org/security#proof\\"]; @@ -18057,7 +20237,7 @@ get licenses(): (URL)[] { instance.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy; const _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: (LikeAuthorization | URL)[] = []; - const _trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: Set = new Set(); + const _trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: VocabTrustSet = new Set(); let _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization__array = values[\\"https://gotosocial.org/ns#likeAuthorization\\"]; @@ -18098,7 +20278,7 @@ get licenses(): (URL)[] { instance.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization; const _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: (ReplyAuthorization | URL)[] = []; - const _trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: Set = new Set(); + const _trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: VocabTrustSet = new Set(); let _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization__array = values[\\"https://gotosocial.org/ns#replyAuthorization\\"]; @@ -18139,7 +20319,7 @@ get licenses(): (URL)[] { instance.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization; const _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: (AnnounceAuthorization | URL)[] = []; - const _trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: Set = new Set(); + const _trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: VocabTrustSet = new Set(); let _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization__array = values[\\"https://gotosocial.org/ns#announceAuthorization\\"]; @@ -19267,8 +21447,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Emoji.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -19323,7 +21503,77 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const clone = super.clone(values, options) as unknown as Emoji; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Emoji { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -19671,11 +21921,11 @@ export class ChatMessage extends Object { } #_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); #_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; #_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); /** * Constructs a new instance of ChatMessage with the given values. @@ -19763,8 +22013,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link ChatMessage.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -19816,12 +22066,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as ChatMessage;clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice();clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote); + const clone = super.clone(values, options) as unknown as ChatMessage;clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length < vocabSparseArrayMinimumLength + ? this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice() : vocabCopyPropertyArray(this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote);clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = vocabCopyTrustSet( + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, + ); if (\\"quote\\" in values && values.quote != null) { if (values.quote instanceof Object || values.quote instanceof URL) { // @ts-ignore: type is checked above. clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = [values.quote]; - clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set([0]); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The quote must be of type \\" + @@ -19829,7 +22083,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice(); + clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length < vocabSparseArrayMinimumLength + ? this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice() : vocabCopyPropertyArray(this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl); if (\\"quoteUrl\\" in values && values.quoteUrl != null) { if (values.quoteUrl instanceof URL) { // @ts-ignore: type is checked above. @@ -19842,12 +22097,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice();clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization); + clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice() : vocabCopyPropertyArray(this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization);clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = vocabCopyTrustSet( + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, + ); if (\\"quoteAuthorization\\" in values && values.quoteAuthorization != null) { if (values.quoteAuthorization instanceof QuoteAuthorization || values.quoteAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = [values.quoteAuthorization]; - clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set([0]); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The quoteAuthorization must be of type \\" + @@ -19858,7 +22117,151 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];quote?: Object | URL | null;quoteUrl?: URL | null;quoteAuthorization?: QuoteAuthorization | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): ChatMessage { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as ChatMessage; + + { + const array = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length; i++) { + const value = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i] = context.value(value); + } + } + } + } + + { + const array = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length; i++) { + const value = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i]; + if (value != null && typeof value === \\"object\\") { + node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i] = context.value(value); + } + } + } + } + + { + const array = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length; i++) { + const value = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i]; + if (value != null && typeof value === \\"object\\") { + node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i] = context.value(value); + } + } + } + } +} }); } + async #fetchQuote( url: URL, options: { @@ -20187,7 +22590,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[0]; if (!(v instanceof URL) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/044f#quote\\"); @@ -20255,7 +22659,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -20629,7 +23034,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/044f#quoteAuthorization\\"); @@ -20697,7 +23103,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -21124,7 +23531,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); let _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote__array = values[\\"https://w3id.org/fep/044f#quote\\"]; @@ -21204,7 +23611,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; const _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); let _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization__array = values[\\"https://w3id.org/fep/044f#quoteAuthorization\\"]; @@ -21379,22 +23786,22 @@ export class Activity extends Object { } #_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: Set = new Set(); + #_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: VocabTrustSet = new Set(); #_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; - #_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); + #_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: VocabTrustSet = new Set(); #_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: (Object | URL)[] = []; - #_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: Set = new Set(); + #_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: VocabTrustSet = new Set(); #_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: (Object | URL)[] = []; - #_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: Set = new Set(); + #_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: VocabTrustSet = new Set(); #_25zu2s3VxVujgEKqrDycjE284XQR_origin: (Object | URL)[] = []; - #_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: Set = new Set(); + #_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: VocabTrustSet = new Set(); #_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: (Object | URL)[] = []; - #_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: Set = new Set(); + #_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: VocabTrustSet = new Set(); /** * Constructs a new instance of Activity with the given values. @@ -21460,14 +23867,36 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.actors) && - values.actors.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.actors)) { + const array = values.actors; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.actors; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = values.actors.slice(); + this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = copied; - for (let i = 0; i < values.actors.length; i++) { - this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); - } + vocabSetTrustPrefix(this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor, this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length); } else { throw new TypeError( @@ -21500,14 +23929,36 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.objects) && - values.objects.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.objects)) { + const array = values.objects; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.objects; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects.slice(); + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = copied; - for (let i = 0; i < values.objects.length; i++) { - this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); - } + vocabSetTrustPrefix(this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length); } else { throw new TypeError( @@ -21540,14 +23991,36 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.targets) && - values.targets.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.targets)) { + const array = values.targets; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.targets; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = values.targets.slice(); + this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = copied; - for (let i = 0; i < values.targets.length; i++) { - this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); - } + vocabSetTrustPrefix(this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target, this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length); } else { throw new TypeError( @@ -21580,14 +24053,36 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.results) && - values.results.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.results)) { + const array = values.results; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.results; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = values.results.slice(); + this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = copied; - for (let i = 0; i < values.results.length; i++) { - this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); - } + vocabSetTrustPrefix(this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result, this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length); } else { throw new TypeError( @@ -21620,14 +24115,36 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.origins) && - values.origins.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.origins)) { + const array = values.origins; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.origins; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = values.origins.slice(); + this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = copied; - for (let i = 0; i < values.origins.length; i++) { - this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); - } + vocabSetTrustPrefix(this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin, this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length); } else { throw new TypeError( @@ -21660,14 +24177,36 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.instruments) && - values.instruments.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.instruments)) { + const array = values.instruments; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.instruments; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = values.instruments.slice(); + this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = copied; - for (let i = 0; i < values.instruments.length; i++) { - this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); - } + vocabSetTrustPrefix(this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument, this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length); } else { throw new TypeError( @@ -21689,8 +24228,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Activity.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -21748,12 +24287,16 @@ instruments?: (Object | URL)[];} // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Activity;clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.slice();clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set(this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor); + const clone = super.clone(values, options) as unknown as Activity;clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length < vocabSparseArrayMinimumLength + ? this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.slice() : vocabCopyPropertyArray(this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor);clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = vocabCopyTrustSet( + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor, clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor, + ); if (\\"actor\\" in values && values.actor != null) { if (values.actor instanceof Application || values.actor instanceof Group || values.actor instanceof Organization || values.actor instanceof Person || values.actor instanceof Service || values.actor instanceof URL) { // @ts-ignore: type is checked above. clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = [values.actor]; - clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set([0]); + clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set(); + clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The actor must be of type \\" + @@ -21772,15 +24315,37 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.actors) && - values.actors.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.actors)) { + const array = values.actors; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.actors; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = values.actors.slice(); + clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = copied; clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set(); - for (let i = 0; i < values.actors.length; i++) { - clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor, clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length); } else { throw new TypeError( @@ -21789,12 +24354,16 @@ instruments?: (Object | URL)[];} ); } } - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.slice();clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object); + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length < vocabSparseArrayMinimumLength + ? this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.slice() : vocabCopyPropertyArray(this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object);clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = vocabCopyTrustSet( + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, + ); if (\\"object\\" in values && values.object != null) { if (values.object instanceof Object || values.object instanceof URL) { // @ts-ignore: type is checked above. clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = [values.object]; - clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set([0]); + clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(); + clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The object must be of type \\" + @@ -21813,15 +24382,37 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.objects) && - values.objects.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.objects)) { + const array = values.objects; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.objects; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects.slice(); + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = copied; clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(); - for (let i = 0; i < values.objects.length; i++) { - clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length); } else { throw new TypeError( @@ -21830,12 +24421,16 @@ instruments?: (Object | URL)[];} ); } } - clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.slice();clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set(this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target); + clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length < vocabSparseArrayMinimumLength + ? this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.slice() : vocabCopyPropertyArray(this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target);clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = vocabCopyTrustSet( + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target, clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target, + ); if (\\"target\\" in values && values.target != null) { if (values.target instanceof Object || values.target instanceof URL) { // @ts-ignore: type is checked above. clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = [values.target]; - clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set([0]); + clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set(); + clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The target must be of type \\" + @@ -21854,15 +24449,37 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.targets) && - values.targets.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.targets)) { + const array = values.targets; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.targets; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = values.targets.slice(); + clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = copied; clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set(); - for (let i = 0; i < values.targets.length; i++) { - clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target, clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length); } else { throw new TypeError( @@ -21871,12 +24488,16 @@ instruments?: (Object | URL)[];} ); } } - clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.slice();clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set(this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result); + clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length < vocabSparseArrayMinimumLength + ? this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.slice() : vocabCopyPropertyArray(this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result);clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = vocabCopyTrustSet( + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result, clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result, + ); if (\\"result\\" in values && values.result != null) { if (values.result instanceof Object || values.result instanceof URL) { // @ts-ignore: type is checked above. clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = [values.result]; - clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set([0]); + clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set(); + clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The result must be of type \\" + @@ -21895,15 +24516,37 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.results) && - values.results.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.results)) { + const array = values.results; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.results; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = values.results.slice(); + clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = copied; clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set(); - for (let i = 0; i < values.results.length; i++) { - clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); - } + vocabSetTrustPrefix(clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result, clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length); } else { throw new TypeError( @@ -21912,12 +24555,16 @@ instruments?: (Object | URL)[];} ); } } - clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.slice();clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set(this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin); + clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length < vocabSparseArrayMinimumLength + ? this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.slice() : vocabCopyPropertyArray(this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin);clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = vocabCopyTrustSet( + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin, clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin, + ); if (\\"origin\\" in values && values.origin != null) { if (values.origin instanceof Object || values.origin instanceof URL) { // @ts-ignore: type is checked above. clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = [values.origin]; - clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set([0]); + clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set(); + clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The origin must be of type \\" + @@ -21936,15 +24583,37 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.origins) && - values.origins.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.origins)) { + const array = values.origins; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.origins; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = values.origins.slice(); + clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = copied; clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set(); - for (let i = 0; i < values.origins.length; i++) { - clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); - } + vocabSetTrustPrefix(clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin, clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length); } else { throw new TypeError( @@ -21953,12 +24622,16 @@ instruments?: (Object | URL)[];} ); } } - clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.slice();clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set(this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument); + clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length < vocabSparseArrayMinimumLength + ? this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.slice() : vocabCopyPropertyArray(this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument);clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = vocabCopyTrustSet( + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument, clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument, + ); if (\\"instrument\\" in values && values.instrument != null) { if (values.instrument instanceof Object || values.instrument instanceof URL) { // @ts-ignore: type is checked above. clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = [values.instrument]; - clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set([0]); + clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set(); + clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The instrument must be of type \\" + @@ -21977,15 +24650,37 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.instruments) && - values.instruments.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.instruments)) { + const array = values.instruments; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.instruments; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = values.instruments.slice(); + clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = copied; clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set(); - for (let i = 0; i < values.instruments.length; i++) { - clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument, clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length); } else { throw new TypeError( @@ -21997,7 +24692,223 @@ instruments?: (Object | URL)[];} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Activity { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Activity; + + { + const array = node.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length; i++) { + const value = node.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length; i++) { + const value = node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length; i++) { + const value = node.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[i] = context.value(value); + } + } + } + } + + { + const array = node.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length; i++) { + const value = node.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[i]; + if (value != null && typeof value === \\"object\\") { + node.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[i] = context.value(value); + } + } + } + } + + { + const array = node.#_25zu2s3VxVujgEKqrDycjE284XQR_origin; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length; i++) { + const value = node.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[i]; + if (value != null && typeof value === \\"object\\") { + node.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length; i++) { + const value = node.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[i] = context.value(value); + } + } + } + } +} }); } + async #fetchActor( url: URL, options: { @@ -22386,7 +25297,8 @@ instruments?: (Object | URL)[];} } let v = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0]; if (!(v instanceof URL) && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { + !(0 < (this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[vocabTrustPrefix] ?? 0) || + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#actor\\"); @@ -22454,7 +25366,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { + !(0 < (this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[vocabTrustPrefix] ?? 0) || + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -22544,7 +25457,8 @@ instruments?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(i)) { + !(i < (this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[vocabTrustPrefix] ?? 0) || + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#actor\\"); @@ -22616,7 +25530,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(i)) { + !(i < (this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[vocabTrustPrefix] ?? 0) || + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -22969,7 +25884,8 @@ instruments?: (Object | URL)[];} } let v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; if (!(v instanceof URL) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { + !(0 < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#object\\"); @@ -23037,7 +25953,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { + !(0 < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -23127,7 +26044,8 @@ instruments?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i)) { + !(i < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#object\\"); @@ -23199,7 +26117,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i)) { + !(i < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -23555,7 +26474,8 @@ instruments?: (Object | URL)[];} } let v = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0]; if (!(v instanceof URL) && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { + !(0 < (this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[vocabTrustPrefix] ?? 0) || + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#target\\"); @@ -23623,7 +26543,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { + !(0 < (this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[vocabTrustPrefix] ?? 0) || + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -23716,7 +26637,8 @@ instruments?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(i)) { + !(i < (this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[vocabTrustPrefix] ?? 0) || + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#target\\"); @@ -23788,7 +26710,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(i)) { + !(i < (this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[vocabTrustPrefix] ?? 0) || + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -24141,7 +27064,8 @@ instruments?: (Object | URL)[];} } let v = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0]; if (!(v instanceof URL) && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { + !(0 < (this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[vocabTrustPrefix] ?? 0) || + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#result\\"); @@ -24209,7 +27133,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { + !(0 < (this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[vocabTrustPrefix] ?? 0) || + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -24299,7 +27224,8 @@ instruments?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(i)) { + !(i < (this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[vocabTrustPrefix] ?? 0) || + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#result\\"); @@ -24371,7 +27297,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(i)) { + !(i < (this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[vocabTrustPrefix] ?? 0) || + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -24725,7 +27652,8 @@ instruments?: (Object | URL)[];} } let v = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0]; if (!(v instanceof URL) && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { + !(0 < (this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin[vocabTrustPrefix] ?? 0) || + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#origin\\"); @@ -24793,7 +27721,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { + !(0 < (this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin[vocabTrustPrefix] ?? 0) || + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -24884,7 +27813,8 @@ instruments?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(i)) { + !(i < (this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin[vocabTrustPrefix] ?? 0) || + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#origin\\"); @@ -24956,7 +27886,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(i)) { + !(i < (this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin[vocabTrustPrefix] ?? 0) || + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -25308,7 +28239,8 @@ instruments?: (Object | URL)[];} } let v = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0]; if (!(v instanceof URL) && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { + !(0 < (this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[vocabTrustPrefix] ?? 0) || + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#instrument\\"); @@ -25376,7 +28308,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { + !(0 < (this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[vocabTrustPrefix] ?? 0) || + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -25465,7 +28398,8 @@ instruments?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(i)) { + !(i < (this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[vocabTrustPrefix] ?? 0) || + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#instrument\\"); @@ -25537,7 +28471,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(i)) { + !(i < (this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[vocabTrustPrefix] ?? 0) || + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -26076,7 +29011,7 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: Set = new Set(); + const _trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: VocabTrustSet = new Set(); let _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array = values[\\"https://www.w3.org/ns/activitystreams#actor\\"]; @@ -26134,7 +29069,7 @@ instruments?: (Object | URL)[];} instance.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; const _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; - const _trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); + const _trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: VocabTrustSet = new Set(); let _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array = values[\\"https://www.w3.org/ns/activitystreams#object\\"]; @@ -26175,7 +29110,7 @@ instruments?: (Object | URL)[];} instance.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; const _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: (Object | URL)[] = []; - const _trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: Set = new Set(); + const _trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: VocabTrustSet = new Set(); let _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array = values[\\"https://www.w3.org/ns/activitystreams#target\\"]; @@ -26216,7 +29151,7 @@ instruments?: (Object | URL)[];} instance.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; const _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: (Object | URL)[] = []; - const _trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: Set = new Set(); + const _trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: VocabTrustSet = new Set(); let _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array = values[\\"https://www.w3.org/ns/activitystreams#result\\"]; @@ -26257,7 +29192,7 @@ instruments?: (Object | URL)[];} instance.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; const _25zu2s3VxVujgEKqrDycjE284XQR_origin: (Object | URL)[] = []; - const _trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: Set = new Set(); + const _trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: VocabTrustSet = new Set(); let _25zu2s3VxVujgEKqrDycjE284XQR_origin__array = values[\\"https://www.w3.org/ns/activitystreams#origin\\"]; @@ -26298,7 +29233,7 @@ instruments?: (Object | URL)[];} instance.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = _25zu2s3VxVujgEKqrDycjE284XQR_origin; const _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: (Object | URL)[] = []; - const _trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: Set = new Set(); + const _trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: VocabTrustSet = new Set(); let _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array = values[\\"https://www.w3.org/ns/activitystreams#instrument\\"]; @@ -26617,8 +29552,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link EmojiReact.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -26679,7 +29614,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as EmojiReact; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): EmojiReact { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -27149,8 +30160,8 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link PropertyValue.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -27193,7 +30204,8 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} options ); copyPortableProvenance(this, clone); - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.slice(); + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length < vocabSparseArrayMinimumLength + ? this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.slice() : vocabCopyPropertyArray(this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name); if (\\"name\\" in values && values.name != null) { if (typeof values.name === \\"string\\" || values.name instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -27206,7 +30218,8 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} ); } } - clone.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.slice(); + clone.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length < vocabSparseArrayMinimumLength + ? this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.slice() : vocabCopyPropertyArray(this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value); if (\\"value\\" in values && values.value != null) { if (typeof values.value === \\"string\\" || values.value instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -27222,7 +30235,79 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +name?: string | LanguageString | null;value?: string | LanguageString | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): PropertyValue { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as PropertyValue; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as PropertyValue; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); +} }); } + /** The name of a property. */ get name(): (string | LanguageString | null) { @@ -27921,8 +31006,8 @@ unit?: string | null;numericalValue?: Decimal | null;} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Measure.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -27965,7 +31050,8 @@ unit?: string | null;numericalValue?: Decimal | null;} options ); copyPortableProvenance(this, clone); - clone.#_27fgyFbosTtMAhuepJH8K3ZGURT6 = this.#_27fgyFbosTtMAhuepJH8K3ZGURT6.slice(); + clone.#_27fgyFbosTtMAhuepJH8K3ZGURT6 = this.#_27fgyFbosTtMAhuepJH8K3ZGURT6.length < vocabSparseArrayMinimumLength + ? this.#_27fgyFbosTtMAhuepJH8K3ZGURT6.slice() : vocabCopyPropertyArray(this.#_27fgyFbosTtMAhuepJH8K3ZGURT6); if (\\"unit\\" in values && values.unit != null) { if (typeof values.unit === \\"string\\") { // @ts-ignore: type is checked above. @@ -27978,7 +31064,8 @@ unit?: string | null;numericalValue?: Decimal | null;} ); } } - clone.#_1GQx8o2RgxRs4x9G5uT39XYBv7D = this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D.slice(); + clone.#_1GQx8o2RgxRs4x9G5uT39XYBv7D = this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D.length < vocabSparseArrayMinimumLength + ? this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D.slice() : vocabCopyPropertyArray(this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D); if (\\"numericalValue\\" in values && values.numericalValue != null) { if (typeof values.numericalValue === \\"string\\" && isDecimal(values.numericalValue)) { // @ts-ignore: type is checked above. @@ -27994,7 +31081,79 @@ unit?: string | null;numericalValue?: Decimal | null;} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +unit?: string | null;numericalValue?: Decimal | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Measure { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Measure; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Measure; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); +} }); } + /** The name of the unit, according to the Ontology of units of Measure * classification. The recommended unit for countable items is \`\\"one\\"\`. * @@ -28533,10 +31692,10 @@ export class AnnounceAuthorization extends Object { } #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); /** * Constructs a new instance of AnnounceAuthorization with the given values. @@ -28611,8 +31770,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link AnnounceAuthorization.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -28664,12 +31823,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as AnnounceAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice();clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + const clone = super.clone(values, options) as unknown as AnnounceAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < vocabSparseArrayMinimumLength + ? this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice() : vocabCopyPropertyArray(this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject);clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = vocabCopyTrustSet( + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, + ); if (\\"interactingObject\\" in values && values.interactingObject != null) { if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { // @ts-ignore: type is checked above. clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; - clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The interactingObject must be of type \\" + @@ -28677,12 +31840,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice();clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < vocabSparseArrayMinimumLength + ? this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice() : vocabCopyPropertyArray(this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget);clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = vocabCopyTrustSet( + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, + ); if (\\"interactionTarget\\" in values && values.interactionTarget != null) { if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { // @ts-ignore: type is checked above. clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; - clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The interactionTarget must be of type \\" + @@ -28693,7 +31860,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): AnnounceAuthorization { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as AnnounceAuthorization; + + { + const array = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length; i++) { + const value = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length; i++) { + const value = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i] = context.value(value); + } + } + } + } +} }); } + async #fetchInteractingObject( url: URL, options: { @@ -29021,7 +32310,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; if (!(v instanceof URL) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#interactingObject\\"); @@ -29089,7 +32379,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -29439,7 +32730,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; if (!(v instanceof URL) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#interactionTarget\\"); @@ -29507,7 +32799,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -29884,7 +33177,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values[\\"https://gotosocial.org/ns#interactingObject\\"]; @@ -29925,7 +33218,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values[\\"https://gotosocial.org/ns#interactionTarget\\"]; @@ -30138,8 +33431,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link AnnounceRequest.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -30200,7 +33493,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as AnnounceRequest; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): AnnounceRequest { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -30719,8 +34088,8 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link InteractionPolicy.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -30763,7 +34132,8 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: options ); copyPortableProvenance(this, clone); - clone.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature = this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature.slice(); + clone.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature = this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature.length < vocabSparseArrayMinimumLength + ? this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature.slice() : vocabCopyPropertyArray(this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature); if (\\"canFeature\\" in values && values.canFeature != null) { if (values.canFeature instanceof InteractionRule) { // @ts-ignore: type is checked above. @@ -30776,7 +34146,8 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: ); } } - clone.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike = this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.slice(); + clone.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike = this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.length < vocabSparseArrayMinimumLength + ? this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.slice() : vocabCopyPropertyArray(this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike); if (\\"canLike\\" in values && values.canLike != null) { if (values.canLike instanceof InteractionRule) { // @ts-ignore: type is checked above. @@ -30789,7 +34160,8 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: ); } } - clone.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply = this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.slice(); + clone.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply = this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.length < vocabSparseArrayMinimumLength + ? this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.slice() : vocabCopyPropertyArray(this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply); if (\\"canReply\\" in values && values.canReply != null) { if (values.canReply instanceof InteractionRule) { // @ts-ignore: type is checked above. @@ -30802,7 +34174,8 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: ); } } - clone.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce = this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.slice(); + clone.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce = this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.length < vocabSparseArrayMinimumLength + ? this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.slice() : vocabCopyPropertyArray(this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce); if (\\"canAnnounce\\" in values && values.canAnnounce != null) { if (values.canAnnounce instanceof InteractionRule) { // @ts-ignore: type is checked above. @@ -30815,7 +34188,8 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: ); } } - clone.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote = this.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote.slice(); + clone.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote = this.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote.length < vocabSparseArrayMinimumLength + ? this.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote.slice() : vocabCopyPropertyArray(this.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote); if (\\"canQuote\\" in values && values.canQuote != null) { if (values.canQuote instanceof InteractionRule) { // @ts-ignore: type is checked above. @@ -30831,7 +34205,189 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: InteractionRule | null;canQuote?: InteractionRule | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): InteractionPolicy { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as InteractionPolicy; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as InteractionPolicy; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature.length; i++) { + const value = node.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.length; i++) { + const value = node.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.length; i++) { + const value = node.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply[i] = context.value(value); + } + } + } + } + + { + const array = node.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.length; i++) { + const value = node.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce[i]; + if (value != null && typeof value === \\"object\\") { + node.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce[i] = context.value(value); + } + } + } + } + + { + const array = node.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote.length; i++) { + const value = node.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote[i]; + if (value != null && typeof value === \\"object\\") { + node.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote[i] = context.value(value); + } + } + } + } +} }); } + /** The sub-policy specifying who can feature the actor in a * {@link FeaturedCollection}. * @@ -31766,10 +35322,34 @@ manualApprovals?: (URL)[];} ); } - if (Array.isArray(values.automaticApprovals) && - values.automaticApprovals.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.automaticApprovals)) { + const array = values.automaticApprovals; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.automaticApprovals; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = values.automaticApprovals.slice(); + this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = copied; } else { throw new TypeError( @@ -31802,10 +35382,34 @@ manualApprovals?: (URL)[];} ); } - if (Array.isArray(values.manualApprovals) && - values.manualApprovals.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.manualApprovals)) { + const array = values.manualApprovals; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.manualApprovals; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = values.manualApprovals.slice(); + this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = copied; } else { throw new TypeError( @@ -31827,8 +35431,8 @@ manualApprovals?: (URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link InteractionRule.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -31873,7 +35477,8 @@ manualApprovals?: (URL)[];} options ); copyPortableProvenance(this, clone); - clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.slice(); + clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.length < vocabSparseArrayMinimumLength + ? this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.slice() : vocabCopyPropertyArray(this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval); if (\\"automaticApproval\\" in values && values.automaticApproval != null) { if (values.automaticApproval instanceof URL) { // @ts-ignore: type is checked above. @@ -31897,10 +35502,34 @@ manualApprovals?: (URL)[];} ); } - if (Array.isArray(values.automaticApprovals) && - values.automaticApprovals.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.automaticApprovals)) { + const array = values.automaticApprovals; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.automaticApprovals; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = values.automaticApprovals.slice(); + clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = copied; } else { throw new TypeError( @@ -31909,7 +35538,8 @@ manualApprovals?: (URL)[];} ); } } - clone.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.slice(); + clone.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.length < vocabSparseArrayMinimumLength + ? this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.slice() : vocabCopyPropertyArray(this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval); if (\\"manualApproval\\" in values && values.manualApproval != null) { if (values.manualApproval instanceof URL) { // @ts-ignore: type is checked above. @@ -31933,10 +35563,34 @@ manualApprovals?: (URL)[];} ); } - if (Array.isArray(values.manualApprovals) && - values.manualApprovals.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.manualApprovals)) { + const array = values.manualApprovals; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.manualApprovals; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = values.manualApprovals.slice(); + clone.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = copied; } else { throw new TypeError( @@ -31948,7 +35602,125 @@ manualApprovals?: (URL)[];} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +automaticApproval?: URL | null; +automaticApprovals?: (URL)[];manualApproval?: URL | null; +manualApprovals?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): InteractionRule { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as InteractionRule; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as InteractionRule; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.length; i++) { + const value = node.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval[i] = context.value(value); + } + } + } + } + + { + const array = node.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.length; i++) { + const value = node.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval[i]; + if (value != null && typeof value === \\"object\\") { + node.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval[i] = context.value(value); + } + } + } + } +} }); } + /** URIs of actors or collections whose interactions are automatically * approved without requiring manual review by the post author. * @@ -32468,10 +36240,10 @@ export class LikeAuthorization extends Object { } #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); /** * Constructs a new instance of LikeAuthorization with the given values. @@ -32546,8 +36318,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link LikeAuthorization.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -32599,12 +36371,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as LikeAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice();clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + const clone = super.clone(values, options) as unknown as LikeAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < vocabSparseArrayMinimumLength + ? this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice() : vocabCopyPropertyArray(this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject);clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = vocabCopyTrustSet( + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, + ); if (\\"interactingObject\\" in values && values.interactingObject != null) { if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { // @ts-ignore: type is checked above. clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; - clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The interactingObject must be of type \\" + @@ -32612,12 +36388,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice();clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < vocabSparseArrayMinimumLength + ? this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice() : vocabCopyPropertyArray(this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget);clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = vocabCopyTrustSet( + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, + ); if (\\"interactionTarget\\" in values && values.interactionTarget != null) { if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { // @ts-ignore: type is checked above. clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; - clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The interactionTarget must be of type \\" + @@ -32628,7 +36408,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): LikeAuthorization { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as LikeAuthorization; + + { + const array = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length; i++) { + const value = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length; i++) { + const value = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i] = context.value(value); + } + } + } + } +} }); } + async #fetchInteractingObject( url: URL, options: { @@ -32956,7 +36858,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; if (!(v instanceof URL) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#interactingObject\\"); @@ -33024,7 +36927,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -33374,7 +37278,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; if (!(v instanceof URL) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#interactionTarget\\"); @@ -33442,7 +37347,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -33819,7 +37725,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values[\\"https://gotosocial.org/ns#interactingObject\\"]; @@ -33860,7 +37766,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values[\\"https://gotosocial.org/ns#interactionTarget\\"]; @@ -34072,8 +37978,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link LikeRequest.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -34134,7 +38040,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as LikeRequest; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): LikeRequest { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -34466,10 +38448,10 @@ export class ReplyAuthorization extends Object { } #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); /** * Constructs a new instance of ReplyAuthorization with the given values. @@ -34544,8 +38526,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link ReplyAuthorization.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -34597,12 +38579,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as ReplyAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice();clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + const clone = super.clone(values, options) as unknown as ReplyAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < vocabSparseArrayMinimumLength + ? this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice() : vocabCopyPropertyArray(this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject);clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = vocabCopyTrustSet( + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, + ); if (\\"interactingObject\\" in values && values.interactingObject != null) { if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { // @ts-ignore: type is checked above. clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; - clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The interactingObject must be of type \\" + @@ -34610,12 +38596,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice();clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < vocabSparseArrayMinimumLength + ? this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice() : vocabCopyPropertyArray(this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget);clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = vocabCopyTrustSet( + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, + ); if (\\"interactionTarget\\" in values && values.interactionTarget != null) { if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { // @ts-ignore: type is checked above. clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; - clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The interactionTarget must be of type \\" + @@ -34626,7 +38616,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): ReplyAuthorization { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as ReplyAuthorization; + + { + const array = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length; i++) { + const value = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length; i++) { + const value = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i] = context.value(value); + } + } + } + } +} }); } + async #fetchInteractingObject( url: URL, options: { @@ -34954,7 +39066,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; if (!(v instanceof URL) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#interactingObject\\"); @@ -35022,7 +39135,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -35372,7 +39486,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; if (!(v instanceof URL) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#interactionTarget\\"); @@ -35440,7 +39555,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -35817,7 +39933,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values[\\"https://gotosocial.org/ns#interactingObject\\"]; @@ -35858,7 +39974,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values[\\"https://gotosocial.org/ns#interactionTarget\\"]; @@ -36070,8 +40186,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link ReplyRequest.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -36132,7 +40248,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as ReplyRequest; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): ReplyRequest { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -36464,10 +40656,10 @@ export class QuoteAuthorization extends Object { } #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); /** * Constructs a new instance of QuoteAuthorization with the given values. @@ -36542,8 +40734,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link QuoteAuthorization.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -36595,12 +40787,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as QuoteAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice();clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + const clone = super.clone(values, options) as unknown as QuoteAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < vocabSparseArrayMinimumLength + ? this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice() : vocabCopyPropertyArray(this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject);clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = vocabCopyTrustSet( + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, + ); if (\\"interactingObject\\" in values && values.interactingObject != null) { if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { // @ts-ignore: type is checked above. clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; - clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The interactingObject must be of type \\" + @@ -36608,12 +40804,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice();clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < vocabSparseArrayMinimumLength + ? this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice() : vocabCopyPropertyArray(this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget);clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = vocabCopyTrustSet( + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, + ); if (\\"interactionTarget\\" in values && values.interactionTarget != null) { if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { // @ts-ignore: type is checked above. clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; - clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The interactionTarget must be of type \\" + @@ -36624,7 +40824,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): QuoteAuthorization { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as QuoteAuthorization; + + { + const array = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length; i++) { + const value = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length; i++) { + const value = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i] = context.value(value); + } + } + } + } +} }); } + async #fetchInteractingObject( url: URL, options: { @@ -36951,7 +41273,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; if (!(v instanceof URL) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#interactingObject\\"); @@ -37019,7 +41342,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -37369,7 +41693,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; if (!(v instanceof URL) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#interactionTarget\\"); @@ -37437,7 +41762,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -37814,7 +42140,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values[\\"https://gotosocial.org/ns#interactingObject\\"]; @@ -37855,7 +42181,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values[\\"https://gotosocial.org/ns#interactionTarget\\"]; @@ -38067,8 +42393,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link QuoteRequest.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -38129,7 +42455,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as QuoteRequest; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): QuoteRequest { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -38530,7 +42932,7 @@ export class Translation { #_diXuPmFWiEqfLPhhrxg6Xc7ixZG: (Intl.Locale)[] = []; #_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR: Set = new Set(); + #_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR: VocabTrustSet = new Set(); #_Msz9PwRg7cWkiXPL4ixyQLtuuH7: (URL)[] = []; #_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated: (Temporal.Instant)[] = []; #_4KvkQNz1JjGs8S7iJDcGrUYETbUW: (URL)[] = []; @@ -38612,14 +43014,36 @@ urls?: ((URL | Link))[];} ); } - if (Array.isArray(values.translators) && - values.translators.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.translators)) { + const array = values.translators; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.translators; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = values.translators.slice(); + this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = copied; - for (let i = 0; i < values.translators.length; i++) { - this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.add(i); - } + vocabSetTrustPrefix(this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR, this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length); } else { throw new TypeError( @@ -38691,10 +43115,34 @@ urls?: ((URL | Link))[];} ); } - if (Array.isArray(values.urls) && - values.urls.every(v => v instanceof URL || v instanceof Link)) { + let copied!: (URL | Link)[]; + let valid = false; + if (Array.isArray(values.urls)) { + const array = values.urls; + const test = (v: URL | Link): boolean => v instanceof URL || v instanceof Link; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.urls; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls.slice(); + this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = copied; } else { throw new TypeError( @@ -38716,8 +43164,8 @@ urls?: ((URL | Link))[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Translation.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -38762,7 +43210,8 @@ urls?: ((URL | Link))[];} options ); copyPortableProvenance(this, clone); - clone.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG.slice(); + clone.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG.length < vocabSparseArrayMinimumLength + ? this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG.slice() : vocabCopyPropertyArray(this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG); if (\\"language\\" in values && values.language != null) { if (values.language instanceof Intl.Locale) { // @ts-ignore: type is checked above. @@ -38775,12 +43224,16 @@ urls?: ((URL | Link))[];} ); } } - clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.slice();clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = new Set(this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR); + clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length < vocabSparseArrayMinimumLength + ? this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.slice() : vocabCopyPropertyArray(this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR);clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = vocabCopyTrustSet( + this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR, clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR, + ); if (\\"translator\\" in values && values.translator != null) { if (values.translator instanceof Application || values.translator instanceof Group || values.translator instanceof Organization || values.translator instanceof Person || values.translator instanceof Service || values.translator instanceof URL) { // @ts-ignore: type is checked above. clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = [values.translator]; - clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = new Set([0]); + clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = new Set(); + clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The translator must be of type \\" + @@ -38799,15 +43252,37 @@ urls?: ((URL | Link))[];} ); } - if (Array.isArray(values.translators) && - values.translators.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.translators)) { + const array = values.translators; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.translators; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = values.translators.slice(); + clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = copied; clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = new Set(); - for (let i = 0; i < values.translators.length; i++) { - clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.add(i); - } + vocabSetTrustPrefix(clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR, clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length); } else { throw new TypeError( @@ -38816,7 +43291,8 @@ urls?: ((URL | Link))[];} ); } } - clone.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7 = this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7.slice(); + clone.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7 = this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7.length < vocabSparseArrayMinimumLength + ? this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7.slice() : vocabCopyPropertyArray(this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7); if (\\"original\\" in values && values.original != null) { if (values.original instanceof URL) { // @ts-ignore: type is checked above. @@ -38829,7 +43305,8 @@ urls?: ((URL | Link))[];} ); } } - clone.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated.slice(); + clone.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated.length < vocabSparseArrayMinimumLength + ? this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated.slice() : vocabCopyPropertyArray(this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated); if (\\"sourceUpdated\\" in values && values.sourceUpdated != null) { if (isTemporalInstant(values.sourceUpdated)) { // @ts-ignore: type is checked above. @@ -38842,7 +43319,8 @@ urls?: ((URL | Link))[];} ); } } - clone.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW = this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW.slice(); + clone.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW = this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW.length < vocabSparseArrayMinimumLength + ? this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW.slice() : vocabCopyPropertyArray(this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW); if (\\"basis\\" in values && values.basis != null) { if (values.basis instanceof URL) { // @ts-ignore: type is checked above. @@ -38855,7 +43333,8 @@ urls?: ((URL | Link))[];} ); } } - clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.slice(); + clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length < vocabSparseArrayMinimumLength + ? this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.slice() : vocabCopyPropertyArray(this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url); if (\\"url\\" in values && values.url != null) { if (values.url instanceof URL || values.url instanceof Link) { // @ts-ignore: type is checked above. @@ -38879,10 +43358,34 @@ urls?: ((URL | Link))[];} ); } - if (Array.isArray(values.urls) && - values.urls.every(v => v instanceof URL || v instanceof Link)) { + let copied!: (URL | Link)[]; + let valid = false; + if (Array.isArray(values.urls)) { + const array = values.urls; + const test = (v: URL | Link): boolean => v instanceof URL || v instanceof Link; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.urls; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls.slice(); + clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = copied; } else { throw new TypeError( @@ -38894,7 +43397,169 @@ urls?: ((URL | Link))[];} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +language?: Intl.Locale | null;translator?: Application | Group | Organization | Person | Service | URL | null; +translators?: (Application | Group | Organization | Person | Service | URL)[];original?: URL | null;sourceUpdated?: Temporal.Instant | null;basis?: URL | null;url?: URL | Link | null; +urls?: ((URL | Link))[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Translation { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Translation; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Translation; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length; i++) { + const value = node.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[i]; + if (value != null && typeof value === \\"object\\") { + node.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[i] = context.value(value); + } + } + } + } + + { + const array = node.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7.length; i++) { + const value = node.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7[i]; + if (value != null && typeof value === \\"object\\") { + node.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW.length; i++) { + const value = node.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length; i++) { + const value = node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[i] = context.value(value); + } + } + } + } +} }); } + /** The translated language. Publishers must match a language in the * containing object's content, name, or summary map. * @@ -39301,7 +43966,8 @@ urls?: ((URL | Link))[];} } let v = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[0]; if (!(v instanceof URL) && - !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(0)) { + !(0 < (this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[vocabTrustPrefix] ?? 0) || + this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://schema.org/translator\\"); @@ -39369,7 +44035,8 @@ urls?: ((URL | Link))[];} mustDereferencePortableObject( this, null, v.id, options, )) && - !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(0)) { + !(0 < (this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[vocabTrustPrefix] ?? 0) || + this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -39462,7 +44129,8 @@ urls?: ((URL | Link))[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(i)) { + !(i < (this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[vocabTrustPrefix] ?? 0) || + this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://schema.org/translator\\"); @@ -39534,7 +44202,8 @@ urls?: ((URL | Link))[];} mustDereferencePortableObject( this, null, v.id, options, )) && - !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(i)) { + !(i < (this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[vocabTrustPrefix] ?? 0) || + this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -40146,7 +44815,7 @@ get urls(): ((URL | Link))[] { instance.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = _diXuPmFWiEqfLPhhrxg6Xc7ixZG; const _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR: Set = new Set(); + const _trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR: VocabTrustSet = new Set(); let _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR__array = values[\\"https://schema.org/translator\\"]; @@ -40551,10 +45220,10 @@ export class FeatureAuthorization extends Object { } #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); /** * Constructs a new instance of FeatureAuthorization with the given values. @@ -40629,8 +45298,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link FeatureAuthorization.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -40682,12 +45351,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as FeatureAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice();clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + const clone = super.clone(values, options) as unknown as FeatureAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < vocabSparseArrayMinimumLength + ? this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice() : vocabCopyPropertyArray(this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject);clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = vocabCopyTrustSet( + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, + ); if (\\"interactingObject\\" in values && values.interactingObject != null) { if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { // @ts-ignore: type is checked above. clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; - clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The interactingObject must be of type \\" + @@ -40695,12 +45368,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice();clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < vocabSparseArrayMinimumLength + ? this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice() : vocabCopyPropertyArray(this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget);clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = vocabCopyTrustSet( + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, + ); if (\\"interactionTarget\\" in values && values.interactionTarget != null) { if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { // @ts-ignore: type is checked above. clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; - clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The interactionTarget must be of type \\" + @@ -40711,7 +45388,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): FeatureAuthorization { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as FeatureAuthorization; + + { + const array = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length; i++) { + const value = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length; i++) { + const value = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i] = context.value(value); + } + } + } + } +} }); } + async #fetchInteractingObject( url: URL, options: { @@ -41037,7 +45836,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; if (!(v instanceof URL) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#interactingObject\\"); @@ -41105,7 +45905,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -41454,7 +46255,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; if (!(v instanceof URL) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#interactionTarget\\"); @@ -41522,7 +46324,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -41899,7 +46702,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values[\\"https://gotosocial.org/ns#interactingObject\\"]; @@ -41940,7 +46743,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values[\\"https://gotosocial.org/ns#interactionTarget\\"]; @@ -42149,8 +46952,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link FeatureRequest.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -42211,7 +47014,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as FeatureRequest; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): FeatureRequest { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -42541,40 +47420,40 @@ export class Collection extends Object { #_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems: (number)[] = []; #_3UyUdxnyn6cDn53QKrh4MBiearma_current: (CollectionPage | URL)[] = []; - #_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current: Set = new Set(); + #_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current: VocabTrustSet = new Set(); #_J52RqweMe6hhv7RnLJMC8BExTE5_first: (CollectionPage | URL)[] = []; - #_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first: Set = new Set(); + #_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first: VocabTrustSet = new Set(); #_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last: (CollectionPage | URL)[] = []; - #_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last: Set = new Set(); + #_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last: VocabTrustSet = new Set(); #_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: (Object | Link | URL)[] = []; - #_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: Set = new Set(); + #_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: VocabTrustSet = new Set(); #_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf: (Object | URL)[] = []; - #_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf: Set = new Set(); + #_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf: VocabTrustSet = new Set(); #_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf: (Object | URL)[] = []; - #_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf: Set = new Set(); + #_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf: VocabTrustSet = new Set(); #_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf: (Object | URL)[] = []; - #_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf: Set = new Set(); + #_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf: VocabTrustSet = new Set(); #_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf: (Object | URL)[] = []; - #_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf: Set = new Set(); + #_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf: VocabTrustSet = new Set(); #_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf: (Object | URL)[] = []; - #_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf: Set = new Set(); + #_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf: VocabTrustSet = new Set(); #_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf: (Object | URL)[] = []; - #_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf: Set = new Set(); + #_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf: VocabTrustSet = new Set(); #_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf: (Object | URL)[] = []; - #_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf: Set = new Set(); + #_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf: VocabTrustSet = new Set(); #_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf: (Object | URL)[] = []; - #_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf: Set = new Set(); + #_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf: VocabTrustSet = new Set(); /** * Constructs a new instance of Collection with the given values. @@ -42665,14 +47544,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu if (\\"items\\" in values && values.items != null) { - if (Array.isArray(values.items) && - values.items.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.items)) { + const array = values.items; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.items; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = values.items.slice(); + this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = copied; - for (let i = 0; i < values.items.length; i++) { - this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.add(i); - } + vocabSetTrustPrefix(this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length); } else { throw new TypeError( @@ -42798,8 +47699,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Collection.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -42851,7 +47752,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Collection;clone.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems = this.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems.slice(); + const clone = super.clone(values, options) as unknown as Collection;clone.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems = this.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems.length < vocabSparseArrayMinimumLength + ? this.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems.slice() : vocabCopyPropertyArray(this.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems); if (\\"totalItems\\" in values && values.totalItems != null) { if (typeof values.totalItems === \\"number\\" && Number.isInteger(values.totalItems) && values.totalItems >= 0) { // @ts-ignore: type is checked above. @@ -42864,12 +47766,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3UyUdxnyn6cDn53QKrh4MBiearma_current = this.#_3UyUdxnyn6cDn53QKrh4MBiearma_current.slice();clone.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current = new Set(this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current); + clone.#_3UyUdxnyn6cDn53QKrh4MBiearma_current = this.#_3UyUdxnyn6cDn53QKrh4MBiearma_current.length < vocabSparseArrayMinimumLength + ? this.#_3UyUdxnyn6cDn53QKrh4MBiearma_current.slice() : vocabCopyPropertyArray(this.#_3UyUdxnyn6cDn53QKrh4MBiearma_current);clone.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current = vocabCopyTrustSet( + this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current, clone.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current, + ); if (\\"current\\" in values && values.current != null) { if (values.current instanceof CollectionPage || values.current instanceof URL) { // @ts-ignore: type is checked above. clone.#_3UyUdxnyn6cDn53QKrh4MBiearma_current = [values.current]; - clone.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current = new Set([0]); + clone.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current = new Set(); + clone.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The current must be of type \\" + @@ -42877,12 +47783,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_J52RqweMe6hhv7RnLJMC8BExTE5_first = this.#_J52RqweMe6hhv7RnLJMC8BExTE5_first.slice();clone.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first = new Set(this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first); + clone.#_J52RqweMe6hhv7RnLJMC8BExTE5_first = this.#_J52RqweMe6hhv7RnLJMC8BExTE5_first.length < vocabSparseArrayMinimumLength + ? this.#_J52RqweMe6hhv7RnLJMC8BExTE5_first.slice() : vocabCopyPropertyArray(this.#_J52RqweMe6hhv7RnLJMC8BExTE5_first);clone.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first = vocabCopyTrustSet( + this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first, clone.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first, + ); if (\\"first\\" in values && values.first != null) { if (values.first instanceof CollectionPage || values.first instanceof URL) { // @ts-ignore: type is checked above. clone.#_J52RqweMe6hhv7RnLJMC8BExTE5_first = [values.first]; - clone.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first = new Set([0]); + clone.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first = new Set(); + clone.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The first must be of type \\" + @@ -42890,12 +47800,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.slice();clone.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = new Set(this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last); + clone.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.length < vocabSparseArrayMinimumLength + ? this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.slice() : vocabCopyPropertyArray(this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last);clone.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = vocabCopyTrustSet( + this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last, clone.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last, + ); if (\\"last\\" in values && values.last != null) { if (values.last instanceof CollectionPage || values.last instanceof URL) { // @ts-ignore: type is checked above. clone.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = [values.last]; - clone.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = new Set([0]); + clone.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = new Set(); + clone.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The last must be of type \\" + @@ -42903,18 +47817,43 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.slice();clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = new Set(this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items); + clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length < vocabSparseArrayMinimumLength + ? this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.slice() : vocabCopyPropertyArray(this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items);clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = vocabCopyTrustSet( + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, + ); if (\\"items\\" in values && values.items != null) { - if (Array.isArray(values.items) && - values.items.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.items)) { + const array = values.items; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.items; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = values.items.slice(); + clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = copied; clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = new Set(); - for (let i = 0; i < values.items.length; i++) { - clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length); } else { throw new TypeError( @@ -42923,12 +47862,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = this.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.slice();clone.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = new Set(this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf); + clone.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = this.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.length < vocabSparseArrayMinimumLength + ? this.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.slice() : vocabCopyPropertyArray(this.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf);clone.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = vocabCopyTrustSet( + this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf, clone.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf, + ); if (\\"likesOf\\" in values && values.likesOf != null) { if (values.likesOf instanceof Object || values.likesOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = [values.likesOf]; - clone.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = new Set([0]); + clone.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = new Set(); + clone.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The likesOf must be of type \\" + @@ -42936,12 +47879,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = this.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.slice();clone.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = new Set(this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf); + clone.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = this.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.length < vocabSparseArrayMinimumLength + ? this.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.slice() : vocabCopyPropertyArray(this.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf);clone.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = vocabCopyTrustSet( + this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf, clone.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf, + ); if (\\"sharesOf\\" in values && values.sharesOf != null) { if (values.sharesOf instanceof Object || values.sharesOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = [values.sharesOf]; - clone.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = new Set([0]); + clone.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = new Set(); + clone.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The sharesOf must be of type \\" + @@ -42949,12 +47896,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = this.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.slice();clone.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = new Set(this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf); + clone.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = this.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.length < vocabSparseArrayMinimumLength + ? this.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.slice() : vocabCopyPropertyArray(this.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf);clone.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = vocabCopyTrustSet( + this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf, clone.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf, + ); if (\\"repliesOf\\" in values && values.repliesOf != null) { if (values.repliesOf instanceof Object || values.repliesOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = [values.repliesOf]; - clone.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = new Set([0]); + clone.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = new Set(); + clone.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The repliesOf must be of type \\" + @@ -42962,12 +47913,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = this.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.slice();clone.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = new Set(this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf); + clone.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = this.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.length < vocabSparseArrayMinimumLength + ? this.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.slice() : vocabCopyPropertyArray(this.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf);clone.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = vocabCopyTrustSet( + this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf, clone.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf, + ); if (\\"inboxOf\\" in values && values.inboxOf != null) { if (values.inboxOf instanceof Object || values.inboxOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = [values.inboxOf]; - clone.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = new Set([0]); + clone.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = new Set(); + clone.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The inboxOf must be of type \\" + @@ -42975,12 +47930,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = this.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.slice();clone.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = new Set(this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf); + clone.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = this.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.length < vocabSparseArrayMinimumLength + ? this.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.slice() : vocabCopyPropertyArray(this.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf);clone.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = vocabCopyTrustSet( + this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf, clone.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf, + ); if (\\"outboxOf\\" in values && values.outboxOf != null) { if (values.outboxOf instanceof Object || values.outboxOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = [values.outboxOf]; - clone.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = new Set([0]); + clone.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = new Set(); + clone.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The outboxOf must be of type \\" + @@ -42988,12 +47947,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = this.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.slice();clone.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = new Set(this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf); + clone.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = this.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.length < vocabSparseArrayMinimumLength + ? this.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.slice() : vocabCopyPropertyArray(this.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf);clone.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = vocabCopyTrustSet( + this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf, clone.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf, + ); if (\\"followersOf\\" in values && values.followersOf != null) { if (values.followersOf instanceof Object || values.followersOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = [values.followersOf]; - clone.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = new Set([0]); + clone.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = new Set(); + clone.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The followersOf must be of type \\" + @@ -43001,12 +47964,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = this.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.slice();clone.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = new Set(this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf); + clone.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = this.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.length < vocabSparseArrayMinimumLength + ? this.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.slice() : vocabCopyPropertyArray(this.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf);clone.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = vocabCopyTrustSet( + this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf, clone.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf, + ); if (\\"followingOf\\" in values && values.followingOf != null) { if (values.followingOf instanceof Object || values.followingOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = [values.followingOf]; - clone.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = new Set([0]); + clone.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = new Set(); + clone.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The followingOf must be of type \\" + @@ -43014,12 +47981,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = this.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.slice();clone.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = new Set(this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf); + clone.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = this.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.length < vocabSparseArrayMinimumLength + ? this.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.slice() : vocabCopyPropertyArray(this.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf);clone.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = vocabCopyTrustSet( + this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf, clone.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf, + ); if (\\"likedOf\\" in values && values.likedOf != null) { if (values.likedOf instanceof Object || values.likedOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = [values.likedOf]; - clone.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = new Set([0]); + clone.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = new Set(); + clone.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The likedOf must be of type \\" + @@ -43030,7 +48001,349 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Collection { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Collection; + + { + const array = node.#_3UyUdxnyn6cDn53QKrh4MBiearma_current; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3UyUdxnyn6cDn53QKrh4MBiearma_current.length; i++) { + const value = node.#_3UyUdxnyn6cDn53QKrh4MBiearma_current[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3UyUdxnyn6cDn53QKrh4MBiearma_current[i] = context.value(value); + } + } + } + } + + { + const array = node.#_J52RqweMe6hhv7RnLJMC8BExTE5_first; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_J52RqweMe6hhv7RnLJMC8BExTE5_first.length; i++) { + const value = node.#_J52RqweMe6hhv7RnLJMC8BExTE5_first[i]; + if (value != null && typeof value === \\"object\\") { + node.#_J52RqweMe6hhv7RnLJMC8BExTE5_first[i] = context.value(value); + } + } + } + } + + { + const array = node.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.length; i++) { + const value = node.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last[i]; + if (value != null && typeof value === \\"object\\") { + node.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length; i++) { + const value = node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.length; i++) { + const value = node.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.length; i++) { + const value = node.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.length; i++) { + const value = node.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.length; i++) { + const value = node.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.length; i++) { + const value = node.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.length; i++) { + const value = node.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.length; i++) { + const value = node.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.length; i++) { + const value = node.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf[i] = context.value(value); + } + } + } + } +} }); } + /** A non-negative integer specifying the total number of objects contained by * the logical view of the collection. This number might not reflect the actual * number of items serialized within the {@link Collection} object instance. @@ -43374,7 +48687,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3UyUdxnyn6cDn53QKrh4MBiearma_current[0]; if (!(v instanceof URL) && - !this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current.has(0)) { + !(0 < (this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current[vocabTrustPrefix] ?? 0) || + this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#current\\"); @@ -43442,7 +48756,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current.has(0)) { + !(0 < (this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current[vocabTrustPrefix] ?? 0) || + this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -43793,7 +49108,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_J52RqweMe6hhv7RnLJMC8BExTE5_first[0]; if (!(v instanceof URL) && - !this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first.has(0)) { + !(0 < (this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first[vocabTrustPrefix] ?? 0) || + this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#first\\"); @@ -43861,7 +49177,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first.has(0)) { + !(0 < (this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first[vocabTrustPrefix] ?? 0) || + this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -44212,7 +49529,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last[0]; if (!(v instanceof URL) && - !this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.has(0)) { + !(0 < (this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last[vocabTrustPrefix] ?? 0) || + this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#last\\"); @@ -44280,7 +49598,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.has(0)) { + !(0 < (this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last[vocabTrustPrefix] ?? 0) || + this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -44646,7 +49965,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i)) { + !(i < (this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[vocabTrustPrefix] ?? 0) || + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#items\\"); @@ -44718,7 +50038,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i)) { + !(i < (this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[vocabTrustPrefix] ?? 0) || + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -45069,7 +50390,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf[0]; if (!(v instanceof URL) && - !this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.has(0)) { + !(0 < (this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf[vocabTrustPrefix] ?? 0) || + this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/5711#likesOf\\"); @@ -45137,7 +50459,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.has(0)) { + !(0 < (this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf[vocabTrustPrefix] ?? 0) || + this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -45487,7 +50810,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf[0]; if (!(v instanceof URL) && - !this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.has(0)) { + !(0 < (this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf[vocabTrustPrefix] ?? 0) || + this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/5711#sharesOf\\"); @@ -45555,7 +50879,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.has(0)) { + !(0 < (this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf[vocabTrustPrefix] ?? 0) || + this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -45905,7 +51230,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf[0]; if (!(v instanceof URL) && - !this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.has(0)) { + !(0 < (this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf[vocabTrustPrefix] ?? 0) || + this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/5711#repliesOf\\"); @@ -45973,7 +51299,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.has(0)) { + !(0 < (this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf[vocabTrustPrefix] ?? 0) || + this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -46323,7 +51650,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf[0]; if (!(v instanceof URL) && - !this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.has(0)) { + !(0 < (this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/5711#inboxOf\\"); @@ -46391,7 +51719,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.has(0)) { + !(0 < (this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -46741,7 +52070,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf[0]; if (!(v instanceof URL) && - !this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.has(0)) { + !(0 < (this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf[vocabTrustPrefix] ?? 0) || + this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/5711#outboxOf\\"); @@ -46809,7 +52139,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.has(0)) { + !(0 < (this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf[vocabTrustPrefix] ?? 0) || + this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -47159,7 +52490,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf[0]; if (!(v instanceof URL) && - !this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.has(0)) { + !(0 < (this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf[vocabTrustPrefix] ?? 0) || + this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/5711#followersOf\\"); @@ -47227,7 +52559,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.has(0)) { + !(0 < (this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf[vocabTrustPrefix] ?? 0) || + this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -47577,7 +52910,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf[0]; if (!(v instanceof URL) && - !this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.has(0)) { + !(0 < (this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/5711#followingOf\\"); @@ -47645,7 +52979,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.has(0)) { + !(0 < (this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -47995,7 +53330,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf[0]; if (!(v instanceof URL) && - !this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.has(0)) { + !(0 < (this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/5711#likedOf\\"); @@ -48063,7 +53399,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.has(0)) { + !(0 < (this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -48928,7 +54265,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems = _XDbmNDuWHmrhqH712zqtecdbv1V_totalItems; const _3UyUdxnyn6cDn53QKrh4MBiearma_current: (CollectionPage | URL)[] = []; - const _trust_3UyUdxnyn6cDn53QKrh4MBiearma_current: Set = new Set(); + const _trust_3UyUdxnyn6cDn53QKrh4MBiearma_current: VocabTrustSet = new Set(); let _3UyUdxnyn6cDn53QKrh4MBiearma_current__array = values[\\"https://www.w3.org/ns/activitystreams#current\\"]; @@ -48969,7 +54306,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_3UyUdxnyn6cDn53QKrh4MBiearma_current = _3UyUdxnyn6cDn53QKrh4MBiearma_current; const _J52RqweMe6hhv7RnLJMC8BExTE5_first: (CollectionPage | URL)[] = []; - const _trust_J52RqweMe6hhv7RnLJMC8BExTE5_first: Set = new Set(); + const _trust_J52RqweMe6hhv7RnLJMC8BExTE5_first: VocabTrustSet = new Set(); let _J52RqweMe6hhv7RnLJMC8BExTE5_first__array = values[\\"https://www.w3.org/ns/activitystreams#first\\"]; @@ -49010,7 +54347,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_J52RqweMe6hhv7RnLJMC8BExTE5_first = _J52RqweMe6hhv7RnLJMC8BExTE5_first; const _gyJJnyEFnuNVi1HFZKfAn3Hfn26_last: (CollectionPage | URL)[] = []; - const _trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last: Set = new Set(); + const _trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last: VocabTrustSet = new Set(); let _gyJJnyEFnuNVi1HFZKfAn3Hfn26_last__array = values[\\"https://www.w3.org/ns/activitystreams#last\\"]; @@ -49051,7 +54388,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = _gyJJnyEFnuNVi1HFZKfAn3Hfn26_last; const _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: (Object | Link | URL)[] = []; - const _trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: Set = new Set(); + const _trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: VocabTrustSet = new Set(); let _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items__array = values[\\"https://www.w3.org/ns/activitystreams#items\\"]; @@ -49099,7 +54436,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items; const _4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf: (Object | URL)[] = []; - const _trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf: Set = new Set(); + const _trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf: VocabTrustSet = new Set(); let _4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf__array = values[\\"https://w3id.org/fep/5711#likesOf\\"]; @@ -49140,7 +54477,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = _4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf; const _3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf: (Object | URL)[] = []; - const _trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf: Set = new Set(); + const _trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf: VocabTrustSet = new Set(); let _3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf__array = values[\\"https://w3id.org/fep/5711#sharesOf\\"]; @@ -49181,7 +54518,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = _3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf; const _3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf: (Object | URL)[] = []; - const _trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf: Set = new Set(); + const _trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf: VocabTrustSet = new Set(); let _3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf__array = values[\\"https://w3id.org/fep/5711#repliesOf\\"]; @@ -49222,7 +54559,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = _3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf; const _2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf: (Object | URL)[] = []; - const _trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf: Set = new Set(); + const _trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf: VocabTrustSet = new Set(); let _2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf__array = values[\\"https://w3id.org/fep/5711#inboxOf\\"]; @@ -49263,7 +54600,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = _2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf; const _4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf: (Object | URL)[] = []; - const _trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf: Set = new Set(); + const _trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf: VocabTrustSet = new Set(); let _4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf__array = values[\\"https://w3id.org/fep/5711#outboxOf\\"]; @@ -49304,7 +54641,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = _4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf; const _41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf: (Object | URL)[] = []; - const _trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf: Set = new Set(); + const _trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf: VocabTrustSet = new Set(); let _41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf__array = values[\\"https://w3id.org/fep/5711#followersOf\\"]; @@ -49345,7 +54682,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = _41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf; const _2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf: (Object | URL)[] = []; - const _trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf: Set = new Set(); + const _trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf: VocabTrustSet = new Set(); let _2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf__array = values[\\"https://w3id.org/fep/5711#followingOf\\"]; @@ -49386,7 +54723,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = _2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf; const _2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf: (Object | URL)[] = []; - const _trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf: Set = new Set(); + const _trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf: VocabTrustSet = new Set(); let _2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf__array = values[\\"https://w3id.org/fep/5711#likedOf\\"]; @@ -49760,7 +55097,7 @@ export class OrderedCollection extends Collection { } #_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: (Object | Link | URL)[] = []; - #_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: Set = new Set(); + #_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: VocabTrustSet = new Set(); /** * Constructs a new instance of OrderedCollection with the given values. @@ -49799,14 +55136,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu super(values, options); if (\\"items\\" in values && values.items != null) { - if (Array.isArray(values.items) && - values.items.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.items)) { + const array = values.items; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.items; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = values.items.slice(); + this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = copied; - for (let i = 0; i < values.items.length; i++) { - this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.add(i); - } + vocabSetTrustPrefix(this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length); } else { throw new TypeError( @@ -49828,8 +55187,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link OrderedCollection.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -49881,18 +55240,43 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as OrderedCollection;clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.slice();clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = new Set(this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items); + const clone = super.clone(values, options) as unknown as OrderedCollection;clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length < vocabSparseArrayMinimumLength + ? this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.slice() : vocabCopyPropertyArray(this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items);clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = vocabCopyTrustSet( + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, + ); if (\\"items\\" in values && values.items != null) { - if (Array.isArray(values.items) && - values.items.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.items)) { + const array = values.items; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.items; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = values.items.slice(); + clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = copied; clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = new Set(); - for (let i = 0; i < values.items.length; i++) { - clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length); } else { throw new TypeError( @@ -49904,7 +55288,107 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;items?: (Object | Link | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): OrderedCollection { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as OrderedCollection; + + { + const array = node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length; i++) { + const value = node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[i] = context.value(value); + } + } + } + } +} }); } + async #fetchItem( url: URL, options: { @@ -50247,7 +55731,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i)) { + !(i < (this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[vocabTrustPrefix] ?? 0) || + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#items\\"); @@ -50319,7 +55804,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i)) { + !(i < (this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[vocabTrustPrefix] ?? 0) || + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -50662,7 +56148,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: (Object | Link | URL)[] = []; - const _trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: Set = new Set(); + const _trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: VocabTrustSet = new Set(); let _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items__array = values[\\"https://www.w3.org/ns/activitystreams#items\\"]; @@ -50878,8 +56364,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link FeaturedCollection.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -50931,7 +56417,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as FeaturedCollection;clone.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic = this.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic.slice(); + const clone = super.clone(values, options) as unknown as FeaturedCollection;clone.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic = this.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic.length < vocabSparseArrayMinimumLength + ? this.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic.slice() : vocabCopyPropertyArray(this.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic); if (\\"topic\\" in values && values.topic != null) { if (values.topic instanceof Hashtag) { // @ts-ignore: type is checked above. @@ -50944,7 +56431,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice(); + clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length < vocabSparseArrayMinimumLength + ? this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice() : vocabCopyPropertyArray(this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable); if (\\"discoverable\\" in values && values.discoverable != null) { if (typeof values.discoverable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -50960,7 +56448,107 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;items?: (Object | Link | URL)[];topic?: Hashtag | null;discoverable?: boolean | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): FeaturedCollection { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as FeaturedCollection; + + { + const array = node.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic.length; i++) { + const value = node.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic[i]; + if (value != null && typeof value === \\"object\\") { + node.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic[i] = context.value(value); + } + } + } + } +} }); } + /** A single {@link Hashtag} object that represents the main topic or category * of this featured collection. * @@ -51514,10 +57102,10 @@ export class FeaturedItem extends Object { } #_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject: (Object | URL)[] = []; - #_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject: Set = new Set(); + #_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject: VocabTrustSet = new Set(); #_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization: (FeatureAuthorization | URL)[] = []; - #_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization: Set = new Set(); + #_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization: VocabTrustSet = new Set(); /** * Constructs a new instance of FeaturedItem with the given values. @@ -51592,8 +57180,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link FeaturedItem.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -51645,12 +57233,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as FeaturedItem;clone.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = this.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.slice();clone.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = new Set(this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject); + const clone = super.clone(values, options) as unknown as FeaturedItem;clone.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = this.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.length < vocabSparseArrayMinimumLength + ? this.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.slice() : vocabCopyPropertyArray(this.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject);clone.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = vocabCopyTrustSet( + this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject, clone.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject, + ); if (\\"featuredObject\\" in values && values.featuredObject != null) { if (values.featuredObject instanceof Object || values.featuredObject instanceof URL) { // @ts-ignore: type is checked above. clone.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = [values.featuredObject]; - clone.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = new Set([0]); + clone.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = new Set(); + clone.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredObject must be of type \\" + @@ -51658,12 +57250,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = this.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.slice();clone.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = new Set(this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization); + clone.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = this.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.slice() : vocabCopyPropertyArray(this.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization);clone.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = vocabCopyTrustSet( + this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization, clone.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization, + ); if (\\"featureAuthorization\\" in values && values.featureAuthorization != null) { if (values.featureAuthorization instanceof FeatureAuthorization || values.featureAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = [values.featureAuthorization]; - clone.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = new Set([0]); + clone.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = new Set(); + clone.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featureAuthorization must be of type \\" + @@ -51674,7 +57270,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];featuredObject?: Object | URL | null;featureAuthorization?: FeatureAuthorization | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): FeaturedItem { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as FeaturedItem; + + { + const array = node.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.length; i++) { + const value = node.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject[i]; + if (value != null && typeof value === \\"object\\") { + node.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.length; i++) { + const value = node.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization[i] = context.value(value); + } + } + } + } +} }); } + async #fetchFeaturedObject( url: URL, options: { @@ -52000,7 +57718,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject[0]; if (!(v instanceof URL) && - !this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.has(0)) { + !(0 < (this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject[vocabTrustPrefix] ?? 0) || + this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/7aa9#featuredObject\\"); @@ -52068,7 +57787,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.has(0)) { + !(0 < (this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject[vocabTrustPrefix] ?? 0) || + this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -52419,7 +58139,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.has(0)) { + !(0 < (this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/7aa9#featureAuthorization\\"); @@ -52487,7 +58208,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.has(0)) { + !(0 < (this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -52864,7 +58586,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject: (Object | URL)[] = []; - const _trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject: Set = new Set(); + const _trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject: VocabTrustSet = new Set(); let _Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject__array = values[\\"https://w3id.org/fep/7aa9#featuredObject\\"]; @@ -52905,7 +58627,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = _Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject; const _2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization: (FeatureAuthorization | URL)[] = []; - const _trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization: Set = new Set(); + const _trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization: VocabTrustSet = new Set(); let _2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization__array = values[\\"https://w3id.org/fep/7aa9#featureAuthorization\\"]; @@ -53190,10 +58912,34 @@ endpoints?: (URL)[];} ); } - if (Array.isArray(values.endpoints) && - values.endpoints.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.endpoints)) { + const array = values.endpoints; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.endpoints; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = values.endpoints.slice(); + this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = copied; } else { throw new TypeError( @@ -53215,8 +58961,8 @@ endpoints?: (URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link DidService.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -53260,7 +59006,8 @@ endpoints?: (URL)[];} options ); copyPortableProvenance(this, clone); - clone.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.slice(); + clone.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.length < vocabSparseArrayMinimumLength + ? this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.slice() : vocabCopyPropertyArray(this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint); if (\\"endpoint\\" in values && values.endpoint != null) { if (values.endpoint instanceof URL) { // @ts-ignore: type is checked above. @@ -53284,10 +59031,34 @@ endpoints?: (URL)[];} ); } - if (Array.isArray(values.endpoints) && - values.endpoints.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.endpoints)) { + const array = values.endpoints; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.endpoints; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = values.endpoints.slice(); + clone.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = copied; } else { throw new TypeError( @@ -53299,7 +59070,102 @@ endpoints?: (URL)[];} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +endpoint?: URL | null; +endpoints?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): DidService { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as DidService; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as DidService; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.length; i++) { + const value = node.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint[i] = context.value(value); + } + } + } + } +} }); } + /** A network address, such as an HTTP URL, at which services operate on behalf * of a DID subject. * @@ -53747,8 +59613,8 @@ endpoints?: (URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Export.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -53788,7 +59654,62 @@ endpoints?: (URL)[];} const clone = super.clone(values, options) as unknown as Export; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +endpoint?: URL | null; +endpoints?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Export { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -54173,7 +60094,7 @@ export class DataIntegrityProof { #_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite: (\\"eddsa-jcs-2022\\")[] = []; #_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: (Multikey | URL)[] = []; - #_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: Set = new Set(); + #_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: VocabTrustSet = new Set(); #_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose: (\\"assertionMethod\\" | \\"authentication\\" | \\"capabilityInvocation\\" | \\"capabilityDelegation\\" | \\"keyAgreement\\")[] = []; #_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue: (Uint8Array)[] = []; #_3qzP3ukEZoUziK5FEiA1RhU4aqac: (Temporal.Instant)[] = []; @@ -54295,8 +60216,8 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link DataIntegrityProof.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -54339,7 +60260,8 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | options ); copyPortableProvenance(this, clone); - clone.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite.slice(); + clone.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite.length < vocabSparseArrayMinimumLength + ? this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite.slice() : vocabCopyPropertyArray(this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite); if (\\"cryptosuite\\" in values && values.cryptosuite != null) { if (values.cryptosuite == \\"eddsa-jcs-2022\\") { // @ts-ignore: type is checked above. @@ -54352,12 +60274,16 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | ); } } - clone.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.slice();clone.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = new Set(this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod); + clone.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.length < vocabSparseArrayMinimumLength + ? this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.slice() : vocabCopyPropertyArray(this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod);clone.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = vocabCopyTrustSet( + this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod, clone.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod, + ); if (\\"verificationMethod\\" in values && values.verificationMethod != null) { if (values.verificationMethod instanceof Multikey || values.verificationMethod instanceof URL) { // @ts-ignore: type is checked above. clone.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = [values.verificationMethod]; - clone.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = new Set([0]); + clone.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = new Set(); + clone.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The verificationMethod must be of type \\" + @@ -54365,7 +60291,8 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | ); } } - clone.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose = this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose.slice(); + clone.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose = this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose.length < vocabSparseArrayMinimumLength + ? this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose.slice() : vocabCopyPropertyArray(this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose); if (\\"proofPurpose\\" in values && values.proofPurpose != null) { if (values.proofPurpose === \\"assertionMethod\\" || values.proofPurpose === \\"authentication\\" || values.proofPurpose === \\"capabilityInvocation\\" || values.proofPurpose === \\"capabilityDelegation\\" || @@ -54380,7 +60307,8 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | ); } } - clone.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue.slice(); + clone.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue.length < vocabSparseArrayMinimumLength + ? this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue.slice() : vocabCopyPropertyArray(this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue); if (\\"proofValue\\" in values && values.proofValue != null) { if (values.proofValue instanceof Uint8Array) { // @ts-ignore: type is checked above. @@ -54393,7 +60321,8 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | ); } } - clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac.slice(); + clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac.length < vocabSparseArrayMinimumLength + ? this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac.slice() : vocabCopyPropertyArray(this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac); if (\\"created\\" in values && values.created != null) { if (isTemporalInstant(values.created)) { // @ts-ignore: type is checked above. @@ -54409,7 +60338,123 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | null;proofPurpose?: \\"assertionMethod\\" | \\"authentication\\" | \\"capabilityInvocation\\" | \\"capabilityDelegation\\" | \\"keyAgreement\\" | null;proofValue?: Uint8Array | null;created?: Temporal.Instant | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): DataIntegrityProof { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as DataIntegrityProof; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as DataIntegrityProof; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.length; i++) { + const value = node.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue.length; i++) { + const value = node.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue[i] = context.value(value); + } + } + } + } +} }); } + /** The cryptographic suite used to create the proof. * */ @@ -54753,7 +60798,8 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | } let v = this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[0]; if (!(v instanceof URL) && - !this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.has(0)) { + !(0 < (this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#verificationMethod\\"); @@ -54787,7 +60833,8 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.has(0)) { + !(0 < (this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -55223,7 +61270,7 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | instance.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite; const _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: (Multikey | URL)[] = []; - const _trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: Set = new Set(); + const _trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: VocabTrustSet = new Set(); let _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod__array = values[\\"https://w3id.org/security#verificationMethod\\"]; @@ -55608,7 +61655,7 @@ export class CryptographicKey { } #_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: Set = new Set(); + #_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: VocabTrustSet = new Set(); #_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem: (CryptoKey)[] = []; /** @@ -55690,8 +61737,8 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link CryptographicKey.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -55734,12 +61781,16 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi options ); copyPortableProvenance(this, clone); - clone.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.slice();clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = new Set(this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner); + clone.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.length < vocabSparseArrayMinimumLength + ? this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.slice() : vocabCopyPropertyArray(this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner);clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = vocabCopyTrustSet( + this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner, clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner, + ); if (\\"owner\\" in values && values.owner != null) { if (values.owner instanceof Application || values.owner instanceof Group || values.owner instanceof Organization || values.owner instanceof Person || values.owner instanceof Service || values.owner instanceof URL) { // @ts-ignore: type is checked above. clone.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = [values.owner]; - clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = new Set([0]); + clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = new Set(); + clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The owner must be of type \\" + @@ -55747,7 +61798,8 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi ); } } - clone.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem = this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem.slice(); + clone.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem = this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem.length < vocabSparseArrayMinimumLength + ? this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem.slice() : vocabCopyPropertyArray(this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem); if (\\"publicKey\\" in values && values.publicKey != null) { if ( // @ts-ignore: CryptoKey exists in the global scope. @@ -55766,7 +61818,101 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +owner?: Application | Group | Organization | Person | Service | URL | null;publicKey?: CryptoKey | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): CryptographicKey { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as CryptographicKey; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as CryptographicKey; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.length; i++) { + const value = node.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[i]; + if (value != null && typeof value === \\"object\\") { + node.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[i] = context.value(value); + } + } + } + } +} }); } + async #fetchOwner( url: URL, options: { @@ -56152,7 +62298,8 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi } let v = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[0]; if (!(v instanceof URL) && - !this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.has(0)) { + !(0 < (this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[vocabTrustPrefix] ?? 0) || + this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#owner\\"); @@ -56220,7 +62367,8 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.has(0)) { + !(0 < (this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[vocabTrustPrefix] ?? 0) || + this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -56591,7 +62739,7 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: Set = new Set(); + const _trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: VocabTrustSet = new Set(); let _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner__array = values[\\"https://w3id.org/security#owner\\"]; @@ -56875,7 +63023,7 @@ export class Multikey { } #_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: Set = new Set(); + #_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: VocabTrustSet = new Set(); #_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase: (CryptoKey)[] = []; /** @@ -56957,8 +63105,8 @@ controller?: Application | Group | Organization | Person | Service | URL | null; * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Multikey.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -57001,12 +63149,16 @@ controller?: Application | Group | Organization | Person | Service | URL | null; options ); copyPortableProvenance(this, clone); - clone.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.slice();clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = new Set(this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller); + clone.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.length < vocabSparseArrayMinimumLength + ? this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.slice() : vocabCopyPropertyArray(this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller);clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = vocabCopyTrustSet( + this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller, clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller, + ); if (\\"controller\\" in values && values.controller != null) { if (values.controller instanceof Application || values.controller instanceof Group || values.controller instanceof Organization || values.controller instanceof Person || values.controller instanceof Service || values.controller instanceof URL) { // @ts-ignore: type is checked above. clone.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = [values.controller]; - clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = new Set([0]); + clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = new Set(); + clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The controller must be of type \\" + @@ -57014,7 +63166,8 @@ controller?: Application | Group | Organization | Person | Service | URL | null; ); } } - clone.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase = this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase.slice(); + clone.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase = this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase.length < vocabSparseArrayMinimumLength + ? this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase.slice() : vocabCopyPropertyArray(this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase); if (\\"publicKey\\" in values && values.publicKey != null) { if ( // @ts-ignore: CryptoKey exists in the global scope. @@ -57033,7 +63186,101 @@ controller?: Application | Group | Organization | Person | Service | URL | null; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +controller?: Application | Group | Organization | Person | Service | URL | null;publicKey?: CryptoKey | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Multikey { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Multikey; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Multikey; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.length; i++) { + const value = node.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[i] = context.value(value); + } + } + } + } +} }); } + async #fetchController( url: URL, options: { @@ -57419,7 +63666,8 @@ controller?: Application | Group | Organization | Person | Service | URL | null; } let v = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[0]; if (!(v instanceof URL) && - !this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.has(0)) { + !(0 < (this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[vocabTrustPrefix] ?? 0) || + this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#controller\\"); @@ -57487,7 +63735,8 @@ controller?: Application | Group | Organization | Person | Service | URL | null; mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.has(0)) { + !(0 < (this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[vocabTrustPrefix] ?? 0) || + this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -57865,7 +64114,7 @@ controller?: Application | Group | Organization | Person | Service | URL | null; let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: Set = new Set(); + const _trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: VocabTrustSet = new Set(); let _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller__array = values[\\"https://w3id.org/security#controller\\"]; @@ -58162,8 +64411,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Agreement.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -58215,7 +64464,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Agreement;clone.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates = this.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates.slice(); + const clone = super.clone(values, options) as unknown as Agreement;clone.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates = this.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates.length < vocabSparseArrayMinimumLength + ? this.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates.slice() : vocabCopyPropertyArray(this.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates); if (\\"stipulates\\" in values && values.stipulates != null) { if (values.stipulates instanceof Commitment) { // @ts-ignore: type is checked above. @@ -58228,7 +64478,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal = this.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal.slice(); + clone.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal = this.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal.length < vocabSparseArrayMinimumLength + ? this.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal.slice() : vocabCopyPropertyArray(this.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal); if (\\"stipulatesReciprocal\\" in values && values.stipulatesReciprocal != null) { if (values.stipulatesReciprocal instanceof Commitment) { // @ts-ignore: type is checked above. @@ -58244,7 +64495,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];stipulates?: Commitment | null;stipulatesReciprocal?: Commitment | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Agreement { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Agreement; + + { + const array = node.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates.length; i++) { + const value = node.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates[i]; + if (value != null && typeof value === \\"object\\") { + node.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal.length; i++) { + const value = node.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal[i] = context.value(value); + } + } + } + } +} }); } + /** The primary {@link Commitment} associated with the agreement. This * commitment satisfies the primary {@link Intent} of the corresponding * {@link Proposal}. @@ -58953,8 +65326,8 @@ satisfies?: URL | null;resourceQuantity?: Measure | null;} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Commitment.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -58997,7 +65370,8 @@ satisfies?: URL | null;resourceQuantity?: Measure | null;} options ); copyPortableProvenance(this, clone); - clone.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies = this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies.slice(); + clone.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies = this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies.length < vocabSparseArrayMinimumLength + ? this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies.slice() : vocabCopyPropertyArray(this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies); if (\\"satisfies\\" in values && values.satisfies != null) { if (values.satisfies instanceof URL) { // @ts-ignore: type is checked above. @@ -59010,7 +65384,8 @@ satisfies?: URL | null;resourceQuantity?: Measure | null;} ); } } - clone.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.slice(); + clone.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.length < vocabSparseArrayMinimumLength + ? this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.slice() : vocabCopyPropertyArray(this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity); if (\\"resourceQuantity\\" in values && values.resourceQuantity != null) { if (values.resourceQuantity instanceof Measure) { // @ts-ignore: type is checked above. @@ -59026,7 +65401,123 @@ satisfies?: URL | null;resourceQuantity?: Measure | null;} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +satisfies?: URL | null;resourceQuantity?: Measure | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Commitment { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Commitment; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Commitment; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies.length; i++) { + const value = node.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies[i]; + if (value != null && typeof value === \\"object\\") { + node.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.length; i++) { + const value = node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity[i] = context.value(value); + } + } + } + } +} }); } + /** The {@link Intent} of a {@link Proposal} that this commitment * satisfies. The value is the proposal's URI with a * [fragment](https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Fragment) @@ -59754,8 +66245,8 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Intent.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -59798,7 +66289,8 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur options ); copyPortableProvenance(this, clone); - clone.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action = this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.slice(); + clone.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action = this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.length < vocabSparseArrayMinimumLength + ? this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.slice() : vocabCopyPropertyArray(this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action); if (\\"action\\" in values && values.action != null) { if (typeof values.action === \\"string\\") { // @ts-ignore: type is checked above. @@ -59811,7 +66303,8 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur ); } } - clone.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo = this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.slice(); + clone.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo = this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.length < vocabSparseArrayMinimumLength + ? this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.slice() : vocabCopyPropertyArray(this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo); if (\\"resourceConformsTo\\" in values && values.resourceConformsTo != null) { if (values.resourceConformsTo instanceof URL) { // @ts-ignore: type is checked above. @@ -59824,7 +66317,8 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur ); } } - clone.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.slice(); + clone.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.length < vocabSparseArrayMinimumLength + ? this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.slice() : vocabCopyPropertyArray(this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity); if (\\"resourceQuantity\\" in values && values.resourceQuantity != null) { if (values.resourceQuantity instanceof Measure) { // @ts-ignore: type is checked above. @@ -59837,7 +66331,8 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur ); } } - clone.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity = this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.slice(); + clone.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity = this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.length < vocabSparseArrayMinimumLength + ? this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.slice() : vocabCopyPropertyArray(this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity); if (\\"availableQuantity\\" in values && values.availableQuantity != null) { if (values.availableQuantity instanceof Measure) { // @ts-ignore: type is checked above. @@ -59850,7 +66345,8 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur ); } } - clone.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.slice(); + clone.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.length < vocabSparseArrayMinimumLength + ? this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.slice() : vocabCopyPropertyArray(this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity); if (\\"minimumQuantity\\" in values && values.minimumQuantity != null) { if (values.minimumQuantity instanceof Measure) { // @ts-ignore: type is checked above. @@ -59866,7 +66362,167 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measure | null;availableQuantity?: Measure | null;minimumQuantity?: Measure | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Intent { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Intent; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Intent; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.length; i++) { + const value = node.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo[i]; + if (value != null && typeof value === \\"object\\") { + node.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.length; i++) { + const value = node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity[i] = context.value(value); + } + } + } + } + + { + const array = node.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.length; i++) { + const value = node.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity[i]; + if (value != null && typeof value === \\"object\\") { + node.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.length; i++) { + const value = node.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity[i] = context.value(value); + } + } + } + } +} }); } + /** The type of economic transaction. The value of this property should be * either \`\\"deliverService\\"\` or \`\\"transfer\\"\`. * @@ -60824,8 +67480,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Proposal.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -60877,7 +67533,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Proposal;clone.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose = this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose.slice(); + const clone = super.clone(values, options) as unknown as Proposal;clone.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose = this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose.length < vocabSparseArrayMinimumLength + ? this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose.slice() : vocabCopyPropertyArray(this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose); if (\\"purpose\\" in values && values.purpose != null) { if (typeof values.purpose === \\"string\\") { // @ts-ignore: type is checked above. @@ -60890,7 +67547,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes = this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.slice(); + clone.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes = this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.length < vocabSparseArrayMinimumLength + ? this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.slice() : vocabCopyPropertyArray(this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes); if (\\"publishes\\" in values && values.publishes != null) { if (values.publishes instanceof Intent) { // @ts-ignore: type is checked above. @@ -60903,7 +67561,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal = this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.slice(); + clone.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal = this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.length < vocabSparseArrayMinimumLength + ? this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.slice() : vocabCopyPropertyArray(this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal); if (\\"reciprocal\\" in values && values.reciprocal != null) { if (values.reciprocal instanceof Intent) { // @ts-ignore: type is checked above. @@ -60916,7 +67575,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased.slice(); + clone.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased.length < vocabSparseArrayMinimumLength + ? this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased.slice() : vocabCopyPropertyArray(this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased); if (\\"unitBased\\" in values && values.unitBased != null) { if (typeof values.unitBased === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -60932,7 +67592,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];purpose?: string | null;publishes?: Intent | null;reciprocal?: Intent | null;unitBased?: boolean | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Proposal { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Proposal; + + { + const array = node.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.length; i++) { + const value = node.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes[i]; + if (value != null && typeof value === \\"object\\") { + node.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes[i] = context.value(value); + } + } + } + } + + { + const array = node.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.length; i++) { + const value = node.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal[i]; + if (value != null && typeof value === \\"object\\") { + node.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal[i] = context.value(value); + } + } + } + } +} }); } + /** The type of proposal. Possible values are \`\\"offer\\"\` and \`\\"request\\"\`. * */ @@ -61743,8 +68525,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Accept.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -61805,7 +68587,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Accept; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Accept { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -62189,8 +69047,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Add.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -62251,7 +69109,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Add; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Add { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -62630,8 +69564,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Announce.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -62692,7 +69626,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Announce; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Announce { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -63017,39 +70027,39 @@ export class Application extends Object { #_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername: ((string | LanguageString))[] = []; #_axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); #_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); #_hQiaHhZP8hqxckxTBrpsGNs57E3: (URL)[] = []; #_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers: (boolean)[] = []; #_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); #_41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); #_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); #_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); #_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); #_4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); #_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); #_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); #_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); #_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints: (Endpoints)[] = []; #_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable: (boolean)[] = []; #_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended: (boolean)[] = []; @@ -63057,13 +70067,13 @@ export class Application extends Object { #_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable: (boolean)[] = []; #_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); #_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); #_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); #_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage: (string)[] = []; #_2xEU4QtkC53RAun67T81Egqt9vmL_isCat: (boolean)[] = []; #_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense: (URL)[] = []; @@ -63132,10 +70142,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -63168,14 +70202,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; - for (let i = 0; i < values.publicKeys.length; i++) { - this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -63208,14 +70264,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; - for (let i = 0; i < values.assertionMethods.length; i++) { - this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -63248,10 +70326,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -63380,14 +70482,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | if (\\"streams\\" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; - for (let i = 0; i < values.streams.length; i++) { - this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -63498,14 +70622,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; - for (let i = 0; i < values.aliases.length; i++) { - this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -63538,14 +70684,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; - for (let i = 0; i < values.services.length; i++) { - this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -63606,8 +70774,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Application.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -63665,7 +70833,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Application;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice(); + const clone = super.clone(values, options) as unknown as Application;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < vocabSparseArrayMinimumLength + ? this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice() : vocabCopyPropertyArray(this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername); if (\\"preferredUsername\\" in values && values.preferredUsername != null) { if (typeof values.preferredUsername === \\"string\\" || values.preferredUsername instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -63689,10 +70858,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -63701,12 +70894,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice();clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length < vocabSparseArrayMinimumLength + ? this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice() : vocabCopyPropertyArray(this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey);clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = vocabCopyTrustSet( + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, + ); if (\\"publicKey\\" in values && values.publicKey != null) { if (values.publicKey instanceof CryptographicKey || values.publicKey instanceof URL) { // @ts-ignore: type is checked above. clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = [values.publicKey]; - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set([0]); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The publicKey must be of type \\" + @@ -63725,15 +70922,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); - for (let i = 0; i < values.publicKeys.length; i++) { - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -63742,12 +70961,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice();clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length < vocabSparseArrayMinimumLength + ? this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice() : vocabCopyPropertyArray(this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod);clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = vocabCopyTrustSet( + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, + ); if (\\"assertionMethod\\" in values && values.assertionMethod != null) { if (values.assertionMethod instanceof Multikey || values.assertionMethod instanceof URL) { // @ts-ignore: type is checked above. clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = [values.assertionMethod]; - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set([0]); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The assertionMethod must be of type \\" + @@ -63766,15 +70989,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); - for (let i = 0; i < values.assertionMethods.length; i++) { - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -63783,7 +71028,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length < vocabSparseArrayMinimumLength + ? this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice() : vocabCopyPropertyArray(this.#_hQiaHhZP8hqxckxTBrpsGNs57E3); if (\\"gateway\\" in values && values.gateway != null) { if (values.gateway instanceof URL && isGatewayUrl(values.gateway)) { // @ts-ignore: type is checked above. @@ -63807,10 +71053,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -63819,7 +71089,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice(); + clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.length < vocabSparseArrayMinimumLength + ? this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice() : vocabCopyPropertyArray(this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers); if (\\"manuallyApprovesFollowers\\" in values && values.manuallyApprovesFollowers != null) { if (typeof values.manuallyApprovesFollowers === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -63832,12 +71103,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice();clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox); + clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length < vocabSparseArrayMinimumLength + ? this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice() : vocabCopyPropertyArray(this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox);clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = vocabCopyTrustSet( + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, + ); if (\\"inbox\\" in values && values.inbox != null) { if (values.inbox instanceof OrderedCollection || values.inbox instanceof OrderedCollectionPage || values.inbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = [values.inbox]; - clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set([0]); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The inbox must be of type \\" + @@ -63845,12 +71120,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice();clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox); + clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length < vocabSparseArrayMinimumLength + ? this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice() : vocabCopyPropertyArray(this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox);clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = vocabCopyTrustSet( + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, + ); if (\\"outbox\\" in values && values.outbox != null) { if (values.outbox instanceof OrderedCollection || values.outbox instanceof OrderedCollectionPage || values.outbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = [values.outbox]; - clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set([0]); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The outbox must be of type \\" + @@ -63858,12 +71137,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice();clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following); + clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length < vocabSparseArrayMinimumLength + ? this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice() : vocabCopyPropertyArray(this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following);clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = vocabCopyTrustSet( + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, + ); if (\\"following\\" in values && values.following != null) { if (values.following instanceof Collection || values.following instanceof URL) { // @ts-ignore: type is checked above. clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = [values.following]; - clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set([0]); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The following must be of type \\" + @@ -63871,12 +71154,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice();clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers); + clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length < vocabSparseArrayMinimumLength + ? this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice() : vocabCopyPropertyArray(this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers);clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = vocabCopyTrustSet( + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, + ); if (\\"followers\\" in values && values.followers != null) { if (values.followers instanceof Collection || values.followers instanceof URL) { // @ts-ignore: type is checked above. clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = [values.followers]; - clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set([0]); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The followers must be of type \\" + @@ -63884,12 +71171,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice();clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked); + clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length < vocabSparseArrayMinimumLength + ? this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice() : vocabCopyPropertyArray(this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked);clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = vocabCopyTrustSet( + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, + ); if (\\"liked\\" in values && values.liked != null) { if (values.liked instanceof Collection || values.liked instanceof URL) { // @ts-ignore: type is checked above. clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = [values.liked]; - clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set([0]); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The liked must be of type \\" + @@ -63897,12 +71188,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice();clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured); + clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length < vocabSparseArrayMinimumLength + ? this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice() : vocabCopyPropertyArray(this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured);clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = vocabCopyTrustSet( + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, + ); if (\\"featured\\" in values && values.featured != null) { if (values.featured instanceof Collection || values.featured instanceof URL) { // @ts-ignore: type is checked above. clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = [values.featured]; - clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set([0]); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featured must be of type \\" + @@ -63910,12 +71205,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice();clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags); + clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length < vocabSparseArrayMinimumLength + ? this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice() : vocabCopyPropertyArray(this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags);clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = vocabCopyTrustSet( + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, + ); if (\\"featuredTags\\" in values && values.featuredTags != null) { if (values.featuredTags instanceof Collection || values.featuredTags instanceof URL) { // @ts-ignore: type is checked above. clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = [values.featuredTags]; - clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set([0]); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredTags must be of type \\" + @@ -63923,12 +71222,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice();clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections); + clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length < vocabSparseArrayMinimumLength + ? this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice() : vocabCopyPropertyArray(this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections);clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = vocabCopyTrustSet( + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, + ); if (\\"featuredCollections\\" in values && values.featuredCollections != null) { if (values.featuredCollections instanceof Collection || values.featuredCollections instanceof URL) { // @ts-ignore: type is checked above. clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = [values.featuredCollections]; - clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set([0]); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredCollections must be of type \\" + @@ -63936,18 +71239,43 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice();clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length < vocabSparseArrayMinimumLength + ? this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice() : vocabCopyPropertyArray(this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams);clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = vocabCopyTrustSet( + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, + ); if (\\"streams\\" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(); - for (let i = 0; i < values.streams.length; i++) { - clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -63956,7 +71284,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice(); + clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length < vocabSparseArrayMinimumLength + ? this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice() : vocabCopyPropertyArray(this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints); if (\\"endpoints\\" in values && values.endpoints != null) { if (values.endpoints instanceof Endpoints) { // @ts-ignore: type is checked above. @@ -63969,7 +71298,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice(); + clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length < vocabSparseArrayMinimumLength + ? this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice() : vocabCopyPropertyArray(this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable); if (\\"discoverable\\" in values && values.discoverable != null) { if (typeof values.discoverable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -63982,7 +71312,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice(); + clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.length < vocabSparseArrayMinimumLength + ? this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice() : vocabCopyPropertyArray(this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended); if (\\"suspended\\" in values && values.suspended != null) { if (typeof values.suspended === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -63995,7 +71326,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice(); + clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.length < vocabSparseArrayMinimumLength + ? this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice() : vocabCopyPropertyArray(this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial); if (\\"memorial\\" in values && values.memorial != null) { if (typeof values.memorial === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -64008,7 +71340,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice(); + clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.length < vocabSparseArrayMinimumLength + ? this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice() : vocabCopyPropertyArray(this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable); if (\\"indexable\\" in values && values.indexable != null) { if (typeof values.indexable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -64021,12 +71354,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice();clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo); + clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length < vocabSparseArrayMinimumLength + ? this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice() : vocabCopyPropertyArray(this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo);clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = vocabCopyTrustSet( + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, + ); if (\\"successor\\" in values && values.successor != null) { if (values.successor instanceof Application || values.successor instanceof Group || values.successor instanceof Organization || values.successor instanceof Person || values.successor instanceof Service || values.successor instanceof URL) { // @ts-ignore: type is checked above. clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = [values.successor]; - clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set([0]); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The successor must be of type \\" + @@ -64034,12 +71371,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice();clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length < vocabSparseArrayMinimumLength + ? this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice() : vocabCopyPropertyArray(this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs);clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = vocabCopyTrustSet( + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, + ); if (\\"alias\\" in values && values.alias != null) { if (values.alias instanceof Application || values.alias instanceof Group || values.alias instanceof Organization || values.alias instanceof Person || values.alias instanceof Service || values.alias instanceof URL) { // @ts-ignore: type is checked above. clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = [values.alias]; - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set([0]); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The alias must be of type \\" + @@ -64058,15 +71399,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); - for (let i = 0; i < values.aliases.length; i++) { - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -64075,12 +71438,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice();clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length < vocabSparseArrayMinimumLength + ? this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice() : vocabCopyPropertyArray(this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service);clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = vocabCopyTrustSet( + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, + ); if (\\"service\\" in values && values.service != null) { if (values.service instanceof DidService || values.service instanceof URL) { // @ts-ignore: type is checked above. clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = [values.service]; - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set([0]); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The service must be of type \\" + @@ -64099,15 +71466,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); - for (let i = 0; i < values.services.length; i++) { - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -64116,7 +71505,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice(); + clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.length < vocabSparseArrayMinimumLength + ? this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice() : vocabCopyPropertyArray(this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage); if (\\"followedMessage\\" in values && values.followedMessage != null) { if (typeof values.followedMessage === \\"string\\") { // @ts-ignore: type is checked above. @@ -64129,7 +71519,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice(); + clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.length < vocabSparseArrayMinimumLength + ? this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice() : vocabCopyPropertyArray(this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat); if (\\"cat\\" in values && values.cat != null) { if (typeof values.cat === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -64142,7 +71533,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice(); + clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length < vocabSparseArrayMinimumLength + ? this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice() : vocabCopyPropertyArray(this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense); if (\\"preferredLicense\\" in values && values.preferredLicense != null) { if (values.preferredLicense instanceof URL) { // @ts-ignore: type is checked above. @@ -64158,7 +71550,465 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];preferredUsername?: string | LanguageString | null; +preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; +publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; +assertionMethods?: (Multikey | URL)[];gateway?: URL | null; +gateways?: (URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;featuredCollections?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; +aliases?: (Application | Group | Organization | Person | Service | URL)[];service?: DidService | URL | null; +services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | null;preferredLicense?: URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Application { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Application; + + { + const array = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length; i++) { + const value = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i]; + if (value != null && typeof value === \\"object\\") { + node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length; i++) { + const value = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i] = context.value(value); + } + } + } + } + + { + const array = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length; i++) { + const value = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i]; + if (value != null && typeof value === \\"object\\") { + node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length; i++) { + const value = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length; i++) { + const value = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length; i++) { + const value = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i] = context.value(value); + } + } + } + } + + { + const array = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length; i++) { + const value = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i]; + if (value != null && typeof value === \\"object\\") { + node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length; i++) { + const value = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length; i++) { + const value = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length; i++) { + const value = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i] = context.value(value); + } + } + } + } + + { + const array = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length; i++) { + const value = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i]; + if (value != null && typeof value === \\"object\\") { + node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length; i++) { + const value = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i] = context.value(value); + } + } + } + } + + { + const array = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length; i++) { + const value = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i]; + if (value != null && typeof value === \\"object\\") { + node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length; i++) { + const value = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length; i++) { + const value = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length; i++) { + const value = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i] = context.value(value); + } + } + } + } + + { + const array = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length; i++) { + const value = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i]; + if (value != null && typeof value === \\"object\\") { + node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i] = context.value(value); + } + } + } + } +} }); } + /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. * @@ -64507,7 +72357,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[0]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#publicKey\\"); @@ -64575,7 +72426,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -64662,7 +72514,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#publicKey\\"); @@ -64734,7 +72587,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -65088,7 +72942,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#assertionMethod\\"); @@ -65156,7 +73011,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -65247,7 +73103,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#assertionMethod\\"); @@ -65319,7 +73176,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -65743,7 +73601,8 @@ get gateways(): (URL)[] { } let v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0]; if (!(v instanceof URL) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://www.w3.org/ns/ldp#inbox\\"); @@ -65811,7 +73670,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -66185,7 +74045,8 @@ get gateways(): (URL)[] { } let v = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[0]; if (!(v instanceof URL) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#outbox\\"); @@ -66253,7 +74114,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -66607,7 +74469,8 @@ get gateways(): (URL)[] { } let v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0]; if (!(v instanceof URL) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#following\\"); @@ -66675,7 +74538,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -67032,7 +74896,8 @@ get gateways(): (URL)[] { } let v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0]; if (!(v instanceof URL) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#followers\\"); @@ -67100,7 +74965,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -67455,7 +75321,8 @@ get gateways(): (URL)[] { } let v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0]; if (!(v instanceof URL) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#liked\\"); @@ -67523,7 +75390,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -67876,7 +75744,8 @@ get gateways(): (URL)[] { } let v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[0]; if (!(v instanceof URL) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://joinmastodon.org/ns#featured\\"); @@ -67944,7 +75813,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -68297,7 +76167,8 @@ get gateways(): (URL)[] { } let v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0]; if (!(v instanceof URL) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://joinmastodon.org/ns#featuredTags\\"); @@ -68365,7 +76236,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -68715,7 +76587,8 @@ get gateways(): (URL)[] { } let v = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[0]; if (!(v instanceof URL) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/7aa9#featuredCollections\\"); @@ -68783,7 +76656,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -69133,7 +77007,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#streams\\"); @@ -69205,7 +77080,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -69690,7 +77566,8 @@ get gateways(): (URL)[] { } let v = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0]; if (!(v instanceof URL) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#movedTo\\"); @@ -69758,7 +77635,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -70171,7 +78049,8 @@ get gateways(): (URL)[] { } let v = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"); @@ -70239,7 +78118,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -70330,7 +78210,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"); @@ -70402,7 +78283,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -70756,7 +78638,8 @@ get gateways(): (URL)[] { } let v = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/did#service\\"); @@ -70824,7 +78707,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -70915,7 +78799,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/did#service\\"); @@ -70987,7 +78872,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -72386,7 +80272,7 @@ get gateways(): (URL)[] { instance.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; const _axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); let _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array = values[\\"https://w3id.org/security#publicKey\\"]; @@ -72427,7 +80313,7 @@ get gateways(): (URL)[] { instance.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = _axq166E2eZADq34V4MYUc8KMZdC_publicKey; const _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); let _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array = values[\\"https://w3id.org/security#assertionMethod\\"]; @@ -72526,7 +80412,7 @@ get gateways(): (URL)[] { instance.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers; const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); let _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array = values[\\"http://www.w3.org/ns/ldp#inbox\\"]; @@ -72573,7 +80459,7 @@ get gateways(): (URL)[] { instance.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; const _41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); let _41QwhqJouoLg3h8dRPKat21brynC_outbox__array = values[\\"https://www.w3.org/ns/activitystreams#outbox\\"]; @@ -72620,7 +80506,7 @@ get gateways(): (URL)[] { instance.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = _41QwhqJouoLg3h8dRPKat21brynC_outbox; const _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); let _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array = values[\\"https://www.w3.org/ns/activitystreams#following\\"]; @@ -72661,7 +80547,7 @@ get gateways(): (URL)[] { instance.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; const _BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); let _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array = values[\\"https://www.w3.org/ns/activitystreams#followers\\"]; @@ -72702,7 +80588,7 @@ get gateways(): (URL)[] { instance.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = _BBCTgfphhsFzpVfKTykGSpBNwoA_followers; const _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); let _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array = values[\\"https://www.w3.org/ns/activitystreams#liked\\"]; @@ -72743,7 +80629,7 @@ get gateways(): (URL)[] { instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; const _4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); let _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array = values[\\"http://joinmastodon.org/ns#featured\\"]; @@ -72784,7 +80670,7 @@ get gateways(): (URL)[] { instance.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = _4N1vBJzXDf8NbBumeECQMFvKetja_featured; const _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); let _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array = values[\\"http://joinmastodon.org/ns#featuredTags\\"]; @@ -72825,7 +80711,7 @@ get gateways(): (URL)[] { instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; const _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); let _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections__array = values[\\"https://w3id.org/fep/7aa9#featuredCollections\\"]; @@ -72866,7 +80752,7 @@ get gateways(): (URL)[] { instance.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); let _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array = values[\\"https://www.w3.org/ns/activitystreams#streams\\"]; @@ -73055,7 +80941,7 @@ get gateways(): (URL)[] { instance.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable; const _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); let _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array = values[\\"https://www.w3.org/ns/activitystreams#movedTo\\"]; @@ -73113,7 +80999,7 @@ get gateways(): (URL)[] { instance.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; const _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); let _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array = values[\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"]; @@ -73171,7 +81057,7 @@ get gateways(): (URL)[] { instance.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; const _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); let _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array = values[\\"https://www.w3.org/ns/did#service\\"]; @@ -73940,46 +81826,127 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} -, +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + verifyPortableObject?: PortableObjectVerifier, + } = {}, + ) { + super(values, options);} + + /** + * Clones this instance, optionally updating it with the given values. + * + * This is a shallow copy: property arrays are copied, but nested objects + * and URLs are shared with this instance. Dereferencing accessors can cache + * fetched objects in the instance whose accessor is called. Hydrating a + * shared nested object through the clone can affect the original as well, + * and can change JSON-LD output when either is embedded in another + * object. Hydrating a top-level property of the clone does not update this + * instance's property. + * + * To resolve properties without sharing nested objects, use + * {@link IntransitiveActivity.deepClone} before hydration. + * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) + * for details, including how cached JSON-LD affects serialization. + * + * A clone never inherits a signed JSON-LD representation retained by + * \`signObject()\`: the clone may differ from the document that the proof + * covers, so embedding the original secured JSON in a parent document + * would be wrong. Sign the clone again if it has to be embedded as a + * secured child. + * + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance with its own property arrays. Nested objects + * and URLs are shared with this instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} + + = {}, options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, verifyPortableObject?: PortableObjectVerifier, - } = {}, - ) { - super(values, options);} + } = {} + ): IntransitiveActivity { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: \$warning is not recognized as a property, but it is. + options = { ...options, \$warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as IntransitiveActivity; + return clone; + } /** - * Clones this instance, optionally updating it with the given values. + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. * - * This is a shallow copy: property arrays are copied, but nested objects - * and URLs are shared with this instance. Dereferencing accessors can cache - * fetched objects in the instance whose accessor is called. Hydrating a - * shared nested object through the clone can affect the original as well, - * and can change JSON-LD output when either is embedded in another - * object. Hydrating a top-level property of the clone does not update this - * instance's property. + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. - * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) - * for details, including how cached JSON-LD affects serialization. + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. * - * A clone never inherits a signed JSON-LD representation retained by - * \`signObject()\`: the clone may differ from the document that the proof - * covers, so embedding the original secured JSON in a parent document - * would be wrong. Sign the clone again if it has to be embedded as a - * secured child. + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. * - * @param values The values to update the clone with. - * @param options The options to use for cloning. - * @returns The cloned instance with its own property arrays. Nested objects - * and URLs are shared with this instance. + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 */ - override clone( - values: - { + override deepClone(values: +{ id?: URL | null; attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; @@ -74004,26 +81971,21 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - verifyPortableObject?: PortableObjectVerifier, - } = {} - ): IntransitiveActivity { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - // @ts-ignore: \$warning is not recognized as a property, but it is. - options = { ...options, \$warning: this._warning }; - } - const clone = super.clone(values, options) as unknown as IntransitiveActivity; - return clone; += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): IntransitiveActivity { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -74414,8 +82376,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Arrive.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -74476,7 +82438,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Arrive; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Arrive { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -74800,11 +82838,11 @@ export class Article extends Object { } #_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); #_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; #_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); /** * Constructs a new instance of Article with the given values. @@ -74892,8 +82930,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Article.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -74945,12 +82983,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Article;clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice();clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote); + const clone = super.clone(values, options) as unknown as Article;clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length < vocabSparseArrayMinimumLength + ? this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice() : vocabCopyPropertyArray(this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote);clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = vocabCopyTrustSet( + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, + ); if (\\"quote\\" in values && values.quote != null) { if (values.quote instanceof Object || values.quote instanceof URL) { // @ts-ignore: type is checked above. clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = [values.quote]; - clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set([0]); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The quote must be of type \\" + @@ -74958,7 +83000,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice(); + clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length < vocabSparseArrayMinimumLength + ? this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice() : vocabCopyPropertyArray(this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl); if (\\"quoteUrl\\" in values && values.quoteUrl != null) { if (values.quoteUrl instanceof URL) { // @ts-ignore: type is checked above. @@ -74971,12 +83014,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice();clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization); + clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice() : vocabCopyPropertyArray(this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization);clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = vocabCopyTrustSet( + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, + ); if (\\"quoteAuthorization\\" in values && values.quoteAuthorization != null) { if (values.quoteAuthorization instanceof QuoteAuthorization || values.quoteAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = [values.quoteAuthorization]; - clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set([0]); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The quoteAuthorization must be of type \\" + @@ -74987,7 +83034,151 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];quote?: Object | URL | null;quoteUrl?: URL | null;quoteAuthorization?: QuoteAuthorization | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Article { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Article; + + { + const array = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length; i++) { + const value = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i] = context.value(value); + } + } + } + } + + { + const array = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length; i++) { + const value = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i]; + if (value != null && typeof value === \\"object\\") { + node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i] = context.value(value); + } + } + } + } + + { + const array = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length; i++) { + const value = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i]; + if (value != null && typeof value === \\"object\\") { + node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i] = context.value(value); + } + } + } + } +} }); } + async #fetchQuote( url: URL, options: { @@ -75316,7 +83507,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[0]; if (!(v instanceof URL) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/044f#quote\\"); @@ -75384,7 +83576,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -75758,7 +83951,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/044f#quoteAuthorization\\"); @@ -75826,7 +84020,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -76253,7 +84448,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); let _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote__array = values[\\"https://w3id.org/fep/044f#quote\\"]; @@ -76333,7 +84528,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; const _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); let _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization__array = values[\\"https://w3id.org/fep/044f#quoteAuthorization\\"]; @@ -76591,8 +84786,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Document.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -76644,7 +84839,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Document;clone.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.slice(); + const clone = super.clone(values, options) as unknown as Document;clone.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.length < vocabSparseArrayMinimumLength + ? this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.slice() : vocabCopyPropertyArray(this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width); if (\\"width\\" in values && values.width != null) { if (typeof values.width === \\"number\\" && Number.isInteger(values.width) && values.width >= 0) { // @ts-ignore: type is checked above. @@ -76657,7 +84853,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.slice(); + clone.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.length < vocabSparseArrayMinimumLength + ? this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.slice() : vocabCopyPropertyArray(this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height); if (\\"height\\" in values && values.height != null) { if (typeof values.height === \\"number\\" && Number.isInteger(values.height) && values.height >= 0) { // @ts-ignore: type is checked above. @@ -76670,7 +84867,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase = this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase.slice(); + clone.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase = this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase.length < vocabSparseArrayMinimumLength + ? this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase.slice() : vocabCopyPropertyArray(this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase); if (\\"digestMultibase\\" in values && values.digestMultibase != null) { if (typeof values.digestMultibase === \\"string\\") { // @ts-ignore: type is checked above. @@ -76686,7 +84884,77 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];width?: number | null;height?: number | null;digestMultibase?: string | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Document { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** Specifies a hint as to the rendering width in * device-independent pixels of the linked resource. * @@ -77399,8 +85667,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Audio.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -77455,7 +85723,77 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const clone = super.clone(values, options) as unknown as Audio; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];width?: number | null;height?: number | null;digestMultibase?: string | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Audio { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -77831,46 +86169,127 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} -, +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + verifyPortableObject?: PortableObjectVerifier, + } = {}, + ) { + super(values, options);} + + /** + * Clones this instance, optionally updating it with the given values. + * + * This is a shallow copy: property arrays are copied, but nested objects + * and URLs are shared with this instance. Dereferencing accessors can cache + * fetched objects in the instance whose accessor is called. Hydrating a + * shared nested object through the clone can affect the original as well, + * and can change JSON-LD output when either is embedded in another + * object. Hydrating a top-level property of the clone does not update this + * instance's property. + * + * To resolve properties without sharing nested objects, use + * {@link Ignore.deepClone} before hydration. + * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) + * for details, including how cached JSON-LD affects serialization. + * + * A clone never inherits a signed JSON-LD representation retained by + * \`signObject()\`: the clone may differ from the document that the proof + * covers, so embedding the original secured JSON in a parent document + * would be wrong. Sign the clone again if it has to be embedded as a + * secured child. + * + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance with its own property arrays. Nested objects + * and URLs are shared with this instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} + + = {}, options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, verifyPortableObject?: PortableObjectVerifier, - } = {}, - ) { - super(values, options);} + } = {} + ): Ignore { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: \$warning is not recognized as a property, but it is. + options = { ...options, \$warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as Ignore; + return clone; + } /** - * Clones this instance, optionally updating it with the given values. + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. * - * This is a shallow copy: property arrays are copied, but nested objects - * and URLs are shared with this instance. Dereferencing accessors can cache - * fetched objects in the instance whose accessor is called. Hydrating a - * shared nested object through the clone can affect the original as well, - * and can change JSON-LD output when either is embedded in another - * object. Hydrating a top-level property of the clone does not update this - * instance's property. + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. - * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) - * for details, including how cached JSON-LD affects serialization. + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. * - * A clone never inherits a signed JSON-LD representation retained by - * \`signObject()\`: the clone may differ from the document that the proof - * covers, so embedding the original secured JSON in a parent document - * would be wrong. Sign the clone again if it has to be embedded as a - * secured child. + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. * - * @param values The values to update the clone with. - * @param options The options to use for cloning. - * @returns The cloned instance with its own property arrays. Nested objects - * and URLs are shared with this instance. + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 */ - override clone( - values: - { + override deepClone(values: +{ id?: URL | null; attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; @@ -77895,26 +86314,21 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - verifyPortableObject?: PortableObjectVerifier, - } = {} - ): Ignore { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - // @ts-ignore: \$warning is not recognized as a property, but it is. - options = { ...options, \$warning: this._warning }; - } - const clone = super.clone(values, options) as unknown as Ignore; - return clone; += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Ignore { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -78298,8 +86712,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Block.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -78360,7 +86774,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Block; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Block { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -78687,13 +87177,13 @@ export class CollectionPage extends Collection { } #_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf: (Collection | URL)[] = []; - #_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf: Set = new Set(); + #_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf: VocabTrustSet = new Set(); #_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next: (CollectionPage | URL)[] = []; - #_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next: Set = new Set(); + #_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next: VocabTrustSet = new Set(); #_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev: (CollectionPage | URL)[] = []; - #_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev: Set = new Set(); + #_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev: VocabTrustSet = new Set(); /** * Constructs a new instance of CollectionPage with the given values. @@ -78781,8 +87271,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link CollectionPage.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -78834,12 +87324,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as CollectionPage;clone.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.slice();clone.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = new Set(this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf); + const clone = super.clone(values, options) as unknown as CollectionPage;clone.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.length < vocabSparseArrayMinimumLength + ? this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.slice() : vocabCopyPropertyArray(this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf);clone.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = vocabCopyTrustSet( + this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf, clone.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf, + ); if (\\"partOf\\" in values && values.partOf != null) { if (values.partOf instanceof Collection || values.partOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = [values.partOf]; - clone.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = new Set([0]); + clone.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = new Set(); + clone.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The partOf must be of type \\" + @@ -78847,12 +87341,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.slice();clone.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = new Set(this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next); + clone.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.length < vocabSparseArrayMinimumLength + ? this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.slice() : vocabCopyPropertyArray(this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next);clone.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = vocabCopyTrustSet( + this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next, clone.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next, + ); if (\\"next\\" in values && values.next != null) { if (values.next instanceof CollectionPage || values.next instanceof URL) { // @ts-ignore: type is checked above. clone.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = [values.next]; - clone.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = new Set([0]); + clone.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = new Set(); + clone.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The next must be of type \\" + @@ -78860,12 +87358,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.slice();clone.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = new Set(this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev); + clone.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.length < vocabSparseArrayMinimumLength + ? this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.slice() : vocabCopyPropertyArray(this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev);clone.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = vocabCopyTrustSet( + this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev, clone.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev, + ); if (\\"prev\\" in values && values.prev != null) { if (values.prev instanceof CollectionPage || values.prev instanceof URL) { // @ts-ignore: type is checked above. clone.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = [values.prev]; - clone.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = new Set([0]); + clone.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = new Set(); + clone.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The prev must be of type \\" + @@ -78876,7 +87378,151 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): CollectionPage { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as CollectionPage; + + { + const array = node.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.length; i++) { + const value = node.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.length; i++) { + const value = node.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.length; i++) { + const value = node.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev[i] = context.value(value); + } + } + } + } +} }); } + async #fetchPartOf( url: URL, options: { @@ -79204,7 +87850,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf[0]; if (!(v instanceof URL) && - !this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.has(0)) { + !(0 < (this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#partOf\\"); @@ -79272,7 +87919,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.has(0)) { + !(0 < (this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -79621,7 +88269,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next[0]; if (!(v instanceof URL) && - !this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.has(0)) { + !(0 < (this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next[vocabTrustPrefix] ?? 0) || + this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#next\\"); @@ -79689,7 +88338,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.has(0)) { + !(0 < (this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next[vocabTrustPrefix] ?? 0) || + this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -80039,7 +88689,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev[0]; if (!(v instanceof URL) && - !this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.has(0)) { + !(0 < (this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev[vocabTrustPrefix] ?? 0) || + this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#prev\\"); @@ -80107,7 +88758,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.has(0)) { + !(0 < (this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev[vocabTrustPrefix] ?? 0) || + this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -80528,7 +89180,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf: (Collection | URL)[] = []; - const _trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf: Set = new Set(); + const _trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf: VocabTrustSet = new Set(); let _2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf__array = values[\\"https://www.w3.org/ns/activitystreams#partOf\\"]; @@ -80569,7 +89221,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = _2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf; const _3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next: (CollectionPage | URL)[] = []; - const _trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next: Set = new Set(); + const _trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next: VocabTrustSet = new Set(); let _3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next__array = values[\\"https://www.w3.org/ns/activitystreams#next\\"]; @@ -80610,7 +89262,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = _3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next; const _3b8yG8tDNzQFFEnWhCc13G8eHooA_prev: (CollectionPage | URL)[] = []; - const _trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev: Set = new Set(); + const _trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev: VocabTrustSet = new Set(); let _3b8yG8tDNzQFFEnWhCc13G8eHooA_prev__array = values[\\"https://www.w3.org/ns/activitystreams#prev\\"]; @@ -80832,8 +89484,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Create.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -80894,7 +89546,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Create; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Create { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -81272,8 +90000,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Delete.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -81334,7 +90062,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Delete; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Delete { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -81710,8 +90514,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Dislike.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -81772,7 +90576,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Dislike; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Dislike { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -82312,8 +91192,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Endpoints.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -82356,7 +91236,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint options ); copyPortableProvenance(this, clone); - clone.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl = this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl.slice(); + clone.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl = this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl.length < vocabSparseArrayMinimumLength + ? this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl.slice() : vocabCopyPropertyArray(this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl); if (\\"proxyUrl\\" in values && values.proxyUrl != null) { if (values.proxyUrl instanceof URL) { // @ts-ignore: type is checked above. @@ -82369,7 +91250,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint ); } } - clone.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint = this.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint.slice(); + clone.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint = this.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint.length < vocabSparseArrayMinimumLength + ? this.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint.slice() : vocabCopyPropertyArray(this.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint); if (\\"oauthAuthorizationEndpoint\\" in values && values.oauthAuthorizationEndpoint != null) { if (values.oauthAuthorizationEndpoint instanceof URL) { // @ts-ignore: type is checked above. @@ -82382,7 +91264,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint ); } } - clone.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint = this.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint.slice(); + clone.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint = this.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint.length < vocabSparseArrayMinimumLength + ? this.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint.slice() : vocabCopyPropertyArray(this.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint); if (\\"oauthTokenEndpoint\\" in values && values.oauthTokenEndpoint != null) { if (values.oauthTokenEndpoint instanceof URL) { // @ts-ignore: type is checked above. @@ -82395,7 +91278,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint ); } } - clone.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey = this.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey.slice(); + clone.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey = this.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey.length < vocabSparseArrayMinimumLength + ? this.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey.slice() : vocabCopyPropertyArray(this.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey); if (\\"provideClientKey\\" in values && values.provideClientKey != null) { if (values.provideClientKey instanceof URL) { // @ts-ignore: type is checked above. @@ -82408,7 +91292,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint ); } } - clone.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey = this.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey.slice(); + clone.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey = this.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey.length < vocabSparseArrayMinimumLength + ? this.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey.slice() : vocabCopyPropertyArray(this.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey); if (\\"signClientKey\\" in values && values.signClientKey != null) { if (values.signClientKey instanceof URL) { // @ts-ignore: type is checked above. @@ -82421,7 +91306,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint ); } } - clone.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox = this.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox.slice(); + clone.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox = this.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox.length < vocabSparseArrayMinimumLength + ? this.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox.slice() : vocabCopyPropertyArray(this.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox); if (\\"sharedInbox\\" in values && values.sharedInbox != null) { if (values.sharedInbox instanceof URL) { // @ts-ignore: type is checked above. @@ -82434,7 +91320,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint ); } } - clone.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia = this.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia.slice(); + clone.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia = this.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia.length < vocabSparseArrayMinimumLength + ? this.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia.slice() : vocabCopyPropertyArray(this.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia); if (\\"uploadMedia\\" in values && values.uploadMedia != null) { if (values.uploadMedia instanceof URL) { // @ts-ignore: type is checked above. @@ -82450,7 +91337,233 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint?: URL | null;provideClientKey?: URL | null;signClientKey?: URL | null;sharedInbox?: URL | null;uploadMedia?: URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Endpoints { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Endpoints; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Endpoints; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl.length; i++) { + const value = node.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl[i] = context.value(value); + } + } + } + } + + { + const array = node.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint.length; i++) { + const value = node.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint[i]; + if (value != null && typeof value === \\"object\\") { + node.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint[i] = context.value(value); + } + } + } + } + + { + const array = node.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint.length; i++) { + const value = node.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint[i]; + if (value != null && typeof value === \\"object\\") { + node.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint[i] = context.value(value); + } + } + } + } + + { + const array = node.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey.length; i++) { + const value = node.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey[i]; + if (value != null && typeof value === \\"object\\") { + node.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey.length; i++) { + const value = node.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox.length; i++) { + const value = node.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia.length; i++) { + const value = node.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia[i]; + if (value != null && typeof value === \\"object\\") { + node.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia[i] = context.value(value); + } + } + } + } +} }); } + /** Endpoint URI so this actor's clients may access remote ActivityStreams * objects which require authentication to access. To use this endpoint, * the client posts an \`x-www-form-urlencoded\` \`id\` parameter with the value @@ -83544,8 +92657,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Event.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -83600,7 +92713,77 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const clone = super.clone(values, options) as unknown as Event; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Event { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -83998,8 +93181,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Flag.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -84060,7 +93243,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Flag; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Flag { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -84440,8 +93699,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Follow.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -84502,7 +93761,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Follow; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Follow { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -84827,39 +94162,39 @@ export class Group extends Object { #_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername: ((string | LanguageString))[] = []; #_axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); #_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); #_hQiaHhZP8hqxckxTBrpsGNs57E3: (URL)[] = []; #_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers: (boolean)[] = []; #_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); #_41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); #_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); #_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); #_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); #_4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); #_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); #_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); #_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); #_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints: (Endpoints)[] = []; #_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable: (boolean)[] = []; #_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended: (boolean)[] = []; @@ -84867,13 +94202,13 @@ export class Group extends Object { #_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable: (boolean)[] = []; #_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); #_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); #_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); #_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage: (string)[] = []; #_2xEU4QtkC53RAun67T81Egqt9vmL_isCat: (boolean)[] = []; #_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense: (URL)[] = []; @@ -84942,10 +94277,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -84978,14 +94337,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; - for (let i = 0; i < values.publicKeys.length; i++) { - this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -85018,14 +94399,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; - for (let i = 0; i < values.assertionMethods.length; i++) { - this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -85058,10 +94461,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -85190,14 +94617,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | if (\\"streams\\" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; - for (let i = 0; i < values.streams.length; i++) { - this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -85308,14 +94757,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; - for (let i = 0; i < values.aliases.length; i++) { - this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -85348,14 +94819,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; - for (let i = 0; i < values.services.length; i++) { - this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -85416,8 +94909,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Group.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -85475,7 +94968,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Group;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice(); + const clone = super.clone(values, options) as unknown as Group;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < vocabSparseArrayMinimumLength + ? this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice() : vocabCopyPropertyArray(this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername); if (\\"preferredUsername\\" in values && values.preferredUsername != null) { if (typeof values.preferredUsername === \\"string\\" || values.preferredUsername instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -85499,10 +94993,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -85511,12 +95029,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice();clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length < vocabSparseArrayMinimumLength + ? this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice() : vocabCopyPropertyArray(this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey);clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = vocabCopyTrustSet( + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, + ); if (\\"publicKey\\" in values && values.publicKey != null) { if (values.publicKey instanceof CryptographicKey || values.publicKey instanceof URL) { // @ts-ignore: type is checked above. clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = [values.publicKey]; - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set([0]); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The publicKey must be of type \\" + @@ -85535,15 +95057,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); - for (let i = 0; i < values.publicKeys.length; i++) { - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -85552,12 +95096,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice();clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length < vocabSparseArrayMinimumLength + ? this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice() : vocabCopyPropertyArray(this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod);clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = vocabCopyTrustSet( + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, + ); if (\\"assertionMethod\\" in values && values.assertionMethod != null) { if (values.assertionMethod instanceof Multikey || values.assertionMethod instanceof URL) { // @ts-ignore: type is checked above. clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = [values.assertionMethod]; - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set([0]); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The assertionMethod must be of type \\" + @@ -85576,15 +95124,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); - for (let i = 0; i < values.assertionMethods.length; i++) { - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -85593,7 +95163,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length < vocabSparseArrayMinimumLength + ? this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice() : vocabCopyPropertyArray(this.#_hQiaHhZP8hqxckxTBrpsGNs57E3); if (\\"gateway\\" in values && values.gateway != null) { if (values.gateway instanceof URL && isGatewayUrl(values.gateway)) { // @ts-ignore: type is checked above. @@ -85617,10 +95188,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -85629,7 +95224,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice(); + clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.length < vocabSparseArrayMinimumLength + ? this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice() : vocabCopyPropertyArray(this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers); if (\\"manuallyApprovesFollowers\\" in values && values.manuallyApprovesFollowers != null) { if (typeof values.manuallyApprovesFollowers === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -85642,12 +95238,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice();clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox); + clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length < vocabSparseArrayMinimumLength + ? this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice() : vocabCopyPropertyArray(this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox);clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = vocabCopyTrustSet( + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, + ); if (\\"inbox\\" in values && values.inbox != null) { if (values.inbox instanceof OrderedCollection || values.inbox instanceof OrderedCollectionPage || values.inbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = [values.inbox]; - clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set([0]); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The inbox must be of type \\" + @@ -85655,12 +95255,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice();clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox); + clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length < vocabSparseArrayMinimumLength + ? this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice() : vocabCopyPropertyArray(this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox);clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = vocabCopyTrustSet( + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, + ); if (\\"outbox\\" in values && values.outbox != null) { if (values.outbox instanceof OrderedCollection || values.outbox instanceof OrderedCollectionPage || values.outbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = [values.outbox]; - clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set([0]); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The outbox must be of type \\" + @@ -85668,12 +95272,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice();clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following); + clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length < vocabSparseArrayMinimumLength + ? this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice() : vocabCopyPropertyArray(this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following);clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = vocabCopyTrustSet( + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, + ); if (\\"following\\" in values && values.following != null) { if (values.following instanceof Collection || values.following instanceof URL) { // @ts-ignore: type is checked above. clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = [values.following]; - clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set([0]); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The following must be of type \\" + @@ -85681,12 +95289,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice();clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers); + clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length < vocabSparseArrayMinimumLength + ? this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice() : vocabCopyPropertyArray(this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers);clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = vocabCopyTrustSet( + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, + ); if (\\"followers\\" in values && values.followers != null) { if (values.followers instanceof Collection || values.followers instanceof URL) { // @ts-ignore: type is checked above. clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = [values.followers]; - clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set([0]); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The followers must be of type \\" + @@ -85694,12 +95306,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice();clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked); + clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length < vocabSparseArrayMinimumLength + ? this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice() : vocabCopyPropertyArray(this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked);clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = vocabCopyTrustSet( + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, + ); if (\\"liked\\" in values && values.liked != null) { if (values.liked instanceof Collection || values.liked instanceof URL) { // @ts-ignore: type is checked above. clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = [values.liked]; - clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set([0]); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The liked must be of type \\" + @@ -85707,12 +95323,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice();clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured); + clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length < vocabSparseArrayMinimumLength + ? this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice() : vocabCopyPropertyArray(this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured);clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = vocabCopyTrustSet( + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, + ); if (\\"featured\\" in values && values.featured != null) { if (values.featured instanceof Collection || values.featured instanceof URL) { // @ts-ignore: type is checked above. clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = [values.featured]; - clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set([0]); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featured must be of type \\" + @@ -85720,12 +95340,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice();clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags); + clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length < vocabSparseArrayMinimumLength + ? this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice() : vocabCopyPropertyArray(this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags);clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = vocabCopyTrustSet( + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, + ); if (\\"featuredTags\\" in values && values.featuredTags != null) { if (values.featuredTags instanceof Collection || values.featuredTags instanceof URL) { // @ts-ignore: type is checked above. clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = [values.featuredTags]; - clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set([0]); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredTags must be of type \\" + @@ -85733,12 +95357,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice();clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections); + clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length < vocabSparseArrayMinimumLength + ? this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice() : vocabCopyPropertyArray(this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections);clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = vocabCopyTrustSet( + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, + ); if (\\"featuredCollections\\" in values && values.featuredCollections != null) { if (values.featuredCollections instanceof Collection || values.featuredCollections instanceof URL) { // @ts-ignore: type is checked above. clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = [values.featuredCollections]; - clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set([0]); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredCollections must be of type \\" + @@ -85746,18 +95374,43 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice();clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length < vocabSparseArrayMinimumLength + ? this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice() : vocabCopyPropertyArray(this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams);clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = vocabCopyTrustSet( + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, + ); if (\\"streams\\" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(); - for (let i = 0; i < values.streams.length; i++) { - clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -85766,7 +95419,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice(); + clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length < vocabSparseArrayMinimumLength + ? this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice() : vocabCopyPropertyArray(this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints); if (\\"endpoints\\" in values && values.endpoints != null) { if (values.endpoints instanceof Endpoints) { // @ts-ignore: type is checked above. @@ -85779,7 +95433,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice(); + clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length < vocabSparseArrayMinimumLength + ? this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice() : vocabCopyPropertyArray(this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable); if (\\"discoverable\\" in values && values.discoverable != null) { if (typeof values.discoverable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -85792,7 +95447,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice(); + clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.length < vocabSparseArrayMinimumLength + ? this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice() : vocabCopyPropertyArray(this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended); if (\\"suspended\\" in values && values.suspended != null) { if (typeof values.suspended === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -85805,7 +95461,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice(); + clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.length < vocabSparseArrayMinimumLength + ? this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice() : vocabCopyPropertyArray(this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial); if (\\"memorial\\" in values && values.memorial != null) { if (typeof values.memorial === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -85818,7 +95475,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice(); + clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.length < vocabSparseArrayMinimumLength + ? this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice() : vocabCopyPropertyArray(this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable); if (\\"indexable\\" in values && values.indexable != null) { if (typeof values.indexable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -85831,12 +95489,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice();clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo); + clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length < vocabSparseArrayMinimumLength + ? this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice() : vocabCopyPropertyArray(this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo);clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = vocabCopyTrustSet( + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, + ); if (\\"successor\\" in values && values.successor != null) { if (values.successor instanceof Application || values.successor instanceof Group || values.successor instanceof Organization || values.successor instanceof Person || values.successor instanceof Service || values.successor instanceof URL) { // @ts-ignore: type is checked above. clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = [values.successor]; - clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set([0]); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The successor must be of type \\" + @@ -85844,12 +95506,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice();clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length < vocabSparseArrayMinimumLength + ? this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice() : vocabCopyPropertyArray(this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs);clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = vocabCopyTrustSet( + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, + ); if (\\"alias\\" in values && values.alias != null) { if (values.alias instanceof Application || values.alias instanceof Group || values.alias instanceof Organization || values.alias instanceof Person || values.alias instanceof Service || values.alias instanceof URL) { // @ts-ignore: type is checked above. clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = [values.alias]; - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set([0]); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The alias must be of type \\" + @@ -85868,15 +95534,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); - for (let i = 0; i < values.aliases.length; i++) { - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -85885,12 +95573,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice();clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length < vocabSparseArrayMinimumLength + ? this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice() : vocabCopyPropertyArray(this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service);clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = vocabCopyTrustSet( + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, + ); if (\\"service\\" in values && values.service != null) { if (values.service instanceof DidService || values.service instanceof URL) { // @ts-ignore: type is checked above. clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = [values.service]; - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set([0]); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The service must be of type \\" + @@ -85909,15 +95601,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); - for (let i = 0; i < values.services.length; i++) { - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -85926,7 +95640,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice(); + clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.length < vocabSparseArrayMinimumLength + ? this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice() : vocabCopyPropertyArray(this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage); if (\\"followedMessage\\" in values && values.followedMessage != null) { if (typeof values.followedMessage === \\"string\\") { // @ts-ignore: type is checked above. @@ -85939,7 +95654,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice(); + clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.length < vocabSparseArrayMinimumLength + ? this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice() : vocabCopyPropertyArray(this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat); if (\\"cat\\" in values && values.cat != null) { if (typeof values.cat === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -85952,7 +95668,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice(); + clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length < vocabSparseArrayMinimumLength + ? this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice() : vocabCopyPropertyArray(this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense); if (\\"preferredLicense\\" in values && values.preferredLicense != null) { if (values.preferredLicense instanceof URL) { // @ts-ignore: type is checked above. @@ -85968,7 +95685,465 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];preferredUsername?: string | LanguageString | null; +preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; +publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; +assertionMethods?: (Multikey | URL)[];gateway?: URL | null; +gateways?: (URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;featuredCollections?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; +aliases?: (Application | Group | Organization | Person | Service | URL)[];service?: DidService | URL | null; +services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | null;preferredLicense?: URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Group { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Group; + + { + const array = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length; i++) { + const value = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i]; + if (value != null && typeof value === \\"object\\") { + node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length; i++) { + const value = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i] = context.value(value); + } + } + } + } + + { + const array = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length; i++) { + const value = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i]; + if (value != null && typeof value === \\"object\\") { + node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length; i++) { + const value = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length; i++) { + const value = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length; i++) { + const value = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i] = context.value(value); + } + } + } + } + + { + const array = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length; i++) { + const value = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i]; + if (value != null && typeof value === \\"object\\") { + node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length; i++) { + const value = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length; i++) { + const value = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length; i++) { + const value = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i] = context.value(value); + } + } + } + } + + { + const array = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length; i++) { + const value = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i]; + if (value != null && typeof value === \\"object\\") { + node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length; i++) { + const value = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i] = context.value(value); + } + } + } + } + + { + const array = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length; i++) { + const value = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i]; + if (value != null && typeof value === \\"object\\") { + node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length; i++) { + const value = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length; i++) { + const value = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length; i++) { + const value = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i] = context.value(value); + } + } + } + } + + { + const array = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length; i++) { + const value = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i]; + if (value != null && typeof value === \\"object\\") { + node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i] = context.value(value); + } + } + } + } +} }); } + /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. * @@ -86317,7 +96492,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[0]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#publicKey\\"); @@ -86385,7 +96561,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -86472,7 +96649,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#publicKey\\"); @@ -86544,7 +96722,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -86898,7 +97077,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#assertionMethod\\"); @@ -86966,7 +97146,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -87057,7 +97238,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#assertionMethod\\"); @@ -87129,7 +97311,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -87553,7 +97736,8 @@ get gateways(): (URL)[] { } let v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0]; if (!(v instanceof URL) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://www.w3.org/ns/ldp#inbox\\"); @@ -87621,7 +97805,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -87995,7 +98180,8 @@ get gateways(): (URL)[] { } let v = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[0]; if (!(v instanceof URL) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#outbox\\"); @@ -88063,7 +98249,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -88417,7 +98604,8 @@ get gateways(): (URL)[] { } let v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0]; if (!(v instanceof URL) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#following\\"); @@ -88485,7 +98673,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -88842,7 +99031,8 @@ get gateways(): (URL)[] { } let v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0]; if (!(v instanceof URL) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#followers\\"); @@ -88910,7 +99100,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -89265,7 +99456,8 @@ get gateways(): (URL)[] { } let v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0]; if (!(v instanceof URL) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#liked\\"); @@ -89333,7 +99525,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -89686,7 +99879,8 @@ get gateways(): (URL)[] { } let v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[0]; if (!(v instanceof URL) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://joinmastodon.org/ns#featured\\"); @@ -89754,7 +99948,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -90107,7 +100302,8 @@ get gateways(): (URL)[] { } let v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0]; if (!(v instanceof URL) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://joinmastodon.org/ns#featuredTags\\"); @@ -90175,7 +100371,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -90525,7 +100722,8 @@ get gateways(): (URL)[] { } let v = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[0]; if (!(v instanceof URL) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/7aa9#featuredCollections\\"); @@ -90593,7 +100791,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -90943,7 +101142,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#streams\\"); @@ -91015,7 +101215,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -91500,7 +101701,8 @@ get gateways(): (URL)[] { } let v = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0]; if (!(v instanceof URL) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#movedTo\\"); @@ -91568,7 +101770,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -91981,7 +102184,8 @@ get gateways(): (URL)[] { } let v = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"); @@ -92049,7 +102253,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -92140,7 +102345,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"); @@ -92212,7 +102418,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -92566,7 +102773,8 @@ get gateways(): (URL)[] { } let v = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/did#service\\"); @@ -92634,7 +102842,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -92725,7 +102934,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/did#service\\"); @@ -92797,7 +103007,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -94196,7 +104407,7 @@ get gateways(): (URL)[] { instance.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; const _axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); let _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array = values[\\"https://w3id.org/security#publicKey\\"]; @@ -94237,7 +104448,7 @@ get gateways(): (URL)[] { instance.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = _axq166E2eZADq34V4MYUc8KMZdC_publicKey; const _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); let _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array = values[\\"https://w3id.org/security#assertionMethod\\"]; @@ -94336,7 +104547,7 @@ get gateways(): (URL)[] { instance.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers; const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); let _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array = values[\\"http://www.w3.org/ns/ldp#inbox\\"]; @@ -94383,7 +104594,7 @@ get gateways(): (URL)[] { instance.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; const _41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); let _41QwhqJouoLg3h8dRPKat21brynC_outbox__array = values[\\"https://www.w3.org/ns/activitystreams#outbox\\"]; @@ -94430,7 +104641,7 @@ get gateways(): (URL)[] { instance.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = _41QwhqJouoLg3h8dRPKat21brynC_outbox; const _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); let _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array = values[\\"https://www.w3.org/ns/activitystreams#following\\"]; @@ -94471,7 +104682,7 @@ get gateways(): (URL)[] { instance.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; const _BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); let _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array = values[\\"https://www.w3.org/ns/activitystreams#followers\\"]; @@ -94512,7 +104723,7 @@ get gateways(): (URL)[] { instance.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = _BBCTgfphhsFzpVfKTykGSpBNwoA_followers; const _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); let _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array = values[\\"https://www.w3.org/ns/activitystreams#liked\\"]; @@ -94553,7 +104764,7 @@ get gateways(): (URL)[] { instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; const _4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); let _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array = values[\\"http://joinmastodon.org/ns#featured\\"]; @@ -94594,7 +104805,7 @@ get gateways(): (URL)[] { instance.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = _4N1vBJzXDf8NbBumeECQMFvKetja_featured; const _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); let _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array = values[\\"http://joinmastodon.org/ns#featuredTags\\"]; @@ -94635,7 +104846,7 @@ get gateways(): (URL)[] { instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; const _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); let _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections__array = values[\\"https://w3id.org/fep/7aa9#featuredCollections\\"]; @@ -94676,7 +104887,7 @@ get gateways(): (URL)[] { instance.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); let _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array = values[\\"https://www.w3.org/ns/activitystreams#streams\\"]; @@ -94865,7 +105076,7 @@ get gateways(): (URL)[] { instance.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable; const _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); let _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array = values[\\"https://www.w3.org/ns/activitystreams#movedTo\\"]; @@ -94923,7 +105134,7 @@ get gateways(): (URL)[] { instance.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; const _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); let _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array = values[\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"]; @@ -94981,7 +105192,7 @@ get gateways(): (URL)[] { instance.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; const _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); let _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array = values[\\"https://www.w3.org/ns/did#service\\"]; @@ -95801,7 +106012,7 @@ export class Link { #_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width: (number)[] = []; #_gCVTegXxWWCw6wWRxa1QF65zusg_preview: (Link | Object | URL)[] = []; - #_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: Set = new Set(); + #_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: VocabTrustSet = new Set(); #_2rzkBRS4gNPrkJk9DohHAMUAxA2d: (URL)[] = []; /** @@ -95880,10 +106091,34 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } - if (Array.isArray(values.rels) && - values.rels.every(v => typeof v === \\"string\\")) { + let copied!: (string)[]; + let valid = false; + if (Array.isArray(values.rels)) { + const array = values.rels; + const test = (v: string): boolean => typeof v === \\"string\\"; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.rels; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel = values.rels.slice(); + this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel = copied; } else { throw new TypeError( @@ -95942,10 +106177,34 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } - if (Array.isArray(values.names) && - values.names.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.names)) { + const array = values.names; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.names; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = values.names.slice(); + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = copied; } else { throw new TypeError( @@ -95996,14 +106255,36 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num if (\\"previews\\" in values && values.previews != null) { - if (Array.isArray(values.previews) && - values.previews.every(v => v instanceof Link || v instanceof Object || v instanceof URL)) { + let copied!: (Link | Object | URL)[]; + let valid = false; + if (Array.isArray(values.previews)) { + const array = values.previews; + const test = (v: Link | Object | URL): boolean => v instanceof Link || v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.previews; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = values.previews.slice(); + this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = copied; - for (let i = 0; i < values.previews.length; i++) { - this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.add(i); - } + vocabSetTrustPrefix(this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length); } else { throw new TypeError( @@ -96015,10 +106296,34 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num if (\\"licenses\\" in values && values.licenses != null) { - if (Array.isArray(values.licenses) && - values.licenses.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.licenses)) { + const array = values.licenses; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.licenses; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = values.licenses.slice(); + this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = copied; } else { throw new TypeError( @@ -96040,8 +106345,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Link.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -96086,7 +106391,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num options ); copyPortableProvenance(this, clone); - clone.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href = this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href.slice(); + clone.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href = this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href.length < vocabSparseArrayMinimumLength + ? this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href.slice() : vocabCopyPropertyArray(this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href); if (\\"href\\" in values && values.href != null) { if (values.href instanceof URL) { // @ts-ignore: type is checked above. @@ -96099,7 +106405,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel = this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel.slice(); + clone.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel = this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel.length < vocabSparseArrayMinimumLength + ? this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel.slice() : vocabCopyPropertyArray(this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel); if (\\"rel\\" in values && values.rel != null) { if (typeof values.rel === \\"string\\") { // @ts-ignore: type is checked above. @@ -96123,10 +106430,34 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } - if (Array.isArray(values.rels) && - values.rels.every(v => typeof v === \\"string\\")) { + let copied!: (string)[]; + let valid = false; + if (Array.isArray(values.rels)) { + const array = values.rels; + const test = (v: string): boolean => typeof v === \\"string\\"; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.rels; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel = values.rels.slice(); + clone.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel = copied; } else { throw new TypeError( @@ -96135,7 +106466,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.slice(); + clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.length < vocabSparseArrayMinimumLength + ? this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.slice() : vocabCopyPropertyArray(this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType); if (\\"mediaType\\" in values && values.mediaType != null) { if (typeof values.mediaType === \\"string\\") { // @ts-ignore: type is checked above. @@ -96148,7 +106480,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase = this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase.slice(); + clone.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase = this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase.length < vocabSparseArrayMinimumLength + ? this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase.slice() : vocabCopyPropertyArray(this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase); if (\\"digestMultibase\\" in values && values.digestMultibase != null) { if (typeof values.digestMultibase === \\"string\\") { // @ts-ignore: type is checked above. @@ -96161,7 +106494,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.slice(); + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length < vocabSparseArrayMinimumLength + ? this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.slice() : vocabCopyPropertyArray(this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name); if (\\"name\\" in values && values.name != null) { if (typeof values.name === \\"string\\" || values.name instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -96185,10 +106519,34 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } - if (Array.isArray(values.names) && - values.names.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.names)) { + const array = values.names; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.names; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = values.names.slice(); + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = copied; } else { throw new TypeError( @@ -96197,7 +106555,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang = this.#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang.slice(); + clone.#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang = this.#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang.length < vocabSparseArrayMinimumLength + ? this.#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang.slice() : vocabCopyPropertyArray(this.#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang); if (\\"language\\" in values && values.language != null) { if (values.language instanceof Intl.Locale) { // @ts-ignore: type is checked above. @@ -96210,7 +106569,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.slice(); + clone.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.length < vocabSparseArrayMinimumLength + ? this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.slice() : vocabCopyPropertyArray(this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height); if (\\"height\\" in values && values.height != null) { if (typeof values.height === \\"number\\" && Number.isInteger(values.height) && values.height >= 0) { // @ts-ignore: type is checked above. @@ -96223,7 +106583,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.slice(); + clone.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.length < vocabSparseArrayMinimumLength + ? this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.slice() : vocabCopyPropertyArray(this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width); if (\\"width\\" in values && values.width != null) { if (typeof values.width === \\"number\\" && Number.isInteger(values.width) && values.width >= 0) { // @ts-ignore: type is checked above. @@ -96236,18 +106597,43 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.slice();clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = new Set(this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview); + clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length < vocabSparseArrayMinimumLength + ? this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.slice() : vocabCopyPropertyArray(this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview);clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = vocabCopyTrustSet( + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, + ); if (\\"previews\\" in values && values.previews != null) { - if (Array.isArray(values.previews) && - values.previews.every(v => v instanceof Link || v instanceof Object || v instanceof URL)) { + let copied!: (Link | Object | URL)[]; + let valid = false; + if (Array.isArray(values.previews)) { + const array = values.previews; + const test = (v: Link | Object | URL): boolean => v instanceof Link || v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.previews; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = values.previews.slice(); + clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = copied; clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = new Set(); - for (let i = 0; i < values.previews.length; i++) { - clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.add(i); - } + vocabSetTrustPrefix(clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length); } else { throw new TypeError( @@ -96256,13 +106642,38 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.slice(); + clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.length < vocabSparseArrayMinimumLength + ? this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.slice() : vocabCopyPropertyArray(this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d); if (\\"licenses\\" in values && values.licenses != null) { - if (Array.isArray(values.licenses) && - values.licenses.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.licenses)) { + const array = values.licenses; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.licenses; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = values.licenses.slice(); + clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = copied; } else { throw new TypeError( @@ -96274,7 +106685,147 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +href?: URL | null;rel?: string | null; +rels?: (string)[];mediaType?: string | null;digestMultibase?: string | null;name?: string | LanguageString | null; +names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: number | null;width?: number | null;previews?: (Link | Object | URL)[];licenses?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Link { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Link; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Link; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href.length; i++) { + const value = node.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href[i]; + if (value != null && typeof value === \\"object\\") { + node.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href[i] = context.value(value); + } + } + } + } + + { + const array = node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length; i++) { + const value = node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview[i]; + if (value != null && typeof value === \\"object\\") { + node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.length; i++) { + const value = node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d[i] = context.value(value); + } + } + } + } +} }); } + /** The target resource pointed to by a {@link Link}. */ get href(): (URL | null) { @@ -96760,7 +107311,8 @@ get names(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i)) { + !(i < (this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview[vocabTrustPrefix] ?? 0) || + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#preview\\"); @@ -96832,7 +107384,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i)) { + !(i < (this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview[vocabTrustPrefix] ?? 0) || + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -97751,7 +108304,7 @@ get licenses(): (URL)[] { instance.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = _2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width; const _gCVTegXxWWCw6wWRxa1QF65zusg_preview: (Link | Object | URL)[] = []; - const _trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: Set = new Set(); + const _trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: VocabTrustSet = new Set(); let _gCVTegXxWWCw6wWRxa1QF65zusg_preview__array = values[\\"https://www.w3.org/ns/activitystreams#preview\\"]; @@ -98171,8 +108724,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Hashtag.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -98213,7 +108766,63 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num const clone = super.clone(values, options) as unknown as Hashtag; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +href?: URL | null;rel?: string | null; +rels?: (string)[];mediaType?: string | null;digestMultibase?: string | null;name?: string | LanguageString | null; +names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: number | null;width?: number | null;previews?: (Link | Object | URL)[];licenses?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Hashtag { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -98591,8 +109200,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Image.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -98647,7 +109256,77 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const clone = super.clone(values, options) as unknown as Image; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];width?: number | null;height?: number | null;digestMultibase?: string | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Image { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -99045,8 +109724,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Offer.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -99088,26 +109767,102 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - verifyPortableObject?: PortableObjectVerifier, - } = {} - ): Offer { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - // @ts-ignore: \$warning is not recognized as a property, but it is. - options = { ...options, \$warning: this._warning }; - } - const clone = super.clone(values, options) as unknown as Offer; - return clone; + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {} + ): Offer { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: \$warning is not recognized as a property, but it is. + options = { ...options, \$warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as Offer; + return clone; + } + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Offer { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -99489,8 +110244,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Invite.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -99551,7 +110306,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Invite; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Invite { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -99929,8 +110760,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Join.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -99991,7 +110822,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Join; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Join { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -100369,8 +111276,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Leave.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -100431,7 +111338,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Leave; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Leave { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -100809,8 +111792,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Like.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -100871,7 +111854,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Like; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Like { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -101247,8 +112306,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Listen.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -101309,7 +112368,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Listen; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Listen { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -101665,8 +112800,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Mention.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -101707,7 +112842,63 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num const clone = super.clone(values, options) as unknown as Mention; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +href?: URL | null;rel?: string | null; +rels?: (string)[];mediaType?: string | null;digestMultibase?: string | null;name?: string | LanguageString | null; +names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: number | null;width?: number | null;previews?: (Link | Object | URL)[];licenses?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Mention { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -102094,8 +113285,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Move.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -102137,26 +113328,102 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - verifyPortableObject?: PortableObjectVerifier, - } = {} - ): Move { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - // @ts-ignore: \$warning is not recognized as a property, but it is. - options = { ...options, \$warning: this._warning }; - } - const clone = super.clone(values, options) as unknown as Move; - return clone; + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {} + ): Move { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: \$warning is not recognized as a property, but it is. + options = { ...options, \$warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as Move; + return clone; + } + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Move { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -102482,11 +113749,11 @@ export class Note extends Object { } #_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); #_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; #_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); /** * Constructs a new instance of Note with the given values. @@ -102574,8 +113841,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Note.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -102627,12 +113894,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Note;clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice();clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote); + const clone = super.clone(values, options) as unknown as Note;clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length < vocabSparseArrayMinimumLength + ? this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice() : vocabCopyPropertyArray(this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote);clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = vocabCopyTrustSet( + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, + ); if (\\"quote\\" in values && values.quote != null) { if (values.quote instanceof Object || values.quote instanceof URL) { // @ts-ignore: type is checked above. clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = [values.quote]; - clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set([0]); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The quote must be of type \\" + @@ -102640,7 +113911,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice(); + clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length < vocabSparseArrayMinimumLength + ? this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice() : vocabCopyPropertyArray(this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl); if (\\"quoteUrl\\" in values && values.quoteUrl != null) { if (values.quoteUrl instanceof URL) { // @ts-ignore: type is checked above. @@ -102653,12 +113925,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice();clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization); + clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice() : vocabCopyPropertyArray(this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization);clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = vocabCopyTrustSet( + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, + ); if (\\"quoteAuthorization\\" in values && values.quoteAuthorization != null) { if (values.quoteAuthorization instanceof QuoteAuthorization || values.quoteAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = [values.quoteAuthorization]; - clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set([0]); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The quoteAuthorization must be of type \\" + @@ -102669,7 +113945,151 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];quote?: Object | URL | null;quoteUrl?: URL | null;quoteAuthorization?: QuoteAuthorization | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Note { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Note; + + { + const array = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length; i++) { + const value = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i] = context.value(value); + } + } + } + } + + { + const array = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length; i++) { + const value = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i]; + if (value != null && typeof value === \\"object\\") { + node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i] = context.value(value); + } + } + } + } + + { + const array = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length; i++) { + const value = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i]; + if (value != null && typeof value === \\"object\\") { + node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i] = context.value(value); + } + } + } + } +} }); } + async #fetchQuote( url: URL, options: { @@ -102998,7 +114418,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[0]; if (!(v instanceof URL) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/044f#quote\\"); @@ -103066,7 +114487,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -103440,7 +114862,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/044f#quoteAuthorization\\"); @@ -103508,7 +114931,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -103935,7 +115359,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); let _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote__array = values[\\"https://w3id.org/fep/044f#quote\\"]; @@ -104015,7 +115439,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; const _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); let _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization__array = values[\\"https://w3id.org/fep/044f#quoteAuthorization\\"]; @@ -104188,7 +115612,7 @@ export class OrderedCollectionPage extends CollectionPage { } #_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: (Object | Link | URL)[] = []; - #_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: Set = new Set(); + #_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: VocabTrustSet = new Set(); #_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex: (number)[] = []; /** @@ -104228,14 +115652,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu super(values, options); if (\\"items\\" in values && values.items != null) { - if (Array.isArray(values.items) && - values.items.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.items)) { + const array = values.items; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.items; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = values.items.slice(); + this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = copied; - for (let i = 0; i < values.items.length; i++) { - this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.add(i); - } + vocabSetTrustPrefix(this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length); } else { throw new TypeError( @@ -104270,8 +115716,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link OrderedCollectionPage.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -104323,18 +115769,43 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as OrderedCollectionPage;clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.slice();clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = new Set(this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items); + const clone = super.clone(values, options) as unknown as OrderedCollectionPage;clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length < vocabSparseArrayMinimumLength + ? this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.slice() : vocabCopyPropertyArray(this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items);clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = vocabCopyTrustSet( + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, + ); if (\\"items\\" in values && values.items != null) { - if (Array.isArray(values.items) && - values.items.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.items)) { + const array = values.items; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.items; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = values.items.slice(); + clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = copied; clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = new Set(); - for (let i = 0; i < values.items.length; i++) { - clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length); } else { throw new TypeError( @@ -104343,7 +115814,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex = this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex.slice(); + clone.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex = this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex.length < vocabSparseArrayMinimumLength + ? this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex.slice() : vocabCopyPropertyArray(this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex); if (\\"startIndex\\" in values && values.startIndex != null) { if (typeof values.startIndex === \\"number\\" && Number.isInteger(values.startIndex) && values.startIndex >= 0) { // @ts-ignore: type is checked above. @@ -104359,7 +115831,107 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;items?: (Object | Link | URL)[];startIndex?: number | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): OrderedCollectionPage { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as OrderedCollectionPage; + + { + const array = node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length; i++) { + const value = node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[i] = context.value(value); + } + } + } + } +} }); } + async #fetchItem( url: URL, options: { @@ -104702,7 +116274,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i)) { + !(i < (this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[vocabTrustPrefix] ?? 0) || + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#items\\"); @@ -104774,7 +116347,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i)) { + !(i < (this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[vocabTrustPrefix] ?? 0) || + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -105167,7 +116741,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: (Object | Link | URL)[] = []; - const _trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: Set = new Set(); + const _trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: VocabTrustSet = new Set(); let _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items__array = values[\\"https://www.w3.org/ns/activitystreams#items\\"]; @@ -105356,39 +116930,39 @@ export class Organization extends Object { #_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername: ((string | LanguageString))[] = []; #_axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); #_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); #_hQiaHhZP8hqxckxTBrpsGNs57E3: (URL)[] = []; #_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers: (boolean)[] = []; #_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); #_41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); #_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); #_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); #_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); #_4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); #_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); #_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); #_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); #_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints: (Endpoints)[] = []; #_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable: (boolean)[] = []; #_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended: (boolean)[] = []; @@ -105396,13 +116970,13 @@ export class Organization extends Object { #_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable: (boolean)[] = []; #_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); #_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); #_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); #_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage: (string)[] = []; #_2xEU4QtkC53RAun67T81Egqt9vmL_isCat: (boolean)[] = []; #_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense: (URL)[] = []; @@ -105471,10 +117045,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -105507,14 +117105,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; - for (let i = 0; i < values.publicKeys.length; i++) { - this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -105547,14 +117167,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; - for (let i = 0; i < values.assertionMethods.length; i++) { - this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -105587,10 +117229,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -105719,14 +117385,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | if (\\"streams\\" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; - for (let i = 0; i < values.streams.length; i++) { - this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -105837,14 +117525,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; - for (let i = 0; i < values.aliases.length; i++) { - this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -105877,14 +117587,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; - for (let i = 0; i < values.services.length; i++) { - this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -105945,8 +117677,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Organization.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -106004,7 +117736,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Organization;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice(); + const clone = super.clone(values, options) as unknown as Organization;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < vocabSparseArrayMinimumLength + ? this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice() : vocabCopyPropertyArray(this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername); if (\\"preferredUsername\\" in values && values.preferredUsername != null) { if (typeof values.preferredUsername === \\"string\\" || values.preferredUsername instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -106028,10 +117761,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -106040,12 +117797,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice();clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length < vocabSparseArrayMinimumLength + ? this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice() : vocabCopyPropertyArray(this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey);clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = vocabCopyTrustSet( + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, + ); if (\\"publicKey\\" in values && values.publicKey != null) { if (values.publicKey instanceof CryptographicKey || values.publicKey instanceof URL) { // @ts-ignore: type is checked above. clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = [values.publicKey]; - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set([0]); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The publicKey must be of type \\" + @@ -106064,15 +117825,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); - for (let i = 0; i < values.publicKeys.length; i++) { - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -106081,12 +117864,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice();clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length < vocabSparseArrayMinimumLength + ? this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice() : vocabCopyPropertyArray(this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod);clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = vocabCopyTrustSet( + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, + ); if (\\"assertionMethod\\" in values && values.assertionMethod != null) { if (values.assertionMethod instanceof Multikey || values.assertionMethod instanceof URL) { // @ts-ignore: type is checked above. clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = [values.assertionMethod]; - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set([0]); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The assertionMethod must be of type \\" + @@ -106105,15 +117892,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); - for (let i = 0; i < values.assertionMethods.length; i++) { - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -106122,7 +117931,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length < vocabSparseArrayMinimumLength + ? this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice() : vocabCopyPropertyArray(this.#_hQiaHhZP8hqxckxTBrpsGNs57E3); if (\\"gateway\\" in values && values.gateway != null) { if (values.gateway instanceof URL && isGatewayUrl(values.gateway)) { // @ts-ignore: type is checked above. @@ -106146,10 +117956,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -106158,7 +117992,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice(); + clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.length < vocabSparseArrayMinimumLength + ? this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice() : vocabCopyPropertyArray(this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers); if (\\"manuallyApprovesFollowers\\" in values && values.manuallyApprovesFollowers != null) { if (typeof values.manuallyApprovesFollowers === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -106171,12 +118006,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice();clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox); + clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length < vocabSparseArrayMinimumLength + ? this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice() : vocabCopyPropertyArray(this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox);clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = vocabCopyTrustSet( + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, + ); if (\\"inbox\\" in values && values.inbox != null) { if (values.inbox instanceof OrderedCollection || values.inbox instanceof OrderedCollectionPage || values.inbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = [values.inbox]; - clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set([0]); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The inbox must be of type \\" + @@ -106184,12 +118023,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice();clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox); + clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length < vocabSparseArrayMinimumLength + ? this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice() : vocabCopyPropertyArray(this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox);clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = vocabCopyTrustSet( + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, + ); if (\\"outbox\\" in values && values.outbox != null) { if (values.outbox instanceof OrderedCollection || values.outbox instanceof OrderedCollectionPage || values.outbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = [values.outbox]; - clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set([0]); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The outbox must be of type \\" + @@ -106197,12 +118040,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice();clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following); + clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length < vocabSparseArrayMinimumLength + ? this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice() : vocabCopyPropertyArray(this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following);clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = vocabCopyTrustSet( + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, + ); if (\\"following\\" in values && values.following != null) { if (values.following instanceof Collection || values.following instanceof URL) { // @ts-ignore: type is checked above. clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = [values.following]; - clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set([0]); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The following must be of type \\" + @@ -106210,12 +118057,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice();clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers); + clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length < vocabSparseArrayMinimumLength + ? this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice() : vocabCopyPropertyArray(this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers);clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = vocabCopyTrustSet( + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, + ); if (\\"followers\\" in values && values.followers != null) { if (values.followers instanceof Collection || values.followers instanceof URL) { // @ts-ignore: type is checked above. clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = [values.followers]; - clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set([0]); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The followers must be of type \\" + @@ -106223,12 +118074,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice();clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked); + clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length < vocabSparseArrayMinimumLength + ? this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice() : vocabCopyPropertyArray(this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked);clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = vocabCopyTrustSet( + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, + ); if (\\"liked\\" in values && values.liked != null) { if (values.liked instanceof Collection || values.liked instanceof URL) { // @ts-ignore: type is checked above. clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = [values.liked]; - clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set([0]); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The liked must be of type \\" + @@ -106236,12 +118091,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice();clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured); + clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length < vocabSparseArrayMinimumLength + ? this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice() : vocabCopyPropertyArray(this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured);clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = vocabCopyTrustSet( + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, + ); if (\\"featured\\" in values && values.featured != null) { if (values.featured instanceof Collection || values.featured instanceof URL) { // @ts-ignore: type is checked above. clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = [values.featured]; - clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set([0]); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featured must be of type \\" + @@ -106249,12 +118108,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice();clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags); + clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length < vocabSparseArrayMinimumLength + ? this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice() : vocabCopyPropertyArray(this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags);clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = vocabCopyTrustSet( + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, + ); if (\\"featuredTags\\" in values && values.featuredTags != null) { if (values.featuredTags instanceof Collection || values.featuredTags instanceof URL) { // @ts-ignore: type is checked above. clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = [values.featuredTags]; - clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set([0]); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredTags must be of type \\" + @@ -106262,12 +118125,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice();clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections); + clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length < vocabSparseArrayMinimumLength + ? this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice() : vocabCopyPropertyArray(this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections);clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = vocabCopyTrustSet( + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, + ); if (\\"featuredCollections\\" in values && values.featuredCollections != null) { if (values.featuredCollections instanceof Collection || values.featuredCollections instanceof URL) { // @ts-ignore: type is checked above. clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = [values.featuredCollections]; - clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set([0]); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredCollections must be of type \\" + @@ -106275,18 +118142,43 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice();clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length < vocabSparseArrayMinimumLength + ? this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice() : vocabCopyPropertyArray(this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams);clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = vocabCopyTrustSet( + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, + ); if (\\"streams\\" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(); - for (let i = 0; i < values.streams.length; i++) { - clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -106295,7 +118187,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice(); + clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length < vocabSparseArrayMinimumLength + ? this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice() : vocabCopyPropertyArray(this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints); if (\\"endpoints\\" in values && values.endpoints != null) { if (values.endpoints instanceof Endpoints) { // @ts-ignore: type is checked above. @@ -106308,7 +118201,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice(); + clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length < vocabSparseArrayMinimumLength + ? this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice() : vocabCopyPropertyArray(this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable); if (\\"discoverable\\" in values && values.discoverable != null) { if (typeof values.discoverable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -106321,7 +118215,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice(); + clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.length < vocabSparseArrayMinimumLength + ? this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice() : vocabCopyPropertyArray(this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended); if (\\"suspended\\" in values && values.suspended != null) { if (typeof values.suspended === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -106334,7 +118229,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice(); + clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.length < vocabSparseArrayMinimumLength + ? this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice() : vocabCopyPropertyArray(this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial); if (\\"memorial\\" in values && values.memorial != null) { if (typeof values.memorial === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -106347,7 +118243,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice(); + clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.length < vocabSparseArrayMinimumLength + ? this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice() : vocabCopyPropertyArray(this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable); if (\\"indexable\\" in values && values.indexable != null) { if (typeof values.indexable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -106360,12 +118257,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice();clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo); + clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length < vocabSparseArrayMinimumLength + ? this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice() : vocabCopyPropertyArray(this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo);clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = vocabCopyTrustSet( + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, + ); if (\\"successor\\" in values && values.successor != null) { if (values.successor instanceof Application || values.successor instanceof Group || values.successor instanceof Organization || values.successor instanceof Person || values.successor instanceof Service || values.successor instanceof URL) { // @ts-ignore: type is checked above. clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = [values.successor]; - clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set([0]); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The successor must be of type \\" + @@ -106373,12 +118274,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice();clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length < vocabSparseArrayMinimumLength + ? this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice() : vocabCopyPropertyArray(this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs);clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = vocabCopyTrustSet( + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, + ); if (\\"alias\\" in values && values.alias != null) { if (values.alias instanceof Application || values.alias instanceof Group || values.alias instanceof Organization || values.alias instanceof Person || values.alias instanceof Service || values.alias instanceof URL) { // @ts-ignore: type is checked above. clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = [values.alias]; - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set([0]); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The alias must be of type \\" + @@ -106397,15 +118302,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); - for (let i = 0; i < values.aliases.length; i++) { - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -106414,12 +118341,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice();clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length < vocabSparseArrayMinimumLength + ? this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice() : vocabCopyPropertyArray(this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service);clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = vocabCopyTrustSet( + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, + ); if (\\"service\\" in values && values.service != null) { if (values.service instanceof DidService || values.service instanceof URL) { // @ts-ignore: type is checked above. clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = [values.service]; - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set([0]); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The service must be of type \\" + @@ -106438,15 +118369,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); - for (let i = 0; i < values.services.length; i++) { - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -106455,7 +118408,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice(); + clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.length < vocabSparseArrayMinimumLength + ? this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice() : vocabCopyPropertyArray(this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage); if (\\"followedMessage\\" in values && values.followedMessage != null) { if (typeof values.followedMessage === \\"string\\") { // @ts-ignore: type is checked above. @@ -106468,7 +118422,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice(); + clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.length < vocabSparseArrayMinimumLength + ? this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice() : vocabCopyPropertyArray(this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat); if (\\"cat\\" in values && values.cat != null) { if (typeof values.cat === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -106481,7 +118436,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice(); + clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length < vocabSparseArrayMinimumLength + ? this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice() : vocabCopyPropertyArray(this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense); if (\\"preferredLicense\\" in values && values.preferredLicense != null) { if (values.preferredLicense instanceof URL) { // @ts-ignore: type is checked above. @@ -106497,7 +118453,465 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];preferredUsername?: string | LanguageString | null; +preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; +publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; +assertionMethods?: (Multikey | URL)[];gateway?: URL | null; +gateways?: (URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;featuredCollections?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; +aliases?: (Application | Group | Organization | Person | Service | URL)[];service?: DidService | URL | null; +services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | null;preferredLicense?: URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Organization { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Organization; + + { + const array = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length; i++) { + const value = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i]; + if (value != null && typeof value === \\"object\\") { + node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length; i++) { + const value = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i] = context.value(value); + } + } + } + } + + { + const array = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length; i++) { + const value = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i]; + if (value != null && typeof value === \\"object\\") { + node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length; i++) { + const value = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length; i++) { + const value = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length; i++) { + const value = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i] = context.value(value); + } + } + } + } + + { + const array = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length; i++) { + const value = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i]; + if (value != null && typeof value === \\"object\\") { + node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length; i++) { + const value = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length; i++) { + const value = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length; i++) { + const value = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i] = context.value(value); + } + } + } + } + + { + const array = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length; i++) { + const value = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i]; + if (value != null && typeof value === \\"object\\") { + node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length; i++) { + const value = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i] = context.value(value); + } + } + } + } + + { + const array = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length; i++) { + const value = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i]; + if (value != null && typeof value === \\"object\\") { + node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length; i++) { + const value = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length; i++) { + const value = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length; i++) { + const value = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i] = context.value(value); + } + } + } + } + + { + const array = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length; i++) { + const value = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i]; + if (value != null && typeof value === \\"object\\") { + node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i] = context.value(value); + } + } + } + } +} }); } + /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. * @@ -106846,7 +119260,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[0]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#publicKey\\"); @@ -106914,7 +119329,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -107001,7 +119417,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#publicKey\\"); @@ -107073,7 +119490,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -107427,7 +119845,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#assertionMethod\\"); @@ -107495,7 +119914,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -107586,7 +120006,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#assertionMethod\\"); @@ -107658,7 +120079,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -108082,7 +120504,8 @@ get gateways(): (URL)[] { } let v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0]; if (!(v instanceof URL) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://www.w3.org/ns/ldp#inbox\\"); @@ -108150,7 +120573,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -108524,7 +120948,8 @@ get gateways(): (URL)[] { } let v = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[0]; if (!(v instanceof URL) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#outbox\\"); @@ -108592,7 +121017,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -108946,7 +121372,8 @@ get gateways(): (URL)[] { } let v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0]; if (!(v instanceof URL) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#following\\"); @@ -109014,7 +121441,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -109371,7 +121799,8 @@ get gateways(): (URL)[] { } let v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0]; if (!(v instanceof URL) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#followers\\"); @@ -109439,7 +121868,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -109794,7 +122224,8 @@ get gateways(): (URL)[] { } let v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0]; if (!(v instanceof URL) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#liked\\"); @@ -109862,7 +122293,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -110215,7 +122647,8 @@ get gateways(): (URL)[] { } let v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[0]; if (!(v instanceof URL) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://joinmastodon.org/ns#featured\\"); @@ -110283,7 +122716,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -110636,7 +123070,8 @@ get gateways(): (URL)[] { } let v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0]; if (!(v instanceof URL) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://joinmastodon.org/ns#featuredTags\\"); @@ -110704,7 +123139,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -111054,7 +123490,8 @@ get gateways(): (URL)[] { } let v = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[0]; if (!(v instanceof URL) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/7aa9#featuredCollections\\"); @@ -111122,7 +123559,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -111472,7 +123910,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#streams\\"); @@ -111544,7 +123983,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -112029,7 +124469,8 @@ get gateways(): (URL)[] { } let v = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0]; if (!(v instanceof URL) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#movedTo\\"); @@ -112097,7 +124538,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -112510,7 +124952,8 @@ get gateways(): (URL)[] { } let v = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"); @@ -112578,7 +125021,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -112669,7 +125113,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"); @@ -112741,7 +125186,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -113095,7 +125541,8 @@ get gateways(): (URL)[] { } let v = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/did#service\\"); @@ -113163,7 +125610,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -113254,7 +125702,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/did#service\\"); @@ -113326,7 +125775,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -114725,7 +127175,7 @@ get gateways(): (URL)[] { instance.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; const _axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); let _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array = values[\\"https://w3id.org/security#publicKey\\"]; @@ -114766,7 +127216,7 @@ get gateways(): (URL)[] { instance.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = _axq166E2eZADq34V4MYUc8KMZdC_publicKey; const _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); let _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array = values[\\"https://w3id.org/security#assertionMethod\\"]; @@ -114865,7 +127315,7 @@ get gateways(): (URL)[] { instance.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers; const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); let _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array = values[\\"http://www.w3.org/ns/ldp#inbox\\"]; @@ -114912,7 +127362,7 @@ get gateways(): (URL)[] { instance.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; const _41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); let _41QwhqJouoLg3h8dRPKat21brynC_outbox__array = values[\\"https://www.w3.org/ns/activitystreams#outbox\\"]; @@ -114959,7 +127409,7 @@ get gateways(): (URL)[] { instance.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = _41QwhqJouoLg3h8dRPKat21brynC_outbox; const _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); let _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array = values[\\"https://www.w3.org/ns/activitystreams#following\\"]; @@ -115000,7 +127450,7 @@ get gateways(): (URL)[] { instance.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; const _BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); let _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array = values[\\"https://www.w3.org/ns/activitystreams#followers\\"]; @@ -115041,7 +127491,7 @@ get gateways(): (URL)[] { instance.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = _BBCTgfphhsFzpVfKTykGSpBNwoA_followers; const _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); let _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array = values[\\"https://www.w3.org/ns/activitystreams#liked\\"]; @@ -115082,7 +127532,7 @@ get gateways(): (URL)[] { instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; const _4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); let _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array = values[\\"http://joinmastodon.org/ns#featured\\"]; @@ -115123,7 +127573,7 @@ get gateways(): (URL)[] { instance.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = _4N1vBJzXDf8NbBumeECQMFvKetja_featured; const _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); let _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array = values[\\"http://joinmastodon.org/ns#featuredTags\\"]; @@ -115164,7 +127614,7 @@ get gateways(): (URL)[] { instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; const _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); let _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections__array = values[\\"https://w3id.org/fep/7aa9#featuredCollections\\"]; @@ -115205,7 +127655,7 @@ get gateways(): (URL)[] { instance.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); let _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array = values[\\"https://www.w3.org/ns/activitystreams#streams\\"]; @@ -115394,7 +127844,7 @@ get gateways(): (URL)[] { instance.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable; const _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); let _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array = values[\\"https://www.w3.org/ns/activitystreams#movedTo\\"]; @@ -115452,7 +127902,7 @@ get gateways(): (URL)[] { instance.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; const _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); let _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array = values[\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"]; @@ -115510,7 +127960,7 @@ get gateways(): (URL)[] { instance.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; const _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); let _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array = values[\\"https://www.w3.org/ns/did#service\\"]; @@ -116291,8 +128741,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Page.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -116347,7 +128797,77 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const clone = super.clone(values, options) as unknown as Page; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];width?: number | null;height?: number | null;digestMultibase?: string | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Page { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -116691,39 +129211,39 @@ export class Person extends Object { #_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername: ((string | LanguageString))[] = []; #_axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); #_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); #_hQiaHhZP8hqxckxTBrpsGNs57E3: (URL)[] = []; #_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers: (boolean)[] = []; #_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); #_41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); #_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); #_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); #_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); #_4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); #_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); #_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); #_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); #_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints: (Endpoints)[] = []; #_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable: (boolean)[] = []; #_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended: (boolean)[] = []; @@ -116731,13 +129251,13 @@ export class Person extends Object { #_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable: (boolean)[] = []; #_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); #_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); #_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); #_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage: (string)[] = []; #_2xEU4QtkC53RAun67T81Egqt9vmL_isCat: (boolean)[] = []; #_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense: (URL)[] = []; @@ -116806,10 +129326,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -116842,14 +129386,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; - for (let i = 0; i < values.publicKeys.length; i++) { - this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -116882,14 +129448,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; - for (let i = 0; i < values.assertionMethods.length; i++) { - this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -116922,10 +129510,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -117054,14 +129666,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | if (\\"streams\\" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; - for (let i = 0; i < values.streams.length; i++) { - this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -117172,14 +129806,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; - for (let i = 0; i < values.aliases.length; i++) { - this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -117212,14 +129868,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; - for (let i = 0; i < values.services.length; i++) { - this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -117280,8 +129958,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Person.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -117339,7 +130017,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Person;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice(); + const clone = super.clone(values, options) as unknown as Person;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < vocabSparseArrayMinimumLength + ? this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice() : vocabCopyPropertyArray(this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername); if (\\"preferredUsername\\" in values && values.preferredUsername != null) { if (typeof values.preferredUsername === \\"string\\" || values.preferredUsername instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -117363,10 +130042,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -117375,12 +130078,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice();clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length < vocabSparseArrayMinimumLength + ? this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice() : vocabCopyPropertyArray(this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey);clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = vocabCopyTrustSet( + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, + ); if (\\"publicKey\\" in values && values.publicKey != null) { if (values.publicKey instanceof CryptographicKey || values.publicKey instanceof URL) { // @ts-ignore: type is checked above. clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = [values.publicKey]; - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set([0]); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The publicKey must be of type \\" + @@ -117399,15 +130106,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); - for (let i = 0; i < values.publicKeys.length; i++) { - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -117416,12 +130145,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice();clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length < vocabSparseArrayMinimumLength + ? this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice() : vocabCopyPropertyArray(this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod);clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = vocabCopyTrustSet( + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, + ); if (\\"assertionMethod\\" in values && values.assertionMethod != null) { if (values.assertionMethod instanceof Multikey || values.assertionMethod instanceof URL) { // @ts-ignore: type is checked above. clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = [values.assertionMethod]; - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set([0]); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The assertionMethod must be of type \\" + @@ -117440,15 +130173,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); - for (let i = 0; i < values.assertionMethods.length; i++) { - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -117457,7 +130212,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length < vocabSparseArrayMinimumLength + ? this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice() : vocabCopyPropertyArray(this.#_hQiaHhZP8hqxckxTBrpsGNs57E3); if (\\"gateway\\" in values && values.gateway != null) { if (values.gateway instanceof URL && isGatewayUrl(values.gateway)) { // @ts-ignore: type is checked above. @@ -117481,10 +130237,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -117493,7 +130273,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice(); + clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.length < vocabSparseArrayMinimumLength + ? this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice() : vocabCopyPropertyArray(this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers); if (\\"manuallyApprovesFollowers\\" in values && values.manuallyApprovesFollowers != null) { if (typeof values.manuallyApprovesFollowers === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -117506,12 +130287,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice();clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox); + clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length < vocabSparseArrayMinimumLength + ? this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice() : vocabCopyPropertyArray(this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox);clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = vocabCopyTrustSet( + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, + ); if (\\"inbox\\" in values && values.inbox != null) { if (values.inbox instanceof OrderedCollection || values.inbox instanceof OrderedCollectionPage || values.inbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = [values.inbox]; - clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set([0]); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The inbox must be of type \\" + @@ -117519,12 +130304,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice();clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox); + clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length < vocabSparseArrayMinimumLength + ? this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice() : vocabCopyPropertyArray(this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox);clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = vocabCopyTrustSet( + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, + ); if (\\"outbox\\" in values && values.outbox != null) { if (values.outbox instanceof OrderedCollection || values.outbox instanceof OrderedCollectionPage || values.outbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = [values.outbox]; - clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set([0]); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The outbox must be of type \\" + @@ -117532,12 +130321,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice();clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following); + clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length < vocabSparseArrayMinimumLength + ? this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice() : vocabCopyPropertyArray(this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following);clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = vocabCopyTrustSet( + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, + ); if (\\"following\\" in values && values.following != null) { if (values.following instanceof Collection || values.following instanceof URL) { // @ts-ignore: type is checked above. clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = [values.following]; - clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set([0]); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The following must be of type \\" + @@ -117545,12 +130338,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice();clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers); + clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length < vocabSparseArrayMinimumLength + ? this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice() : vocabCopyPropertyArray(this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers);clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = vocabCopyTrustSet( + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, + ); if (\\"followers\\" in values && values.followers != null) { if (values.followers instanceof Collection || values.followers instanceof URL) { // @ts-ignore: type is checked above. clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = [values.followers]; - clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set([0]); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The followers must be of type \\" + @@ -117558,12 +130355,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice();clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked); + clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length < vocabSparseArrayMinimumLength + ? this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice() : vocabCopyPropertyArray(this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked);clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = vocabCopyTrustSet( + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, + ); if (\\"liked\\" in values && values.liked != null) { if (values.liked instanceof Collection || values.liked instanceof URL) { // @ts-ignore: type is checked above. clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = [values.liked]; - clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set([0]); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The liked must be of type \\" + @@ -117571,12 +130372,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice();clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured); + clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length < vocabSparseArrayMinimumLength + ? this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice() : vocabCopyPropertyArray(this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured);clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = vocabCopyTrustSet( + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, + ); if (\\"featured\\" in values && values.featured != null) { if (values.featured instanceof Collection || values.featured instanceof URL) { // @ts-ignore: type is checked above. clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = [values.featured]; - clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set([0]); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featured must be of type \\" + @@ -117584,12 +130389,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice();clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags); + clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length < vocabSparseArrayMinimumLength + ? this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice() : vocabCopyPropertyArray(this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags);clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = vocabCopyTrustSet( + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, + ); if (\\"featuredTags\\" in values && values.featuredTags != null) { if (values.featuredTags instanceof Collection || values.featuredTags instanceof URL) { // @ts-ignore: type is checked above. clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = [values.featuredTags]; - clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set([0]); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredTags must be of type \\" + @@ -117597,12 +130406,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice();clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections); + clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length < vocabSparseArrayMinimumLength + ? this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice() : vocabCopyPropertyArray(this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections);clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = vocabCopyTrustSet( + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, + ); if (\\"featuredCollections\\" in values && values.featuredCollections != null) { if (values.featuredCollections instanceof Collection || values.featuredCollections instanceof URL) { // @ts-ignore: type is checked above. clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = [values.featuredCollections]; - clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set([0]); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredCollections must be of type \\" + @@ -117610,18 +130423,43 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice();clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length < vocabSparseArrayMinimumLength + ? this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice() : vocabCopyPropertyArray(this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams);clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = vocabCopyTrustSet( + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, + ); if (\\"streams\\" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(); - for (let i = 0; i < values.streams.length; i++) { - clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -117630,7 +130468,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice(); + clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length < vocabSparseArrayMinimumLength + ? this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice() : vocabCopyPropertyArray(this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints); if (\\"endpoints\\" in values && values.endpoints != null) { if (values.endpoints instanceof Endpoints) { // @ts-ignore: type is checked above. @@ -117643,7 +130482,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice(); + clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length < vocabSparseArrayMinimumLength + ? this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice() : vocabCopyPropertyArray(this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable); if (\\"discoverable\\" in values && values.discoverable != null) { if (typeof values.discoverable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -117656,7 +130496,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice(); + clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.length < vocabSparseArrayMinimumLength + ? this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice() : vocabCopyPropertyArray(this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended); if (\\"suspended\\" in values && values.suspended != null) { if (typeof values.suspended === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -117669,7 +130510,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice(); + clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.length < vocabSparseArrayMinimumLength + ? this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice() : vocabCopyPropertyArray(this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial); if (\\"memorial\\" in values && values.memorial != null) { if (typeof values.memorial === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -117682,7 +130524,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice(); + clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.length < vocabSparseArrayMinimumLength + ? this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice() : vocabCopyPropertyArray(this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable); if (\\"indexable\\" in values && values.indexable != null) { if (typeof values.indexable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -117695,12 +130538,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice();clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo); + clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length < vocabSparseArrayMinimumLength + ? this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice() : vocabCopyPropertyArray(this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo);clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = vocabCopyTrustSet( + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, + ); if (\\"successor\\" in values && values.successor != null) { if (values.successor instanceof Application || values.successor instanceof Group || values.successor instanceof Organization || values.successor instanceof Person || values.successor instanceof Service || values.successor instanceof URL) { // @ts-ignore: type is checked above. clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = [values.successor]; - clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set([0]); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The successor must be of type \\" + @@ -117708,12 +130555,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice();clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length < vocabSparseArrayMinimumLength + ? this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice() : vocabCopyPropertyArray(this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs);clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = vocabCopyTrustSet( + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, + ); if (\\"alias\\" in values && values.alias != null) { if (values.alias instanceof Application || values.alias instanceof Group || values.alias instanceof Organization || values.alias instanceof Person || values.alias instanceof Service || values.alias instanceof URL) { // @ts-ignore: type is checked above. clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = [values.alias]; - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set([0]); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The alias must be of type \\" + @@ -117732,15 +130583,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); - for (let i = 0; i < values.aliases.length; i++) { - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -117749,12 +130622,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice();clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length < vocabSparseArrayMinimumLength + ? this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice() : vocabCopyPropertyArray(this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service);clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = vocabCopyTrustSet( + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, + ); if (\\"service\\" in values && values.service != null) { if (values.service instanceof DidService || values.service instanceof URL) { // @ts-ignore: type is checked above. clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = [values.service]; - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set([0]); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The service must be of type \\" + @@ -117773,15 +130650,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); - for (let i = 0; i < values.services.length; i++) { - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -117790,7 +130689,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice(); + clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.length < vocabSparseArrayMinimumLength + ? this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice() : vocabCopyPropertyArray(this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage); if (\\"followedMessage\\" in values && values.followedMessage != null) { if (typeof values.followedMessage === \\"string\\") { // @ts-ignore: type is checked above. @@ -117803,7 +130703,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice(); + clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.length < vocabSparseArrayMinimumLength + ? this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice() : vocabCopyPropertyArray(this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat); if (\\"cat\\" in values && values.cat != null) { if (typeof values.cat === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -117816,7 +130717,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice(); + clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length < vocabSparseArrayMinimumLength + ? this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice() : vocabCopyPropertyArray(this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense); if (\\"preferredLicense\\" in values && values.preferredLicense != null) { if (values.preferredLicense instanceof URL) { // @ts-ignore: type is checked above. @@ -117832,7 +130734,465 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];preferredUsername?: string | LanguageString | null; +preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; +publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; +assertionMethods?: (Multikey | URL)[];gateway?: URL | null; +gateways?: (URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;featuredCollections?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; +aliases?: (Application | Group | Organization | Person | Service | URL)[];service?: DidService | URL | null; +services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | null;preferredLicense?: URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Person { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Person; + + { + const array = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length; i++) { + const value = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i]; + if (value != null && typeof value === \\"object\\") { + node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length; i++) { + const value = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i] = context.value(value); + } + } + } + } + + { + const array = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length; i++) { + const value = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i]; + if (value != null && typeof value === \\"object\\") { + node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length; i++) { + const value = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length; i++) { + const value = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length; i++) { + const value = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i] = context.value(value); + } + } + } + } + + { + const array = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length; i++) { + const value = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i]; + if (value != null && typeof value === \\"object\\") { + node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length; i++) { + const value = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length; i++) { + const value = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length; i++) { + const value = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i] = context.value(value); + } + } + } + } + + { + const array = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length; i++) { + const value = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i]; + if (value != null && typeof value === \\"object\\") { + node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length; i++) { + const value = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i] = context.value(value); + } + } + } + } + + { + const array = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length; i++) { + const value = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i]; + if (value != null && typeof value === \\"object\\") { + node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length; i++) { + const value = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length; i++) { + const value = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length; i++) { + const value = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i] = context.value(value); + } + } + } + } + + { + const array = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length; i++) { + const value = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i]; + if (value != null && typeof value === \\"object\\") { + node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i] = context.value(value); + } + } + } + } +} }); } + /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. * @@ -118181,7 +131541,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[0]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#publicKey\\"); @@ -118249,7 +131610,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -118336,7 +131698,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#publicKey\\"); @@ -118408,7 +131771,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -118762,7 +132126,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#assertionMethod\\"); @@ -118830,7 +132195,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -118921,7 +132287,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#assertionMethod\\"); @@ -118993,7 +132360,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -119417,7 +132785,8 @@ get gateways(): (URL)[] { } let v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0]; if (!(v instanceof URL) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://www.w3.org/ns/ldp#inbox\\"); @@ -119485,7 +132854,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -119859,7 +133229,8 @@ get gateways(): (URL)[] { } let v = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[0]; if (!(v instanceof URL) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#outbox\\"); @@ -119927,7 +133298,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -120281,7 +133653,8 @@ get gateways(): (URL)[] { } let v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0]; if (!(v instanceof URL) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#following\\"); @@ -120349,7 +133722,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -120706,7 +134080,8 @@ get gateways(): (URL)[] { } let v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0]; if (!(v instanceof URL) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#followers\\"); @@ -120774,7 +134149,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -121129,7 +134505,8 @@ get gateways(): (URL)[] { } let v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0]; if (!(v instanceof URL) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#liked\\"); @@ -121197,7 +134574,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -121550,7 +134928,8 @@ get gateways(): (URL)[] { } let v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[0]; if (!(v instanceof URL) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://joinmastodon.org/ns#featured\\"); @@ -121618,7 +134997,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -121971,7 +135351,8 @@ get gateways(): (URL)[] { } let v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0]; if (!(v instanceof URL) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://joinmastodon.org/ns#featuredTags\\"); @@ -122039,7 +135420,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -122389,7 +135771,8 @@ get gateways(): (URL)[] { } let v = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[0]; if (!(v instanceof URL) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/7aa9#featuredCollections\\"); @@ -122457,7 +135840,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -122807,7 +136191,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#streams\\"); @@ -122879,7 +136264,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -123364,7 +136750,8 @@ get gateways(): (URL)[] { } let v = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0]; if (!(v instanceof URL) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#movedTo\\"); @@ -123432,7 +136819,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -123845,7 +137233,8 @@ get gateways(): (URL)[] { } let v = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"); @@ -123913,7 +137302,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -124004,7 +137394,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"); @@ -124076,7 +137467,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -124430,7 +137822,8 @@ get gateways(): (URL)[] { } let v = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/did#service\\"); @@ -124498,7 +137891,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -124589,7 +137983,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/did#service\\"); @@ -124661,7 +138056,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -126060,7 +139456,7 @@ get gateways(): (URL)[] { instance.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; const _axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); let _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array = values[\\"https://w3id.org/security#publicKey\\"]; @@ -126101,7 +139497,7 @@ get gateways(): (URL)[] { instance.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = _axq166E2eZADq34V4MYUc8KMZdC_publicKey; const _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); let _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array = values[\\"https://w3id.org/security#assertionMethod\\"]; @@ -126200,7 +139596,7 @@ get gateways(): (URL)[] { instance.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers; const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); let _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array = values[\\"http://www.w3.org/ns/ldp#inbox\\"]; @@ -126247,7 +139643,7 @@ get gateways(): (URL)[] { instance.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; const _41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); let _41QwhqJouoLg3h8dRPKat21brynC_outbox__array = values[\\"https://www.w3.org/ns/activitystreams#outbox\\"]; @@ -126294,7 +139690,7 @@ get gateways(): (URL)[] { instance.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = _41QwhqJouoLg3h8dRPKat21brynC_outbox; const _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); let _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array = values[\\"https://www.w3.org/ns/activitystreams#following\\"]; @@ -126335,7 +139731,7 @@ get gateways(): (URL)[] { instance.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; const _BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); let _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array = values[\\"https://www.w3.org/ns/activitystreams#followers\\"]; @@ -126376,7 +139772,7 @@ get gateways(): (URL)[] { instance.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = _BBCTgfphhsFzpVfKTykGSpBNwoA_followers; const _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); let _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array = values[\\"https://www.w3.org/ns/activitystreams#liked\\"]; @@ -126417,7 +139813,7 @@ get gateways(): (URL)[] { instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; const _4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); let _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array = values[\\"http://joinmastodon.org/ns#featured\\"]; @@ -126458,7 +139854,7 @@ get gateways(): (URL)[] { instance.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = _4N1vBJzXDf8NbBumeECQMFvKetja_featured; const _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); let _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array = values[\\"http://joinmastodon.org/ns#featuredTags\\"]; @@ -126499,7 +139895,7 @@ get gateways(): (URL)[] { instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; const _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); let _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections__array = values[\\"https://w3id.org/fep/7aa9#featuredCollections\\"]; @@ -126540,7 +139936,7 @@ get gateways(): (URL)[] { instance.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); let _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array = values[\\"https://www.w3.org/ns/activitystreams#streams\\"]; @@ -126729,7 +140125,7 @@ get gateways(): (URL)[] { instance.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable; const _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); let _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array = values[\\"https://www.w3.org/ns/activitystreams#movedTo\\"]; @@ -126787,7 +140183,7 @@ get gateways(): (URL)[] { instance.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; const _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); let _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array = values[\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"]; @@ -126845,7 +140241,7 @@ get gateways(): (URL)[] { instance.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; const _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); let _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array = values[\\"https://www.w3.org/ns/did#service\\"]; @@ -127713,8 +141109,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Place.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -127766,7 +141162,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Place;clone.#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy = this.#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy.slice(); + const clone = super.clone(values, options) as unknown as Place;clone.#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy = this.#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy.length < vocabSparseArrayMinimumLength + ? this.#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy.slice() : vocabCopyPropertyArray(this.#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy); if (\\"accuracy\\" in values && values.accuracy != null) { if (typeof values.accuracy === \\"number\\" && !Number.isNaN(values.accuracy)) { // @ts-ignore: type is checked above. @@ -127779,7 +141176,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude = this.#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude.slice(); + clone.#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude = this.#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude.length < vocabSparseArrayMinimumLength + ? this.#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude.slice() : vocabCopyPropertyArray(this.#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude); if (\\"altitude\\" in values && values.altitude != null) { if (typeof values.altitude === \\"number\\" && !Number.isNaN(values.altitude)) { // @ts-ignore: type is checked above. @@ -127792,7 +141190,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude = this.#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude.slice(); + clone.#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude = this.#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude.length < vocabSparseArrayMinimumLength + ? this.#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude.slice() : vocabCopyPropertyArray(this.#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude); if (\\"latitude\\" in values && values.latitude != null) { if (typeof values.latitude === \\"number\\" && !Number.isNaN(values.latitude)) { // @ts-ignore: type is checked above. @@ -127805,7 +141204,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude = this.#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude.slice(); + clone.#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude = this.#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude.length < vocabSparseArrayMinimumLength + ? this.#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude.slice() : vocabCopyPropertyArray(this.#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude); if (\\"longitude\\" in values && values.longitude != null) { if (typeof values.longitude === \\"number\\" && !Number.isNaN(values.longitude)) { // @ts-ignore: type is checked above. @@ -127818,7 +141218,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius = this.#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius.slice(); + clone.#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius = this.#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius.length < vocabSparseArrayMinimumLength + ? this.#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius.slice() : vocabCopyPropertyArray(this.#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius); if (\\"radius\\" in values && values.radius != null) { if (typeof values.radius === \\"number\\" && !Number.isNaN(values.radius)) { // @ts-ignore: type is checked above. @@ -127831,7 +141232,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units = this.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units.slice(); + clone.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units = this.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units.length < vocabSparseArrayMinimumLength + ? this.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units.slice() : vocabCopyPropertyArray(this.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units); if (\\"units\\" in values && values.units != null) { if (values.units == \\"cm\\" || values.units == \\"feet\\" || values.units == \\"inches\\" || values.units == \\"km\\" || values.units == \\"m\\" || values.units == \\"miles\\" || values.units instanceof URL) { // @ts-ignore: type is checked above. @@ -127847,7 +141249,107 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];accuracy?: number | null;altitude?: number | null;latitude?: number | null;longitude?: number | null;radius?: number | null;units?: \\"cm\\" | \\"feet\\" | \\"inches\\" | \\"km\\" | \\"m\\" | \\"miles\\" | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Place { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Place; + + { + const array = node.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units.length; i++) { + const value = node.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units[i]; + if (value != null && typeof value === \\"object\\") { + node.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units[i] = context.value(value); + } + } + } + } +} }); } + /** Indicates the accuracy of position coordinates on a {@link Place} objects. * Expressed in properties of percentage. e.g. \\"94.0\\" means \\"94.0% accurate\\". * @@ -128813,7 +142315,7 @@ export class Profile extends Object { } #_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes: (Object | URL)[] = []; - #_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes: Set = new Set(); + #_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes: VocabTrustSet = new Set(); /** * Constructs a new instance of Profile with the given values. @@ -128875,8 +142377,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Profile.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -128928,12 +142430,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Profile;clone.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = this.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.slice();clone.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = new Set(this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes); + const clone = super.clone(values, options) as unknown as Profile;clone.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = this.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.length < vocabSparseArrayMinimumLength + ? this.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.slice() : vocabCopyPropertyArray(this.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes);clone.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = vocabCopyTrustSet( + this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes, clone.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes, + ); if (\\"describes\\" in values && values.describes != null) { if (values.describes instanceof Object || values.describes instanceof URL) { // @ts-ignore: type is checked above. clone.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = [values.describes]; - clone.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = new Set([0]); + clone.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = new Set(); + clone.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The describes must be of type \\" + @@ -128944,7 +142450,107 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];describes?: Object | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Profile { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Profile; + + { + const array = node.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.length; i++) { + const value = node.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes[i] = context.value(value); + } + } + } + } +} }); } + async #fetchDescribes( url: URL, options: { @@ -129272,7 +142878,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes[0]; if (!(v instanceof URL) && - !this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.has(0)) { + !(0 < (this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes[vocabTrustPrefix] ?? 0) || + this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#describes\\"); @@ -129340,7 +142947,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.has(0)) { + !(0 < (this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes[vocabTrustPrefix] ?? 0) || + this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -129677,7 +143285,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes: (Object | URL)[] = []; - const _trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes: Set = new Set(); + const _trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes: VocabTrustSet = new Set(); let _3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes__array = values[\\"https://www.w3.org/ns/activitystreams#describes\\"]; @@ -129815,19 +143423,19 @@ export class Question extends IntransitiveActivity { } #_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf: (Object | URL)[] = []; - #_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf: Set = new Set(); + #_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf: VocabTrustSet = new Set(); #_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf: (Object | URL)[] = []; - #_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf: Set = new Set(); + #_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf: VocabTrustSet = new Set(); #_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed: ((Temporal.Instant | boolean))[] = []; #_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount: (number)[] = []; #_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); #_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; #_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); /** * Constructs a new instance of Question with the given values. @@ -129872,14 +143480,36 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti super(values, options); if (\\"exclusiveOptions\\" in values && values.exclusiveOptions != null) { - if (Array.isArray(values.exclusiveOptions) && - values.exclusiveOptions.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.exclusiveOptions)) { + const array = values.exclusiveOptions; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.exclusiveOptions; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = values.exclusiveOptions.slice(); + this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = copied; - for (let i = 0; i < values.exclusiveOptions.length; i++) { - this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.add(i); - } + vocabSetTrustPrefix(this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf, this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.length); } else { throw new TypeError( @@ -129891,14 +143521,36 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti if (\\"inclusiveOptions\\" in values && values.inclusiveOptions != null) { - if (Array.isArray(values.inclusiveOptions) && - values.inclusiveOptions.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.inclusiveOptions)) { + const array = values.inclusiveOptions; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.inclusiveOptions; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = values.inclusiveOptions.slice(); + this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = copied; - for (let i = 0; i < values.inclusiveOptions.length; i++) { - this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.add(i); - } + vocabSetTrustPrefix(this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf, this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.length); } else { throw new TypeError( @@ -129985,8 +143637,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Question.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -130044,18 +143696,43 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Question;clone.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.slice();clone.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = new Set(this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf); + const clone = super.clone(values, options) as unknown as Question;clone.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.length < vocabSparseArrayMinimumLength + ? this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.slice() : vocabCopyPropertyArray(this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf);clone.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = vocabCopyTrustSet( + this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf, clone.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf, + ); if (\\"exclusiveOptions\\" in values && values.exclusiveOptions != null) { - if (Array.isArray(values.exclusiveOptions) && - values.exclusiveOptions.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.exclusiveOptions)) { + const array = values.exclusiveOptions; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.exclusiveOptions; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = values.exclusiveOptions.slice(); + clone.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = copied; clone.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = new Set(); - for (let i = 0; i < values.exclusiveOptions.length; i++) { - clone.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf, clone.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.length); } else { throw new TypeError( @@ -130064,18 +143741,43 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti ); } } - clone.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.slice();clone.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = new Set(this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf); + clone.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.length < vocabSparseArrayMinimumLength + ? this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.slice() : vocabCopyPropertyArray(this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf);clone.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = vocabCopyTrustSet( + this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf, clone.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf, + ); if (\\"inclusiveOptions\\" in values && values.inclusiveOptions != null) { - if (Array.isArray(values.inclusiveOptions) && - values.inclusiveOptions.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.inclusiveOptions)) { + const array = values.inclusiveOptions; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.inclusiveOptions; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = values.inclusiveOptions.slice(); + clone.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = copied; clone.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = new Set(); - for (let i = 0; i < values.inclusiveOptions.length; i++) { - clone.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf, clone.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.length); } else { throw new TypeError( @@ -130084,7 +143786,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti ); } } - clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed.slice(); + clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed.length < vocabSparseArrayMinimumLength + ? this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed.slice() : vocabCopyPropertyArray(this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed); if (\\"closed\\" in values && values.closed != null) { if (isTemporalInstant(values.closed) || typeof values.closed === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -130097,7 +143800,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti ); } } - clone.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount = this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount.slice(); + clone.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount = this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount.length < vocabSparseArrayMinimumLength + ? this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount.slice() : vocabCopyPropertyArray(this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount); if (\\"voters\\" in values && values.voters != null) { if (typeof values.voters === \\"number\\" && Number.isInteger(values.voters) && values.voters >= 0) { // @ts-ignore: type is checked above. @@ -130110,12 +143814,16 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti ); } } - clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice();clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote); + clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length < vocabSparseArrayMinimumLength + ? this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice() : vocabCopyPropertyArray(this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote);clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = vocabCopyTrustSet( + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, + ); if (\\"quote\\" in values && values.quote != null) { if (values.quote instanceof Object || values.quote instanceof URL) { // @ts-ignore: type is checked above. clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = [values.quote]; - clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set([0]); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The quote must be of type \\" + @@ -130123,7 +143831,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti ); } } - clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice(); + clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length < vocabSparseArrayMinimumLength + ? this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice() : vocabCopyPropertyArray(this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl); if (\\"quoteUrl\\" in values && values.quoteUrl != null) { if (values.quoteUrl instanceof URL) { // @ts-ignore: type is checked above. @@ -130136,12 +143845,16 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti ); } } - clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice();clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization); + clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice() : vocabCopyPropertyArray(this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization);clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = vocabCopyTrustSet( + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, + ); if (\\"quoteAuthorization\\" in values && values.quoteAuthorization != null) { if (values.quoteAuthorization instanceof QuoteAuthorization || values.quoteAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = [values.quoteAuthorization]; - clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set([0]); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The quoteAuthorization must be of type \\" + @@ -130152,7 +143865,201 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOptions?: (Object | URL)[];closed?: Temporal.Instant | boolean | null;voters?: number | null;quote?: Object | URL | null;quoteUrl?: URL | null;quoteAuthorization?: QuoteAuthorization | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Question { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Question; + + { + const array = node.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.length; i++) { + const value = node.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.length; i++) { + const value = node.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length; i++) { + const value = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i] = context.value(value); + } + } + } + } + + { + const array = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length; i++) { + const value = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i]; + if (value != null && typeof value === \\"object\\") { + node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i] = context.value(value); + } + } + } + } + + { + const array = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length; i++) { + const value = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i]; + if (value != null && typeof value === \\"object\\") { + node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i] = context.value(value); + } + } + } + } +} }); } + async #fetchExclusiveOption( url: URL, options: { @@ -130481,7 +144388,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.has(i)) { + !(i < (this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#oneOf\\"); @@ -130553,7 +144461,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.has(i)) { + !(i < (this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -130906,7 +144815,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.has(i)) { + !(i < (this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#anyOf\\"); @@ -130978,7 +144888,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.has(i)) { + !(i < (this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -131361,7 +145272,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti } let v = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[0]; if (!(v instanceof URL) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/044f#quote\\"); @@ -131429,7 +145341,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -131803,7 +145716,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti } let v = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/044f#quoteAuthorization\\"); @@ -131871,7 +145785,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -132299,7 +146214,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf: (Object | URL)[] = []; - const _trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf: Set = new Set(); + const _trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf: VocabTrustSet = new Set(); let _2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf__array = values[\\"https://www.w3.org/ns/activitystreams#oneOf\\"]; @@ -132340,7 +146255,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti instance.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = _2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf; const _2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf: (Object | URL)[] = []; - const _trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf: Set = new Set(); + const _trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf: VocabTrustSet = new Set(); let _2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf__array = values[\\"https://www.w3.org/ns/activitystreams#anyOf\\"]; @@ -132449,7 +146364,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti instance.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount = _3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount; const _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); let _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote__array = values[\\"https://w3id.org/fep/044f#quote\\"]; @@ -132529,7 +146444,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; const _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); let _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization__array = values[\\"https://w3id.org/fep/044f#quoteAuthorization\\"]; @@ -132836,8 +146751,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Read.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -132898,7 +146813,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Read; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Read { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -133276,8 +147267,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Reject.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -133319,26 +147310,102 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - verifyPortableObject?: PortableObjectVerifier, - } = {} - ): Reject { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - // @ts-ignore: \$warning is not recognized as a property, but it is. - options = { ...options, \$warning: this._warning }; - } - const clone = super.clone(values, options) as unknown as Reject; - return clone; + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {} + ): Reject { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: \$warning is not recognized as a property, but it is. + options = { ...options, \$warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as Reject; + return clone; + } + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Reject { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -133673,13 +147740,13 @@ export class Relationship extends Object { } #_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject: (Object | URL)[] = []; - #_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject: Set = new Set(); + #_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject: VocabTrustSet = new Set(); #_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; - #_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); + #_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: VocabTrustSet = new Set(); #_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship: (Object | URL)[] = []; - #_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship: Set = new Set(); + #_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship: VocabTrustSet = new Set(); /** * Constructs a new instance of Relationship with the given values. @@ -133754,14 +147821,36 @@ relationships?: (Object | URL)[];} ); } - if (Array.isArray(values.objects) && - values.objects.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.objects)) { + const array = values.objects; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.objects; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects.slice(); + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = copied; - for (let i = 0; i < values.objects.length; i++) { - this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); - } + vocabSetTrustPrefix(this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length); } else { throw new TypeError( @@ -133794,14 +147883,36 @@ relationships?: (Object | URL)[];} ); } - if (Array.isArray(values.relationships) && - values.relationships.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.relationships)) { + const array = values.relationships; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.relationships; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = values.relationships.slice(); + this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = copied; - for (let i = 0; i < values.relationships.length; i++) { - this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.add(i); - } + vocabSetTrustPrefix(this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship, this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.length); } else { throw new TypeError( @@ -133823,8 +147934,8 @@ relationships?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Relationship.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -133878,12 +147989,16 @@ relationships?: (Object | URL)[];} // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Relationship;clone.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.slice();clone.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = new Set(this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject); + const clone = super.clone(values, options) as unknown as Relationship;clone.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.length < vocabSparseArrayMinimumLength + ? this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.slice() : vocabCopyPropertyArray(this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject);clone.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = vocabCopyTrustSet( + this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject, clone.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject, + ); if (\\"subject\\" in values && values.subject != null) { if (values.subject instanceof Object || values.subject instanceof URL) { // @ts-ignore: type is checked above. clone.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = [values.subject]; - clone.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = new Set([0]); + clone.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = new Set(); + clone.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The subject must be of type \\" + @@ -133891,12 +148006,16 @@ relationships?: (Object | URL)[];} ); } } - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.slice();clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object); + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length < vocabSparseArrayMinimumLength + ? this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.slice() : vocabCopyPropertyArray(this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object);clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = vocabCopyTrustSet( + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, + ); if (\\"object\\" in values && values.object != null) { if (values.object instanceof Object || values.object instanceof URL) { // @ts-ignore: type is checked above. clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = [values.object]; - clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set([0]); + clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(); + clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The object must be of type \\" + @@ -133915,15 +148034,37 @@ relationships?: (Object | URL)[];} ); } - if (Array.isArray(values.objects) && - values.objects.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.objects)) { + const array = values.objects; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.objects; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects.slice(); + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = copied; clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(); - for (let i = 0; i < values.objects.length; i++) { - clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length); } else { throw new TypeError( @@ -133932,12 +148073,16 @@ relationships?: (Object | URL)[];} ); } } - clone.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.slice();clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = new Set(this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship); + clone.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.length < vocabSparseArrayMinimumLength + ? this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.slice() : vocabCopyPropertyArray(this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship);clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = vocabCopyTrustSet( + this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship, clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship, + ); if (\\"relationship\\" in values && values.relationship != null) { if (values.relationship instanceof Object || values.relationship instanceof URL) { // @ts-ignore: type is checked above. clone.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = [values.relationship]; - clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = new Set([0]); + clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = new Set(); + clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The relationship must be of type \\" + @@ -133956,15 +148101,37 @@ relationships?: (Object | URL)[];} ); } - if (Array.isArray(values.relationships) && - values.relationships.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.relationships)) { + const array = values.relationships; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.relationships; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = values.relationships.slice(); + clone.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = copied; clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = new Set(); - for (let i = 0; i < values.relationships.length; i++) { - clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship, clone.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.length); } else { throw new TypeError( @@ -133976,7 +148143,153 @@ relationships?: (Object | URL)[];} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];subject?: Object | URL | null;object?: Object | URL | null; +objects?: (Object | URL)[];relationship?: Object | URL | null; +relationships?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Relationship { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Relationship; + + { + const array = node.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.length; i++) { + const value = node.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length; i++) { + const value = node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.length; i++) { + const value = node.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[i] = context.value(value); + } + } + } + } +} }); } + async #fetchSubject( url: URL, options: { @@ -134306,7 +148619,8 @@ relationships?: (Object | URL)[];} } let v = this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject[0]; if (!(v instanceof URL) && - !this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.has(0)) { + !(0 < (this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject[vocabTrustPrefix] ?? 0) || + this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#subject\\"); @@ -134374,7 +148688,8 @@ relationships?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.has(0)) { + !(0 < (this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject[vocabTrustPrefix] ?? 0) || + this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -134724,7 +149039,8 @@ relationships?: (Object | URL)[];} } let v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; if (!(v instanceof URL) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { + !(0 < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#object\\"); @@ -134792,7 +149108,8 @@ relationships?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { + !(0 < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -134880,7 +149197,8 @@ relationships?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i)) { + !(i < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#object\\"); @@ -134952,7 +149270,8 @@ relationships?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i)) { + !(i < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -135305,7 +149624,8 @@ relationships?: (Object | URL)[];} } let v = this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[0]; if (!(v instanceof URL) && - !this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(0)) { + !(0 < (this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[vocabTrustPrefix] ?? 0) || + this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#relationship\\"); @@ -135373,7 +149693,8 @@ relationships?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(0)) { + !(0 < (this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[vocabTrustPrefix] ?? 0) || + this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -135463,7 +149784,8 @@ relationships?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(i)) { + !(i < (this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[vocabTrustPrefix] ?? 0) || + this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#relationship\\"); @@ -135535,7 +149857,8 @@ relationships?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(i)) { + !(i < (this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[vocabTrustPrefix] ?? 0) || + this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -135953,7 +150276,7 @@ relationships?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject: (Object | URL)[] = []; - const _trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject: Set = new Set(); + const _trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject: VocabTrustSet = new Set(); let _2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject__array = values[\\"https://www.w3.org/ns/activitystreams#subject\\"]; @@ -135994,7 +150317,7 @@ relationships?: (Object | URL)[];} instance.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = _2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject; const _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; - const _trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); + const _trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: VocabTrustSet = new Set(); let _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array = values[\\"https://www.w3.org/ns/activitystreams#object\\"]; @@ -136035,7 +150358,7 @@ relationships?: (Object | URL)[];} instance.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; const _4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship: (Object | URL)[] = []; - const _trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship: Set = new Set(); + const _trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship: VocabTrustSet = new Set(); let _4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship__array = values[\\"https://www.w3.org/ns/activitystreams#relationship\\"]; @@ -136271,8 +150594,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Remove.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -136333,7 +150656,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Remove; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Remove { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -136658,39 +151057,39 @@ export class Service extends Object { #_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername: ((string | LanguageString))[] = []; #_axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); #_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); #_hQiaHhZP8hqxckxTBrpsGNs57E3: (URL)[] = []; #_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers: (boolean)[] = []; #_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); #_41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); #_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); #_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); #_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); #_4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); #_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); #_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); #_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); #_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints: (Endpoints)[] = []; #_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable: (boolean)[] = []; #_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended: (boolean)[] = []; @@ -136698,13 +151097,13 @@ export class Service extends Object { #_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable: (boolean)[] = []; #_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); #_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); #_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); #_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage: (string)[] = []; #_2xEU4QtkC53RAun67T81Egqt9vmL_isCat: (boolean)[] = []; #_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense: (URL)[] = []; @@ -136773,10 +151172,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -136809,14 +151232,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; - for (let i = 0; i < values.publicKeys.length; i++) { - this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -136849,14 +151294,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; - for (let i = 0; i < values.assertionMethods.length; i++) { - this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -136889,10 +151356,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -137021,14 +151512,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | if (\\"streams\\" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; - for (let i = 0; i < values.streams.length; i++) { - this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -137139,14 +151652,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; - for (let i = 0; i < values.aliases.length; i++) { - this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -137179,14 +151714,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; - for (let i = 0; i < values.services.length; i++) { - this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -137247,8 +151804,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Service.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -137306,7 +151863,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Service;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice(); + const clone = super.clone(values, options) as unknown as Service;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < vocabSparseArrayMinimumLength + ? this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice() : vocabCopyPropertyArray(this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername); if (\\"preferredUsername\\" in values && values.preferredUsername != null) { if (typeof values.preferredUsername === \\"string\\" || values.preferredUsername instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -137330,10 +151888,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -137342,12 +151924,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice();clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length < vocabSparseArrayMinimumLength + ? this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice() : vocabCopyPropertyArray(this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey);clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = vocabCopyTrustSet( + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, + ); if (\\"publicKey\\" in values && values.publicKey != null) { if (values.publicKey instanceof CryptographicKey || values.publicKey instanceof URL) { // @ts-ignore: type is checked above. clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = [values.publicKey]; - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set([0]); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The publicKey must be of type \\" + @@ -137366,15 +151952,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); - for (let i = 0; i < values.publicKeys.length; i++) { - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -137383,12 +151991,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice();clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length < vocabSparseArrayMinimumLength + ? this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice() : vocabCopyPropertyArray(this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod);clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = vocabCopyTrustSet( + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, + ); if (\\"assertionMethod\\" in values && values.assertionMethod != null) { if (values.assertionMethod instanceof Multikey || values.assertionMethod instanceof URL) { // @ts-ignore: type is checked above. clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = [values.assertionMethod]; - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set([0]); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The assertionMethod must be of type \\" + @@ -137407,15 +152019,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); - for (let i = 0; i < values.assertionMethods.length; i++) { - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -137424,7 +152058,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length < vocabSparseArrayMinimumLength + ? this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice() : vocabCopyPropertyArray(this.#_hQiaHhZP8hqxckxTBrpsGNs57E3); if (\\"gateway\\" in values && values.gateway != null) { if (values.gateway instanceof URL && isGatewayUrl(values.gateway)) { // @ts-ignore: type is checked above. @@ -137448,10 +152083,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -137460,7 +152119,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice(); + clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.length < vocabSparseArrayMinimumLength + ? this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice() : vocabCopyPropertyArray(this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers); if (\\"manuallyApprovesFollowers\\" in values && values.manuallyApprovesFollowers != null) { if (typeof values.manuallyApprovesFollowers === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -137473,12 +152133,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice();clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox); + clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length < vocabSparseArrayMinimumLength + ? this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice() : vocabCopyPropertyArray(this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox);clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = vocabCopyTrustSet( + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, + ); if (\\"inbox\\" in values && values.inbox != null) { if (values.inbox instanceof OrderedCollection || values.inbox instanceof OrderedCollectionPage || values.inbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = [values.inbox]; - clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set([0]); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The inbox must be of type \\" + @@ -137486,12 +152150,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice();clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox); + clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length < vocabSparseArrayMinimumLength + ? this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice() : vocabCopyPropertyArray(this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox);clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = vocabCopyTrustSet( + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, + ); if (\\"outbox\\" in values && values.outbox != null) { if (values.outbox instanceof OrderedCollection || values.outbox instanceof OrderedCollectionPage || values.outbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = [values.outbox]; - clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set([0]); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The outbox must be of type \\" + @@ -137499,12 +152167,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice();clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following); + clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length < vocabSparseArrayMinimumLength + ? this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice() : vocabCopyPropertyArray(this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following);clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = vocabCopyTrustSet( + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, + ); if (\\"following\\" in values && values.following != null) { if (values.following instanceof Collection || values.following instanceof URL) { // @ts-ignore: type is checked above. clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = [values.following]; - clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set([0]); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The following must be of type \\" + @@ -137512,12 +152184,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice();clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers); + clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length < vocabSparseArrayMinimumLength + ? this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice() : vocabCopyPropertyArray(this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers);clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = vocabCopyTrustSet( + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, + ); if (\\"followers\\" in values && values.followers != null) { if (values.followers instanceof Collection || values.followers instanceof URL) { // @ts-ignore: type is checked above. clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = [values.followers]; - clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set([0]); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The followers must be of type \\" + @@ -137525,12 +152201,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice();clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked); + clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length < vocabSparseArrayMinimumLength + ? this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice() : vocabCopyPropertyArray(this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked);clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = vocabCopyTrustSet( + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, + ); if (\\"liked\\" in values && values.liked != null) { if (values.liked instanceof Collection || values.liked instanceof URL) { // @ts-ignore: type is checked above. clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = [values.liked]; - clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set([0]); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The liked must be of type \\" + @@ -137538,12 +152218,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice();clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured); + clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length < vocabSparseArrayMinimumLength + ? this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice() : vocabCopyPropertyArray(this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured);clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = vocabCopyTrustSet( + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, + ); if (\\"featured\\" in values && values.featured != null) { if (values.featured instanceof Collection || values.featured instanceof URL) { // @ts-ignore: type is checked above. clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = [values.featured]; - clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set([0]); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featured must be of type \\" + @@ -137551,12 +152235,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice();clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags); + clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length < vocabSparseArrayMinimumLength + ? this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice() : vocabCopyPropertyArray(this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags);clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = vocabCopyTrustSet( + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, + ); if (\\"featuredTags\\" in values && values.featuredTags != null) { if (values.featuredTags instanceof Collection || values.featuredTags instanceof URL) { // @ts-ignore: type is checked above. clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = [values.featuredTags]; - clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set([0]); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredTags must be of type \\" + @@ -137564,12 +152252,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice();clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections); + clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length < vocabSparseArrayMinimumLength + ? this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice() : vocabCopyPropertyArray(this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections);clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = vocabCopyTrustSet( + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, + ); if (\\"featuredCollections\\" in values && values.featuredCollections != null) { if (values.featuredCollections instanceof Collection || values.featuredCollections instanceof URL) { // @ts-ignore: type is checked above. clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = [values.featuredCollections]; - clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set([0]); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredCollections must be of type \\" + @@ -137577,18 +152269,43 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice();clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length < vocabSparseArrayMinimumLength + ? this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice() : vocabCopyPropertyArray(this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams);clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = vocabCopyTrustSet( + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, + ); if (\\"streams\\" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(); - for (let i = 0; i < values.streams.length; i++) { - clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -137597,7 +152314,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice(); + clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length < vocabSparseArrayMinimumLength + ? this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice() : vocabCopyPropertyArray(this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints); if (\\"endpoints\\" in values && values.endpoints != null) { if (values.endpoints instanceof Endpoints) { // @ts-ignore: type is checked above. @@ -137610,7 +152328,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice(); + clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length < vocabSparseArrayMinimumLength + ? this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice() : vocabCopyPropertyArray(this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable); if (\\"discoverable\\" in values && values.discoverable != null) { if (typeof values.discoverable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -137623,7 +152342,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice(); + clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.length < vocabSparseArrayMinimumLength + ? this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice() : vocabCopyPropertyArray(this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended); if (\\"suspended\\" in values && values.suspended != null) { if (typeof values.suspended === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -137636,7 +152356,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice(); + clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.length < vocabSparseArrayMinimumLength + ? this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice() : vocabCopyPropertyArray(this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial); if (\\"memorial\\" in values && values.memorial != null) { if (typeof values.memorial === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -137649,7 +152370,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice(); + clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.length < vocabSparseArrayMinimumLength + ? this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice() : vocabCopyPropertyArray(this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable); if (\\"indexable\\" in values && values.indexable != null) { if (typeof values.indexable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -137662,12 +152384,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice();clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo); + clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length < vocabSparseArrayMinimumLength + ? this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice() : vocabCopyPropertyArray(this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo);clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = vocabCopyTrustSet( + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, + ); if (\\"successor\\" in values && values.successor != null) { if (values.successor instanceof Application || values.successor instanceof Group || values.successor instanceof Organization || values.successor instanceof Person || values.successor instanceof Service || values.successor instanceof URL) { // @ts-ignore: type is checked above. clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = [values.successor]; - clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set([0]); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The successor must be of type \\" + @@ -137675,12 +152401,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice();clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length < vocabSparseArrayMinimumLength + ? this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice() : vocabCopyPropertyArray(this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs);clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = vocabCopyTrustSet( + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, + ); if (\\"alias\\" in values && values.alias != null) { if (values.alias instanceof Application || values.alias instanceof Group || values.alias instanceof Organization || values.alias instanceof Person || values.alias instanceof Service || values.alias instanceof URL) { // @ts-ignore: type is checked above. clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = [values.alias]; - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set([0]); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The alias must be of type \\" + @@ -137699,15 +152429,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); - for (let i = 0; i < values.aliases.length; i++) { - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -137716,12 +152468,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice();clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length < vocabSparseArrayMinimumLength + ? this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice() : vocabCopyPropertyArray(this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service);clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = vocabCopyTrustSet( + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, + ); if (\\"service\\" in values && values.service != null) { if (values.service instanceof DidService || values.service instanceof URL) { // @ts-ignore: type is checked above. clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = [values.service]; - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set([0]); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The service must be of type \\" + @@ -137740,15 +152496,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); - for (let i = 0; i < values.services.length; i++) { - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -137757,7 +152535,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice(); + clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.length < vocabSparseArrayMinimumLength + ? this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice() : vocabCopyPropertyArray(this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage); if (\\"followedMessage\\" in values && values.followedMessage != null) { if (typeof values.followedMessage === \\"string\\") { // @ts-ignore: type is checked above. @@ -137770,7 +152549,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice(); + clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.length < vocabSparseArrayMinimumLength + ? this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice() : vocabCopyPropertyArray(this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat); if (\\"cat\\" in values && values.cat != null) { if (typeof values.cat === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -137783,7 +152563,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice(); + clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length < vocabSparseArrayMinimumLength + ? this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice() : vocabCopyPropertyArray(this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense); if (\\"preferredLicense\\" in values && values.preferredLicense != null) { if (values.preferredLicense instanceof URL) { // @ts-ignore: type is checked above. @@ -137799,7 +152580,465 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];preferredUsername?: string | LanguageString | null; +preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; +publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; +assertionMethods?: (Multikey | URL)[];gateway?: URL | null; +gateways?: (URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;featuredCollections?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; +aliases?: (Application | Group | Organization | Person | Service | URL)[];service?: DidService | URL | null; +services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | null;preferredLicense?: URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Service { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Service; + + { + const array = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length; i++) { + const value = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i]; + if (value != null && typeof value === \\"object\\") { + node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length; i++) { + const value = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i] = context.value(value); + } + } + } + } + + { + const array = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length; i++) { + const value = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i]; + if (value != null && typeof value === \\"object\\") { + node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length; i++) { + const value = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length; i++) { + const value = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length; i++) { + const value = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i] = context.value(value); + } + } + } + } + + { + const array = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length; i++) { + const value = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i]; + if (value != null && typeof value === \\"object\\") { + node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length; i++) { + const value = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length; i++) { + const value = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length; i++) { + const value = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i] = context.value(value); + } + } + } + } + + { + const array = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length; i++) { + const value = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i]; + if (value != null && typeof value === \\"object\\") { + node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length; i++) { + const value = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i] = context.value(value); + } + } + } + } + + { + const array = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length; i++) { + const value = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i]; + if (value != null && typeof value === \\"object\\") { + node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length; i++) { + const value = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length; i++) { + const value = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length; i++) { + const value = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i] = context.value(value); + } + } + } + } + + { + const array = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length; i++) { + const value = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i]; + if (value != null && typeof value === \\"object\\") { + node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i] = context.value(value); + } + } + } + } +} }); } + /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. * @@ -138148,7 +153387,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[0]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#publicKey\\"); @@ -138216,7 +153456,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -138303,7 +153544,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#publicKey\\"); @@ -138375,7 +153617,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -138729,7 +153972,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#assertionMethod\\"); @@ -138797,7 +154041,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -138888,7 +154133,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#assertionMethod\\"); @@ -138960,7 +154206,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -139384,7 +154631,8 @@ get gateways(): (URL)[] { } let v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0]; if (!(v instanceof URL) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://www.w3.org/ns/ldp#inbox\\"); @@ -139452,7 +154700,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -139826,7 +155075,8 @@ get gateways(): (URL)[] { } let v = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[0]; if (!(v instanceof URL) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#outbox\\"); @@ -139894,7 +155144,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -140248,7 +155499,8 @@ get gateways(): (URL)[] { } let v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0]; if (!(v instanceof URL) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#following\\"); @@ -140316,7 +155568,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -140673,7 +155926,8 @@ get gateways(): (URL)[] { } let v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0]; if (!(v instanceof URL) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#followers\\"); @@ -140741,7 +155995,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -141096,7 +156351,8 @@ get gateways(): (URL)[] { } let v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0]; if (!(v instanceof URL) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#liked\\"); @@ -141164,7 +156420,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -141517,7 +156774,8 @@ get gateways(): (URL)[] { } let v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[0]; if (!(v instanceof URL) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://joinmastodon.org/ns#featured\\"); @@ -141585,7 +156843,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -141938,7 +157197,8 @@ get gateways(): (URL)[] { } let v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0]; if (!(v instanceof URL) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://joinmastodon.org/ns#featuredTags\\"); @@ -142006,7 +157266,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -142356,7 +157617,8 @@ get gateways(): (URL)[] { } let v = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[0]; if (!(v instanceof URL) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/7aa9#featuredCollections\\"); @@ -142424,7 +157686,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -142774,7 +158037,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#streams\\"); @@ -142846,7 +158110,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -143331,7 +158596,8 @@ get gateways(): (URL)[] { } let v = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0]; if (!(v instanceof URL) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#movedTo\\"); @@ -143399,7 +158665,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -143812,7 +159079,8 @@ get gateways(): (URL)[] { } let v = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"); @@ -143880,7 +159148,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -143971,7 +159240,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"); @@ -144043,7 +159313,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -144397,7 +159668,8 @@ get gateways(): (URL)[] { } let v = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/did#service\\"); @@ -144465,7 +159737,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -144556,7 +159829,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/did#service\\"); @@ -144628,7 +159902,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -146027,7 +161302,7 @@ get gateways(): (URL)[] { instance.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; const _axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); let _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array = values[\\"https://w3id.org/security#publicKey\\"]; @@ -146068,7 +161343,7 @@ get gateways(): (URL)[] { instance.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = _axq166E2eZADq34V4MYUc8KMZdC_publicKey; const _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); let _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array = values[\\"https://w3id.org/security#assertionMethod\\"]; @@ -146167,7 +161442,7 @@ get gateways(): (URL)[] { instance.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers; const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); let _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array = values[\\"http://www.w3.org/ns/ldp#inbox\\"]; @@ -146214,7 +161489,7 @@ get gateways(): (URL)[] { instance.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; const _41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); let _41QwhqJouoLg3h8dRPKat21brynC_outbox__array = values[\\"https://www.w3.org/ns/activitystreams#outbox\\"]; @@ -146261,7 +161536,7 @@ get gateways(): (URL)[] { instance.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = _41QwhqJouoLg3h8dRPKat21brynC_outbox; const _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); let _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array = values[\\"https://www.w3.org/ns/activitystreams#following\\"]; @@ -146302,7 +161577,7 @@ get gateways(): (URL)[] { instance.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; const _BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); let _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array = values[\\"https://www.w3.org/ns/activitystreams#followers\\"]; @@ -146343,7 +161618,7 @@ get gateways(): (URL)[] { instance.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = _BBCTgfphhsFzpVfKTykGSpBNwoA_followers; const _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); let _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array = values[\\"https://www.w3.org/ns/activitystreams#liked\\"]; @@ -146384,7 +161659,7 @@ get gateways(): (URL)[] { instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; const _4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); let _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array = values[\\"http://joinmastodon.org/ns#featured\\"]; @@ -146425,7 +161700,7 @@ get gateways(): (URL)[] { instance.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = _4N1vBJzXDf8NbBumeECQMFvKetja_featured; const _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); let _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array = values[\\"http://joinmastodon.org/ns#featuredTags\\"]; @@ -146466,7 +161741,7 @@ get gateways(): (URL)[] { instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; const _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); let _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections__array = values[\\"https://w3id.org/fep/7aa9#featuredCollections\\"]; @@ -146507,7 +161782,7 @@ get gateways(): (URL)[] { instance.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); let _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array = values[\\"https://www.w3.org/ns/activitystreams#streams\\"]; @@ -146696,7 +161971,7 @@ get gateways(): (URL)[] { instance.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable; const _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); let _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array = values[\\"https://www.w3.org/ns/activitystreams#movedTo\\"]; @@ -146754,7 +162029,7 @@ get gateways(): (URL)[] { instance.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; const _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); let _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array = values[\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"]; @@ -146812,7 +162087,7 @@ get gateways(): (URL)[] { instance.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; const _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); let _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array = values[\\"https://www.w3.org/ns/did#service\\"]; @@ -147679,10 +162954,34 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} ); } - if (Array.isArray(values.contents) && - values.contents.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.contents)) { + const array = values.contents; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.contents; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = values.contents.slice(); + this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = copied; } else { throw new TypeError( @@ -147717,8 +163016,8 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Source.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -147762,7 +163061,8 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} options ); copyPortableProvenance(this, clone); - clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.slice(); + clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length < vocabSparseArrayMinimumLength + ? this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.slice() : vocabCopyPropertyArray(this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content); if (\\"content\\" in values && values.content != null) { if (typeof values.content === \\"string\\" || values.content instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -147786,10 +163086,34 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} ); } - if (Array.isArray(values.contents) && - values.contents.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.contents)) { + const array = values.contents; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.contents; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = values.contents.slice(); + clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = copied; } else { throw new TypeError( @@ -147798,7 +163122,8 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} ); } } - clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.slice(); + clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.length < vocabSparseArrayMinimumLength + ? this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.slice() : vocabCopyPropertyArray(this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType); if (\\"mediaType\\" in values && values.mediaType != null) { if (typeof values.mediaType === \\"string\\") { // @ts-ignore: type is checked above. @@ -147814,7 +163139,80 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];mediaType?: string | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Source { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Source; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Source; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); +} }); } + /** The source content. */ get content(): (string | LanguageString | null) { @@ -148418,8 +163816,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link TentativeAccept.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -148461,26 +163859,102 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - verifyPortableObject?: PortableObjectVerifier, - } = {} - ): TentativeAccept { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - // @ts-ignore: \$warning is not recognized as a property, but it is. - options = { ...options, \$warning: this._warning }; - } - const clone = super.clone(values, options) as unknown as TentativeAccept; - return clone; + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {} + ): TentativeAccept { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: \$warning is not recognized as a property, but it is. + options = { ...options, \$warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as TentativeAccept; + return clone; + } + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): TentativeAccept { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -148858,8 +164332,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link TentativeReject.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -148920,7 +164394,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as TentativeReject; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): TentativeReject { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -149307,10 +164857,34 @@ formerTypes?: (\$EntityType)[];deleted?: Temporal.Instant | null;} ); } - if (Array.isArray(values.formerTypes) && - values.formerTypes.every(v => isEntityType(v))) { + let copied!: (\$EntityType)[]; + let valid = false; + if (Array.isArray(values.formerTypes)) { + const array = values.formerTypes; + const test = (v: \$EntityType): boolean => isEntityType(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.formerTypes; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType = values.formerTypes.slice(); + this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType = copied; } else { throw new TypeError( @@ -149345,8 +164919,8 @@ formerTypes?: (\$EntityType)[];deleted?: Temporal.Instant | null;} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Tombstone.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -149399,7 +164973,8 @@ formerTypes?: (\$EntityType)[];deleted?: Temporal.Instant | null;} // @ts-ignore: \$warning is not recognized as a property, but it is. options = { ...options, \$warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Tombstone;clone.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType = this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType.slice(); + const clone = super.clone(values, options) as unknown as Tombstone;clone.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType = this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType.length < vocabSparseArrayMinimumLength + ? this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType.slice() : vocabCopyPropertyArray(this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType); if (\\"formerType\\" in values && values.formerType != null) { if (isEntityType(values.formerType)) { // @ts-ignore: type is checked above. @@ -149423,10 +164998,34 @@ formerTypes?: (\$EntityType)[];deleted?: Temporal.Instant | null;} ); } - if (Array.isArray(values.formerTypes) && - values.formerTypes.every(v => isEntityType(v))) { + let copied!: (\$EntityType)[]; + let valid = false; + if (Array.isArray(values.formerTypes)) { + const array = values.formerTypes; + const test = (v: \$EntityType): boolean => isEntityType(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.formerTypes; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType = values.formerTypes.slice(); + clone.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType = copied; } else { throw new TypeError( @@ -149435,7 +165034,8 @@ formerTypes?: (\$EntityType)[];deleted?: Temporal.Instant | null;} ); } } - clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted.slice(); + clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted.length < vocabSparseArrayMinimumLength + ? this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted.slice() : vocabCopyPropertyArray(this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted); if (\\"deleted\\" in values && values.deleted != null) { if (isTemporalInstant(values.deleted)) { // @ts-ignore: type is checked above. @@ -149451,7 +165051,78 @@ formerTypes?: (\$EntityType)[];deleted?: Temporal.Instant | null;} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];formerType?: \$EntityType | null; +formerTypes?: (\$EntityType)[];deleted?: Temporal.Instant | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Tombstone { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** On a \`Tombstone\` object, the \`formerType\` property identifies the type of * the object that was deleted. * @@ -150089,8 +165760,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Travel.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -150151,7 +165822,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Travel; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Travel { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -150534,8 +166281,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Undo.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -150596,7 +166343,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Undo; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Undo { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -150977,8 +166800,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Update.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -151039,7 +166862,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Update; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Update { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -151409,8 +167308,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Video.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -151465,7 +167364,77 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const clone = super.clone(values, options) as unknown as Video; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];width?: number | null;height?: number | null;digestMultibase?: string | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Video { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -151861,8 +167830,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link View.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -151923,7 +167892,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as View; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): View { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. diff --git a/packages/vocab-tools/src/__snapshots__/class.test.ts.node.snap b/packages/vocab-tools/src/__snapshots__/class.test.ts.node.snap index 18a627850..99a4f37d2 100644 --- a/packages/vocab-tools/src/__snapshots__/class.test.ts.node.snap +++ b/packages/vocab-tools/src/__snapshots__/class.test.ts.node.snap @@ -50,6 +50,7 @@ import { parseCompatibleEf61Reference, type PortableResponseClaim, recordPortableReferrer, + retargetPortableReferrer, rejectMalformedCompatibleReference, warnUnverifiableEmbeddedObject } from \\"@fedify/vocab-runtime/internal/portable-dereference\\"; @@ -79,6 +80,293 @@ function inspectIri(iri: URL): string { try { return formatIri(iri); } catch { return iri.href; } } +interface VocabSparseArraySnapshot { + length: number; + indices: number[]; +} + +interface VocabArrayValidation { + valid: boolean; + sparse: boolean; +} + +type VocabArrayCopy = { ok: true; array: T[] } | { ok: false }; + +// Most fields have no trusted prefix. Keep that metadata on the existing Set +// so empty fields need neither another object nor another instance slot. +const vocabTrustPrefix: unique symbol = Symbol(\\"vocabulary trust prefix\\"); +type VocabTrustSet = Set & { [vocabTrustPrefix]?: number }; + +function vocabSetTrustPrefix(trust: VocabTrustSet, prefix: number): void { + if (prefix > 0) trust[vocabTrustPrefix] = prefix; +} + +function vocabCopyTrustSet( + trust: VocabTrustSet, + destination: VocabTrustSet, +): VocabTrustSet { + // clone() already constructed the destination. Reuse its empty Set only + // when constructor defaults cannot contribute trust to the copied field. + const copy: VocabTrustSet = trust !== destination && trust.size === 0 && + destination.size === 0 && destination[vocabTrustPrefix] == null + ? destination : new Set(trust); + const prefix = trust[vocabTrustPrefix]; + if (prefix != null && prefix > 0) copy[vocabTrustPrefix] = prefix; + return copy; +} + +// These thresholds select an optimization, not a limit on property arrays. +const vocabSparseArrayMinimumLength = 4096; +const vocabSparseArrayProbeCount = 8; +const vocabSparseArrayPresentProbeLimit = 4; +const vocabArrayPrototype = Array.prototype; +const vocabObjectPrototype = globalThis.Object.prototype; +const vocabArrayDescriptors = [\\"constructor\\", \\"every\\", \\"slice\\"].map( + key => globalThis.Object.getOwnPropertyDescriptor(vocabArrayPrototype, key), +); +const vocabArraySpeciesDescriptor = globalThis.Object.getOwnPropertyDescriptor( + Array, Symbol.species, +); + +function vocabSameArrayDescriptor( + actual: PropertyDescriptor | undefined, + expected: PropertyDescriptor | undefined, +): boolean { + return actual?.value === expected?.value && actual?.get === expected?.get && + actual?.set === expected?.set && actual?.writable === expected?.writable && + actual?.enumerable === expected?.enumerable && + actual?.configurable === expected?.configurable; +} + +function vocabArrayIndex(key: string): number | undefined { + const index = Number(key); + return Number.isInteger(index) && index >= 0 && index < 0xffffffff && + String(index) === key + ? index + : undefined; +} + +function vocabSparseArraySnapshot( + array: unknown[], +): VocabSparseArraySnapshot | undefined { + if (!Array.isArray(array)) return undefined; + const length = array.length; + // Small dense fields take no prototype or key-enumeration overhead. + if (length < vocabSparseArrayMinimumLength) return undefined; + if (!Number.isInteger(length) || length > 0xffffffff || + globalThis.Object.getPrototypeOf(array) !== vocabArrayPrototype || + globalThis.Object.getPrototypeOf(vocabArrayPrototype) !== + vocabObjectPrototype || + globalThis.Object.getPrototypeOf(vocabObjectPrototype) !== null) { + return undefined; + } + const methods = [\\"constructor\\", \\"every\\", \\"slice\\"]; + for (let i = 0; i < methods.length; i++) { + const key = methods[i]; + if (globalThis.Object.hasOwn(array, key) || + !vocabSameArrayDescriptor( + globalThis.Object.getOwnPropertyDescriptor(vocabArrayPrototype, key), + vocabArrayDescriptors[i], + )) return undefined; + } + if (!vocabSameArrayDescriptor( + globalThis.Object.getOwnPropertyDescriptor(Array, Symbol.species), + vocabArraySpeciesDescriptor, + )) return undefined; + + // Descriptor probes do not invoke element getters. Plainly dense arrays + // keep native iteration without enumerating all their keys. + let present = 0; + for (let i = 0; i < vocabSparseArrayProbeCount; i++) { + const index = Math.floor(i * (length - 1) / (vocabSparseArrayProbeCount - 1)); + if (globalThis.Object.getOwnPropertyDescriptor(array, index) != null && + ++present >= vocabSparseArrayPresentProbeLimit) return undefined; + } + for (const prototype of [vocabArrayPrototype, vocabObjectPrototype]) { + for (const key of globalThis.Object.getOwnPropertyNames(prototype)) { + if (vocabArrayIndex(key) != null) return undefined; + } + } + const indices: number[] = []; + for (const key of globalThis.Object.getOwnPropertyNames(array)) { + const index = vocabArrayIndex(key); + if (index != null && index < length) indices.push(index); + } + if (indices.length >= length / 2) return undefined; + for (const index of indices) { + const descriptor = globalThis.Object.getOwnPropertyDescriptor(array, index); + if (descriptor == null || !(\\"value\\" in descriptor)) return undefined; + } + // Ordinary array keys already have canonical index order. This guard is + // not a Proxy detector; reflection traps and errors remain observable. + return { length, indices }; +} + +function vocabValidatePropertyArray( + array: T[], + test: (value: T) => boolean, +): VocabArrayValidation { + const snapshot = vocabSparseArraySnapshot(array); + if (snapshot == null) return { valid: array.every(test), sparse: false }; + for (const index of snapshot.indices) { + if (globalThis.Object.hasOwn(array, index) && !test(array[index])) { + return { valid: false, sparse: true }; + } + } + return { valid: true, sparse: true }; +} + +function vocabDefineArrayEntry(array: T[], index: number, value: T): void { + globalThis.Object.defineProperty(array, index, { + value, writable: true, enumerable: true, configurable: true, + }); +} + +function vocabCopySparsePropertyArray( + array: T[], + snapshot: VocabSparseArraySnapshot, + test?: (value: T) => boolean, +): VocabArrayCopy { + const copy: T[] = []; + // Seed dictionary storage before low indices or the final length can + // allocate storage for every hole. The temporary entry stays private. + if (snapshot.indices[snapshot.indices.length - 1] !== snapshot.length - 1) { + globalThis.Object.defineProperty(copy, snapshot.length - 1, { + value: undefined, writable: true, enumerable: true, configurable: true, + }); + delete copy[snapshot.length - 1]; + } + for (const index of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, index)) continue; + const value = array[index]; + if (test != null && !test(value)) return { ok: false }; + vocabDefineArrayEntry(copy, index, value); + } + // A validation callback may have deleted the last snapshot entry. + if (copy.length < snapshot.length) { + globalThis.Object.defineProperty(copy, snapshot.length - 1, { + value: undefined, writable: true, enumerable: true, configurable: true, + }); + delete copy[snapshot.length - 1]; + } + copy.length = snapshot.length; + return { ok: true, array: copy }; +} + +function vocabCopyPropertyArray(array: T[]): T[] { + const snapshot = vocabSparseArraySnapshot(array); + if (snapshot == null) return array.slice(); + const copied = vocabCopySparsePropertyArray(array, snapshot); + // Without a predicate the private copy cannot fail validation. + return (copied as { ok: true; array: T[] }).array; +} + +function vocabCopyValidatedPropertyArray( + array: T[], + test: (value: T) => boolean, + previous: VocabArrayValidation, +): VocabArrayCopy { + const snapshot = vocabSparseArraySnapshot(array); + if (snapshot != null) return vocabCopySparsePropertyArray(array, snapshot, test); + // Sparse validation may have changed the next input's density, descriptors + // or prototype. Validate that native-copy input before falling back. + if (previous.sparse && !array.every(test)) return { ok: false }; + return { ok: true, array: array.slice() }; +} + +interface DeepCloneContext { + value(value: T): T; +} + +interface DeepCloneDescriptor { + create(source: object): object; + copy(destination: object, context: DeepCloneContext): void; +} + +const deepCloneDescriptors = new Map(); + +function getDeepCloneDescriptor(value: object): DeepCloneDescriptor | undefined { + let prototype: object | null = globalThis.Object.getPrototypeOf(value); + while (prototype != null) { + const descriptor = deepCloneDescriptors.get(prototype); + if (descriptor != null) return descriptor; + prototype = globalThis.Object.getPrototypeOf(prototype); + } + return undefined; +} + +function deepCloneGraph(source: object, root: T): T { + const memo = new Map(); + const destinations = new Set(); + const shells: object[] = []; + let next = 0; + + function enqueue(original: object, destination: object): void { + if (destination == null || typeof destination !== \\"object\\" || + original === destination || destinations.has(destination) || + !globalThis.Object.prototype.isPrototypeOf.call( + globalThis.Object.getPrototypeOf(original), destination + ) || getDeepCloneDescriptor(destination) == null) { + throw new TypeError(\\"clone() must return a fresh, compatible instance.\\"); + } + destinations.add(destination); + shells.push(destination); + } + + const context: DeepCloneContext = { + value(value: V): V { + if (value == null || typeof value !== \\"object\\") return value; + const existing = memo.get(value); + if (existing != null) return existing as V; + if (value instanceof URL) { + const copy = new URL(value.href); + memo.set(value, copy); + return copy as V; + } + if (value instanceof Uint8Array) { + const copy = new Uint8Array(value); + memo.set(value, copy); + return copy as V; + } + const descriptor = getDeepCloneDescriptor(value); + // Other supported scalars (Temporal, LanguageString, Intl.Locale, + // CryptoKey and class constructors) are shared as immutable values. + if (descriptor == null) return value; + const copy = descriptor.create(value); + enqueue(value, copy); + memo.set(value, copy); + return copy as V; + }, + }; + + function drain(): void { + while (next < shells.length) { + const shell = shells[next++]; + getDeepCloneDescriptor(shell)!.copy(shell, context); + } + } + + // The effective root includes replacements. References to the source root + // instead receive a separate copy of its pre-update values. + enqueue(source, root); + drain(); + + // Discover historical root ancestry without substituting replacement values + // into it. The resolver deliberately returns undefined in this first pass. + const count = shells.length; + for (let i = 0; i < count; i++) { + retargetPortableReferrer(shells[i], (original) => { + if (original === source) context.value(source); + return undefined; + }); + } + drain(); + for (const shell of shells) { + retargetPortableReferrer(shell, (original) => memo.get(original)); + } + return root; +} + function isValidLanguageTag(language: string): boolean { try { new Intl.Locale(normalizeLanguageTag(language)); @@ -240,87 +528,87 @@ export class Object { } #_49BipA5dq9eoH8LX8xdsVumveTca_attachment: (Object | Link | PropertyValue | URL)[] = []; - #_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment: Set = new Set(); + #_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment: VocabTrustSet = new Set(); #_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: Set = new Set(); + #_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: VocabTrustSet = new Set(); #_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience: (Object | URL)[] = []; - #_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience: Set = new Set(); + #_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience: VocabTrustSet = new Set(); #_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content: ((string | LanguageString))[] = []; #_3mhZzGXSpQ431mBSz2kvych22v4e_context: (Object | Link | URL)[] = []; - #_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context: Set = new Set(); + #_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context: VocabTrustSet = new Set(); #_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = []; #_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime: (Temporal.Instant)[] = []; #_86xFhmgBapoMvYqjbjRuDPayTrS_generator: (Object | Link | URL)[] = []; - #_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator: Set = new Set(); + #_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator: VocabTrustSet = new Set(); #_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon: (Image | URL)[] = []; - #_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon: Set = new Set(); + #_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon: VocabTrustSet = new Set(); #_3dXrUdkARxwyJLtJcYi1AJ92H41U_image: (Image | URL)[] = []; - #_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image: Set = new Set(); + #_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image: VocabTrustSet = new Set(); #_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo: (Object | Link | URL)[] = []; - #_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo: Set = new Set(); + #_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo: VocabTrustSet = new Set(); #_31k5MUZJsnsPNg8dQQJieWaXTFnR_location: (Object | Link | URL)[] = []; - #_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location: Set = new Set(); + #_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location: VocabTrustSet = new Set(); #_gCVTegXxWWCw6wWRxa1QF65zusg_preview: (Link | Object | URL)[] = []; - #_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: Set = new Set(); + #_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: VocabTrustSet = new Set(); #_5e258TDXtuhaFRPZiGoDfEpjdMr_published: (Temporal.Instant)[] = []; #_7UpwM3JWcXhADcscukEehBorf6k_replies: (Collection | URL)[] = []; - #_trust_7UpwM3JWcXhADcscukEehBorf6k_replies: Set = new Set(); + #_trust_7UpwM3JWcXhADcscukEehBorf6k_replies: VocabTrustSet = new Set(); #_3kAfck9PcEYt2L7xug5y99YPbANs_shares: (Collection | URL)[] = []; - #_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares: Set = new Set(); + #_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares: VocabTrustSet = new Set(); #_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes: (Collection | URL)[] = []; - #_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes: Set = new Set(); + #_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes: VocabTrustSet = new Set(); #_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: (Collection | URL)[] = []; - #_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: Set = new Set(); + #_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: VocabTrustSet = new Set(); #_2w3Jmue4up8iVDUA51WZqomEF438_startTime: (Temporal.Instant)[] = []; #_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary: ((string | LanguageString))[] = []; #_5chuqj6s95p5gg2sk1HntGfarRf_tag: (Object | Link | URL)[] = []; - #_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag: Set = new Set(); + #_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag: VocabTrustSet = new Set(); #_385aB7ySixcf5Un6z3VsWmThgCzQ_updated: (Temporal.Instant)[] = []; #_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url: ((URL | Link))[] = []; #_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to: (Object | URL)[] = []; - #_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to: Set = new Set(); + #_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to: VocabTrustSet = new Set(); #_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto: (Object | URL)[] = []; - #_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto: Set = new Set(); + #_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto: VocabTrustSet = new Set(); #_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc: (Object | URL)[] = []; - #_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc: Set = new Set(); + #_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc: VocabTrustSet = new Set(); #_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc: (Object | URL)[] = []; - #_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc: Set = new Set(); + #_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc: VocabTrustSet = new Set(); #_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType: (string)[] = []; #_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration: (Temporal.Duration)[] = []; #_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive: (boolean)[] = []; #_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source: (Source)[] = []; #_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: (DataIntegrityProof | URL)[] = []; - #_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: Set = new Set(); + #_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: VocabTrustSet = new Set(); #_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy: (InteractionPolicy)[] = []; #_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy: (URL)[] = []; #_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: (LikeAuthorization | URL)[] = []; - #_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: Set = new Set(); + #_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: VocabTrustSet = new Set(); #_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: (ReplyAuthorization | URL)[] = []; - #_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: Set = new Set(); + #_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: VocabTrustSet = new Set(); #_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: (AnnounceAuthorization | URL)[] = []; - #_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: Set = new Set(); + #_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: VocabTrustSet = new Set(); #_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations: (Translation)[] = []; #_2rzkBRS4gNPrkJk9DohHAMUAxA2d: (URL)[] = []; @@ -380,14 +668,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu if (\\"attachments\\" in values && values.attachments != null) { - if (Array.isArray(values.attachments) && - values.attachments.every(v => v instanceof Object || v instanceof Link || v instanceof PropertyValue || v instanceof URL)) { + let copied!: (Object | Link | PropertyValue | URL)[]; + let valid = false; + if (Array.isArray(values.attachments)) { + const array = values.attachments; + const test = (v: Object | Link | PropertyValue | URL): boolean => v instanceof Object || v instanceof Link || v instanceof PropertyValue || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.attachments; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = values.attachments.slice(); + this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = copied; - for (let i = 0; i < values.attachments.length; i++) { - this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.add(i); - } + vocabSetTrustPrefix(this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment, this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.length); } else { throw new TypeError( @@ -420,14 +730,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.attributions) && - values.attributions.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.attributions)) { + const array = values.attributions; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.attributions; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = values.attributions.slice(); + this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = copied; - for (let i = 0; i < values.attributions.length; i++) { - this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.add(i); - } + vocabSetTrustPrefix(this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo, this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length); } else { throw new TypeError( @@ -460,14 +792,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.audiences) && - values.audiences.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.audiences)) { + const array = values.audiences; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.audiences; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = values.audiences.slice(); + this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = copied; - for (let i = 0; i < values.audiences.length; i++) { - this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.add(i); - } + vocabSetTrustPrefix(this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience, this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length); } else { throw new TypeError( @@ -500,10 +854,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.contents) && - values.contents.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.contents)) { + const array = values.contents; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.contents; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = values.contents.slice(); + this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = copied; } else { throw new TypeError( @@ -515,14 +893,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu if (\\"contexts\\" in values && values.contexts != null) { - if (Array.isArray(values.contexts) && - values.contexts.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.contexts)) { + const array = values.contexts; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.contexts; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = values.contexts.slice(); + this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = copied; - for (let i = 0; i < values.contexts.length; i++) { - this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context.add(i); - } + vocabSetTrustPrefix(this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context, this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context.length); } else { throw new TypeError( @@ -555,10 +955,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.names) && - values.names.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.names)) { + const array = values.names; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.names; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = values.names.slice(); + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = copied; } else { throw new TypeError( @@ -583,14 +1007,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu if (\\"generators\\" in values && values.generators != null) { - if (Array.isArray(values.generators) && - values.generators.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.generators)) { + const array = values.generators; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.generators; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = values.generators.slice(); + this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = copied; - for (let i = 0; i < values.generators.length; i++) { - this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator.add(i); - } + vocabSetTrustPrefix(this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator, this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator.length); } else { throw new TypeError( @@ -623,14 +1069,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.icons) && - values.icons.every(v => v instanceof Image || v instanceof URL)) { + let copied!: (Image | URL)[]; + let valid = false; + if (Array.isArray(values.icons)) { + const array = values.icons; + const test = (v: Image | URL): boolean => v instanceof Image || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.icons; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = values.icons.slice(); + this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = copied; - for (let i = 0; i < values.icons.length; i++) { - this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.add(i); - } + vocabSetTrustPrefix(this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon, this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length); } else { throw new TypeError( @@ -663,14 +1131,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.images) && - values.images.every(v => v instanceof Image || v instanceof URL)) { + let copied!: (Image | URL)[]; + let valid = false; + if (Array.isArray(values.images)) { + const array = values.images; + const test = (v: Image | URL): boolean => v instanceof Image || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.images; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = values.images.slice(); + this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = copied; - for (let i = 0; i < values.images.length; i++) { - this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.add(i); - } + vocabSetTrustPrefix(this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image, this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length); } else { throw new TypeError( @@ -703,14 +1193,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.replyTargets) && - values.replyTargets.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.replyTargets)) { + const array = values.replyTargets; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.replyTargets; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = values.replyTargets.slice(); + this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = copied; - for (let i = 0; i < values.replyTargets.length; i++) { - this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.add(i); - } + vocabSetTrustPrefix(this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo, this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length); } else { throw new TypeError( @@ -743,14 +1255,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.locations) && - values.locations.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.locations)) { + const array = values.locations; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.locations; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = values.locations.slice(); + this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = copied; - for (let i = 0; i < values.locations.length; i++) { - this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.add(i); - } + vocabSetTrustPrefix(this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location, this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length); } else { throw new TypeError( @@ -783,14 +1317,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.previews) && - values.previews.every(v => v instanceof Link || v instanceof Object || v instanceof URL)) { + let copied!: (Link | Object | URL)[]; + let valid = false; + if (Array.isArray(values.previews)) { + const array = values.previews; + const test = (v: Link | Object | URL): boolean => v instanceof Link || v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.previews; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = values.previews.slice(); + this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = copied; - for (let i = 0; i < values.previews.length; i++) { - this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.add(i); - } + vocabSetTrustPrefix(this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length); } else { throw new TypeError( @@ -901,10 +1457,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.summaries) && - values.summaries.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.summaries)) { + const array = values.summaries; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.summaries; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = values.summaries.slice(); + this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = copied; } else { throw new TypeError( @@ -916,14 +1496,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu if (\\"tags\\" in values && values.tags != null) { - if (Array.isArray(values.tags) && - values.tags.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.tags)) { + const array = values.tags; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.tags; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = values.tags.slice(); + this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = copied; - for (let i = 0; i < values.tags.length; i++) { - this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.add(i); - } + vocabSetTrustPrefix(this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag, this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag.length); } else { throw new TypeError( @@ -969,10 +1571,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.urls) && - values.urls.every(v => v instanceof URL || v instanceof Link)) { + let copied!: (URL | Link)[]; + let valid = false; + if (Array.isArray(values.urls)) { + const array = values.urls; + const test = (v: URL | Link): boolean => v instanceof URL || v instanceof Link; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.urls; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls.slice(); + this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = copied; } else { throw new TypeError( @@ -1005,14 +1631,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.tos) && - values.tos.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.tos)) { + const array = values.tos; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.tos; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = values.tos.slice(); + this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = copied; - for (let i = 0; i < values.tos.length; i++) { - this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.add(i); - } + vocabSetTrustPrefix(this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to, this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length); } else { throw new TypeError( @@ -1045,14 +1693,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.btos) && - values.btos.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.btos)) { + const array = values.btos; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.btos; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = values.btos.slice(); + this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = copied; - for (let i = 0; i < values.btos.length; i++) { - this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.add(i); - } + vocabSetTrustPrefix(this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto, this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length); } else { throw new TypeError( @@ -1085,14 +1755,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.ccs) && - values.ccs.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.ccs)) { + const array = values.ccs; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.ccs; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = values.ccs.slice(); + this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = copied; - for (let i = 0; i < values.ccs.length; i++) { - this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.add(i); - } + vocabSetTrustPrefix(this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc, this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length); } else { throw new TypeError( @@ -1125,14 +1817,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.bccs) && - values.bccs.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.bccs)) { + const array = values.bccs; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.bccs; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = values.bccs.slice(); + this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = copied; - for (let i = 0; i < values.bccs.length; i++) { - this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.add(i); - } + vocabSetTrustPrefix(this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc, this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length); } else { throw new TypeError( @@ -1217,14 +1931,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.proofs) && - values.proofs.every(v => v instanceof DataIntegrityProof || v instanceof URL)) { + let copied!: (DataIntegrityProof | URL)[]; + let valid = false; + if (Array.isArray(values.proofs)) { + const array = values.proofs; + const test = (v: DataIntegrityProof | URL): boolean => v instanceof DataIntegrityProof || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.proofs; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = values.proofs.slice(); + this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = copied; - for (let i = 0; i < values.proofs.length; i++) { - this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.add(i); - } + vocabSetTrustPrefix(this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof, this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length); } else { throw new TypeError( @@ -1301,10 +2037,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu if (\\"translations\\" in values && values.translations != null) { - if (Array.isArray(values.translations) && - values.translations.every(v => v instanceof Translation)) { + let copied!: (Translation)[]; + let valid = false; + if (Array.isArray(values.translations)) { + const array = values.translations; + const test = (v: Translation): boolean => v instanceof Translation; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.translations; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = values.translations.slice(); + this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = copied; } else { throw new TypeError( @@ -1316,10 +2076,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu if (\\"licenses\\" in values && values.licenses != null) { - if (Array.isArray(values.licenses) && - values.licenses.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.licenses)) { + const array = values.licenses; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.licenses; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = values.licenses.slice(); + this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = copied; } else { throw new TypeError( @@ -1341,8 +2125,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Object.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -1401,18 +2185,43 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu options ); copyPortableProvenance(this, clone); - clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.slice();clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment = new Set(this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment); + clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.length < vocabSparseArrayMinimumLength + ? this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.slice() : vocabCopyPropertyArray(this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment);clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment = vocabCopyTrustSet( + this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment, clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment, + ); if (\\"attachments\\" in values && values.attachments != null) { - if (Array.isArray(values.attachments) && - values.attachments.every(v => v instanceof Object || v instanceof Link || v instanceof PropertyValue || v instanceof URL)) { + let copied!: (Object | Link | PropertyValue | URL)[]; + let valid = false; + if (Array.isArray(values.attachments)) { + const array = values.attachments; + const test = (v: Object | Link | PropertyValue | URL): boolean => v instanceof Object || v instanceof Link || v instanceof PropertyValue || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.attachments; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = values.attachments.slice(); + clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = copied; clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment = new Set(); - for (let i = 0; i < values.attachments.length; i++) { - clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.add(i); - } + vocabSetTrustPrefix(clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment, clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.length); } else { throw new TypeError( @@ -1421,12 +2230,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.slice();clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = new Set(this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo); + clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length < vocabSparseArrayMinimumLength + ? this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.slice() : vocabCopyPropertyArray(this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo);clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = vocabCopyTrustSet( + this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo, clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo, + ); if (\\"attribution\\" in values && values.attribution != null) { if (values.attribution instanceof Application || values.attribution instanceof Group || values.attribution instanceof Organization || values.attribution instanceof Person || values.attribution instanceof Service || values.attribution instanceof URL) { // @ts-ignore: type is checked above. clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = [values.attribution]; - clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = new Set([0]); + clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = new Set(); + clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The attribution must be of type \\" + @@ -1445,15 +2258,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.attributions) && - values.attributions.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.attributions)) { + const array = values.attributions; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.attributions; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = values.attributions.slice(); + clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = copied; clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = new Set(); - for (let i = 0; i < values.attributions.length; i++) { - clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.add(i); - } + vocabSetTrustPrefix(clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo, clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length); } else { throw new TypeError( @@ -1462,12 +2297,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.slice();clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = new Set(this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience); + clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length < vocabSparseArrayMinimumLength + ? this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.slice() : vocabCopyPropertyArray(this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience);clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = vocabCopyTrustSet( + this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience, clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience, + ); if (\\"audience\\" in values && values.audience != null) { if (values.audience instanceof Object || values.audience instanceof URL) { // @ts-ignore: type is checked above. clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = [values.audience]; - clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = new Set([0]); + clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = new Set(); + clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The audience must be of type \\" + @@ -1486,15 +2325,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.audiences) && - values.audiences.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.audiences)) { + const array = values.audiences; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.audiences; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = values.audiences.slice(); + clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = copied; clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = new Set(); - for (let i = 0; i < values.audiences.length; i++) { - clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience, clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length); } else { throw new TypeError( @@ -1503,7 +2364,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.slice(); + clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length < vocabSparseArrayMinimumLength + ? this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.slice() : vocabCopyPropertyArray(this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content); if (\\"content\\" in values && values.content != null) { if (typeof values.content === \\"string\\" || values.content instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -1527,10 +2389,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.contents) && - values.contents.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.contents)) { + const array = values.contents; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.contents; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = values.contents.slice(); + clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = copied; } else { throw new TypeError( @@ -1539,18 +2425,43 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context.slice();clone.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context = new Set(this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context); + clone.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context.length < vocabSparseArrayMinimumLength + ? this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context.slice() : vocabCopyPropertyArray(this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context);clone.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context = vocabCopyTrustSet( + this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context, clone.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context, + ); if (\\"contexts\\" in values && values.contexts != null) { - if (Array.isArray(values.contexts) && - values.contexts.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.contexts)) { + const array = values.contexts; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.contexts; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = values.contexts.slice(); + clone.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = copied; clone.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context = new Set(); - for (let i = 0; i < values.contexts.length; i++) { - clone.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context, clone.#_3mhZzGXSpQ431mBSz2kvych22v4e_context.length); } else { throw new TypeError( @@ -1559,7 +2470,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.slice(); + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length < vocabSparseArrayMinimumLength + ? this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.slice() : vocabCopyPropertyArray(this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name); if (\\"name\\" in values && values.name != null) { if (typeof values.name === \\"string\\" || values.name instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -1583,10 +2495,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.names) && - values.names.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.names)) { + const array = values.names; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.names; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = values.names.slice(); + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = copied; } else { throw new TypeError( @@ -1595,7 +2531,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime.slice(); + clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime.length < vocabSparseArrayMinimumLength + ? this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime.slice() : vocabCopyPropertyArray(this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime); if (\\"endTime\\" in values && values.endTime != null) { if (isTemporalInstant(values.endTime)) { // @ts-ignore: type is checked above. @@ -1608,18 +2545,43 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator.slice();clone.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator = new Set(this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator); + clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator.length < vocabSparseArrayMinimumLength + ? this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator.slice() : vocabCopyPropertyArray(this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator);clone.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator = vocabCopyTrustSet( + this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator, clone.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator, + ); if (\\"generators\\" in values && values.generators != null) { - if (Array.isArray(values.generators) && - values.generators.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.generators)) { + const array = values.generators; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.generators; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = values.generators.slice(); + clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = copied; clone.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator = new Set(); - for (let i = 0; i < values.generators.length; i++) { - clone.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator.add(i); - } + vocabSetTrustPrefix(clone.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator, clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator.length); } else { throw new TypeError( @@ -1628,12 +2590,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.slice();clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = new Set(this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon); + clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length < vocabSparseArrayMinimumLength + ? this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.slice() : vocabCopyPropertyArray(this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon);clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = vocabCopyTrustSet( + this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon, clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon, + ); if (\\"icon\\" in values && values.icon != null) { if (values.icon instanceof Image || values.icon instanceof URL) { // @ts-ignore: type is checked above. clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = [values.icon]; - clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = new Set([0]); + clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = new Set(); + clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The icon must be of type \\" + @@ -1652,15 +2618,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.icons) && - values.icons.every(v => v instanceof Image || v instanceof URL)) { + let copied!: (Image | URL)[]; + let valid = false; + if (Array.isArray(values.icons)) { + const array = values.icons; + const test = (v: Image | URL): boolean => v instanceof Image || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.icons; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = values.icons.slice(); + clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = copied; clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = new Set(); - for (let i = 0; i < values.icons.length; i++) { - clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.add(i); - } + vocabSetTrustPrefix(clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon, clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length); } else { throw new TypeError( @@ -1669,12 +2657,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.slice();clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = new Set(this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image); + clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length < vocabSparseArrayMinimumLength + ? this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.slice() : vocabCopyPropertyArray(this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image);clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = vocabCopyTrustSet( + this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image, clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image, + ); if (\\"image\\" in values && values.image != null) { if (values.image instanceof Image || values.image instanceof URL) { // @ts-ignore: type is checked above. clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = [values.image]; - clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = new Set([0]); + clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = new Set(); + clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The image must be of type \\" + @@ -1693,15 +2685,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.images) && - values.images.every(v => v instanceof Image || v instanceof URL)) { + let copied!: (Image | URL)[]; + let valid = false; + if (Array.isArray(values.images)) { + const array = values.images; + const test = (v: Image | URL): boolean => v instanceof Image || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.images; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = values.images.slice(); + clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = copied; clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = new Set(); - for (let i = 0; i < values.images.length; i++) { - clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image, clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length); } else { throw new TypeError( @@ -1710,12 +2724,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.slice();clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = new Set(this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo); + clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length < vocabSparseArrayMinimumLength + ? this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.slice() : vocabCopyPropertyArray(this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo);clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = vocabCopyTrustSet( + this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo, clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo, + ); if (\\"replyTarget\\" in values && values.replyTarget != null) { if (values.replyTarget instanceof Object || values.replyTarget instanceof Link || values.replyTarget instanceof URL) { // @ts-ignore: type is checked above. clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = [values.replyTarget]; - clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = new Set([0]); + clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = new Set(); + clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The replyTarget must be of type \\" + @@ -1734,15 +2752,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.replyTargets) && - values.replyTargets.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.replyTargets)) { + const array = values.replyTargets; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.replyTargets; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = values.replyTargets.slice(); + clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = copied; clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = new Set(); - for (let i = 0; i < values.replyTargets.length; i++) { - clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo, clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length); } else { throw new TypeError( @@ -1751,12 +2791,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.slice();clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = new Set(this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location); + clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length < vocabSparseArrayMinimumLength + ? this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.slice() : vocabCopyPropertyArray(this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location);clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = vocabCopyTrustSet( + this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location, clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location, + ); if (\\"location\\" in values && values.location != null) { if (values.location instanceof Object || values.location instanceof Link || values.location instanceof URL) { // @ts-ignore: type is checked above. clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = [values.location]; - clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = new Set([0]); + clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = new Set(); + clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The location must be of type \\" + @@ -1775,15 +2819,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.locations) && - values.locations.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.locations)) { + const array = values.locations; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.locations; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = values.locations.slice(); + clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = copied; clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = new Set(); - for (let i = 0; i < values.locations.length; i++) { - clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.add(i); - } + vocabSetTrustPrefix(clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location, clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length); } else { throw new TypeError( @@ -1792,12 +2858,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.slice();clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = new Set(this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview); + clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length < vocabSparseArrayMinimumLength + ? this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.slice() : vocabCopyPropertyArray(this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview);clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = vocabCopyTrustSet( + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, + ); if (\\"preview\\" in values && values.preview != null) { if (values.preview instanceof Link || values.preview instanceof Object || values.preview instanceof URL) { // @ts-ignore: type is checked above. clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = [values.preview]; - clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = new Set([0]); + clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = new Set(); + clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The preview must be of type \\" + @@ -1816,15 +2886,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.previews) && - values.previews.every(v => v instanceof Link || v instanceof Object || v instanceof URL)) { + let copied!: (Link | Object | URL)[]; + let valid = false; + if (Array.isArray(values.previews)) { + const array = values.previews; + const test = (v: Link | Object | URL): boolean => v instanceof Link || v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.previews; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = values.previews.slice(); + clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = copied; clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = new Set(); - for (let i = 0; i < values.previews.length; i++) { - clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.add(i); - } + vocabSetTrustPrefix(clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length); } else { throw new TypeError( @@ -1833,7 +2925,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published.slice(); + clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published.length < vocabSparseArrayMinimumLength + ? this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published.slice() : vocabCopyPropertyArray(this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published); if (\\"published\\" in values && values.published != null) { if (isTemporalInstant(values.published)) { // @ts-ignore: type is checked above. @@ -1846,12 +2939,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_7UpwM3JWcXhADcscukEehBorf6k_replies = this.#_7UpwM3JWcXhADcscukEehBorf6k_replies.slice();clone.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies = new Set(this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies); + clone.#_7UpwM3JWcXhADcscukEehBorf6k_replies = this.#_7UpwM3JWcXhADcscukEehBorf6k_replies.length < vocabSparseArrayMinimumLength + ? this.#_7UpwM3JWcXhADcscukEehBorf6k_replies.slice() : vocabCopyPropertyArray(this.#_7UpwM3JWcXhADcscukEehBorf6k_replies);clone.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies = vocabCopyTrustSet( + this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies, clone.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies, + ); if (\\"replies\\" in values && values.replies != null) { if (values.replies instanceof Collection || values.replies instanceof URL) { // @ts-ignore: type is checked above. clone.#_7UpwM3JWcXhADcscukEehBorf6k_replies = [values.replies]; - clone.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies = new Set([0]); + clone.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies = new Set(); + clone.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The replies must be of type \\" + @@ -1859,12 +2956,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares = this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares.slice();clone.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares = new Set(this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares); + clone.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares = this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares.length < vocabSparseArrayMinimumLength + ? this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares.slice() : vocabCopyPropertyArray(this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares);clone.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares = vocabCopyTrustSet( + this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares, clone.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares, + ); if (\\"shares\\" in values && values.shares != null) { if (values.shares instanceof Collection || values.shares instanceof URL) { // @ts-ignore: type is checked above. clone.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares = [values.shares]; - clone.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares = new Set([0]); + clone.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares = new Set(); + clone.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The shares must be of type \\" + @@ -1872,12 +2973,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.slice();clone.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = new Set(this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes); + clone.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.length < vocabSparseArrayMinimumLength + ? this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.slice() : vocabCopyPropertyArray(this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes);clone.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = vocabCopyTrustSet( + this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes, clone.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes, + ); if (\\"likes\\" in values && values.likes != null) { if (values.likes instanceof Collection || values.likes instanceof URL) { // @ts-ignore: type is checked above. clone.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = [values.likes]; - clone.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = new Set([0]); + clone.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = new Set(); + clone.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The likes must be of type \\" + @@ -1885,12 +2990,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.slice();clone.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = new Set(this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions); + clone.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.length < vocabSparseArrayMinimumLength + ? this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.slice() : vocabCopyPropertyArray(this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions);clone.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = vocabCopyTrustSet( + this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions, clone.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions, + ); if (\\"emojiReactions\\" in values && values.emojiReactions != null) { if (values.emojiReactions instanceof Collection || values.emojiReactions instanceof URL) { // @ts-ignore: type is checked above. clone.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = [values.emojiReactions]; - clone.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = new Set([0]); + clone.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = new Set(); + clone.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The emojiReactions must be of type \\" + @@ -1898,7 +3007,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime.slice(); + clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime.length < vocabSparseArrayMinimumLength + ? this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime.slice() : vocabCopyPropertyArray(this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime); if (\\"startTime\\" in values && values.startTime != null) { if (isTemporalInstant(values.startTime)) { // @ts-ignore: type is checked above. @@ -1911,7 +3021,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.slice(); + clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.length < vocabSparseArrayMinimumLength + ? this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.slice() : vocabCopyPropertyArray(this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary); if (\\"summary\\" in values && values.summary != null) { if (typeof values.summary === \\"string\\" || values.summary instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -1935,10 +3046,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.summaries) && - values.summaries.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.summaries)) { + const array = values.summaries; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.summaries; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = values.summaries.slice(); + clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = copied; } else { throw new TypeError( @@ -1947,18 +3082,43 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag.slice();clone.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag = new Set(this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag); + clone.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag.length < vocabSparseArrayMinimumLength + ? this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag.slice() : vocabCopyPropertyArray(this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag);clone.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag = vocabCopyTrustSet( + this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag, clone.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag, + ); if (\\"tags\\" in values && values.tags != null) { - if (Array.isArray(values.tags) && - values.tags.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.tags)) { + const array = values.tags; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.tags; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = values.tags.slice(); + clone.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = copied; clone.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag = new Set(); - for (let i = 0; i < values.tags.length; i++) { - clone.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.add(i); - } + vocabSetTrustPrefix(clone.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag, clone.#_5chuqj6s95p5gg2sk1HntGfarRf_tag.length); } else { throw new TypeError( @@ -1967,7 +3127,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated.slice(); + clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated.length < vocabSparseArrayMinimumLength + ? this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated.slice() : vocabCopyPropertyArray(this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated); if (\\"updated\\" in values && values.updated != null) { if (isTemporalInstant(values.updated)) { // @ts-ignore: type is checked above. @@ -1980,7 +3141,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.slice(); + clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length < vocabSparseArrayMinimumLength + ? this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.slice() : vocabCopyPropertyArray(this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url); if (\\"url\\" in values && values.url != null) { if (values.url instanceof URL || values.url instanceof Link) { // @ts-ignore: type is checked above. @@ -2004,10 +3166,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.urls) && - values.urls.every(v => v instanceof URL || v instanceof Link)) { + let copied!: (URL | Link)[]; + let valid = false; + if (Array.isArray(values.urls)) { + const array = values.urls; + const test = (v: URL | Link): boolean => v instanceof URL || v instanceof Link; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.urls; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls.slice(); + clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = copied; } else { throw new TypeError( @@ -2016,12 +3202,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.slice();clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = new Set(this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to); + clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length < vocabSparseArrayMinimumLength + ? this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.slice() : vocabCopyPropertyArray(this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to);clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = vocabCopyTrustSet( + this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to, clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to, + ); if (\\"to\\" in values && values.to != null) { if (values.to instanceof Object || values.to instanceof URL) { // @ts-ignore: type is checked above. clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = [values.to]; - clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = new Set([0]); + clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = new Set(); + clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The to must be of type \\" + @@ -2040,15 +3230,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.tos) && - values.tos.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.tos)) { + const array = values.tos; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.tos; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = values.tos.slice(); + clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = copied; clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = new Set(); - for (let i = 0; i < values.tos.length; i++) { - clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to, clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length); } else { throw new TypeError( @@ -2057,12 +3269,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.slice();clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = new Set(this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto); + clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length < vocabSparseArrayMinimumLength + ? this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.slice() : vocabCopyPropertyArray(this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto);clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = vocabCopyTrustSet( + this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto, clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto, + ); if (\\"bto\\" in values && values.bto != null) { if (values.bto instanceof Object || values.bto instanceof URL) { // @ts-ignore: type is checked above. clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = [values.bto]; - clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = new Set([0]); + clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = new Set(); + clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The bto must be of type \\" + @@ -2081,15 +3297,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.btos) && - values.btos.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.btos)) { + const array = values.btos; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.btos; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = values.btos.slice(); + clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = copied; clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = new Set(); - for (let i = 0; i < values.btos.length; i++) { - clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.add(i); - } + vocabSetTrustPrefix(clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto, clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length); } else { throw new TypeError( @@ -2098,12 +3336,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.slice();clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = new Set(this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc); + clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length < vocabSparseArrayMinimumLength + ? this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.slice() : vocabCopyPropertyArray(this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc);clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = vocabCopyTrustSet( + this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc, clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc, + ); if (\\"cc\\" in values && values.cc != null) { if (values.cc instanceof Object || values.cc instanceof URL) { // @ts-ignore: type is checked above. clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = [values.cc]; - clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = new Set([0]); + clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = new Set(); + clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The cc must be of type \\" + @@ -2122,15 +3364,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.ccs) && - values.ccs.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.ccs)) { + const array = values.ccs; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.ccs; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = values.ccs.slice(); + clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = copied; clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = new Set(); - for (let i = 0; i < values.ccs.length; i++) { - clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.add(i); - } + vocabSetTrustPrefix(clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc, clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length); } else { throw new TypeError( @@ -2139,12 +3403,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.slice();clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = new Set(this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc); + clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length < vocabSparseArrayMinimumLength + ? this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.slice() : vocabCopyPropertyArray(this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc);clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = vocabCopyTrustSet( + this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc, clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc, + ); if (\\"bcc\\" in values && values.bcc != null) { if (values.bcc instanceof Object || values.bcc instanceof URL) { // @ts-ignore: type is checked above. clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = [values.bcc]; - clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = new Set([0]); + clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = new Set(); + clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The bcc must be of type \\" + @@ -2163,15 +3431,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.bccs) && - values.bccs.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.bccs)) { + const array = values.bccs; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.bccs; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = values.bccs.slice(); + clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = copied; clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = new Set(); - for (let i = 0; i < values.bccs.length; i++) { - clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc, clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length); } else { throw new TypeError( @@ -2180,7 +3470,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.slice(); + clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.length < vocabSparseArrayMinimumLength + ? this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.slice() : vocabCopyPropertyArray(this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType); if (\\"mediaType\\" in values && values.mediaType != null) { if (typeof values.mediaType === \\"string\\") { // @ts-ignore: type is checked above. @@ -2193,7 +3484,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration.slice(); + clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration.length < vocabSparseArrayMinimumLength + ? this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration.slice() : vocabCopyPropertyArray(this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration); if (\\"duration\\" in values && values.duration != null) { if (isTemporalDuration(values.duration)) { // @ts-ignore: type is checked above. @@ -2206,7 +3498,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive.slice(); + clone.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive.length < vocabSparseArrayMinimumLength + ? this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive.slice() : vocabCopyPropertyArray(this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive); if (\\"sensitive\\" in values && values.sensitive != null) { if (typeof values.sensitive === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -2219,7 +3512,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.slice(); + clone.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.length < vocabSparseArrayMinimumLength + ? this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.slice() : vocabCopyPropertyArray(this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source); if (\\"source\\" in values && values.source != null) { if (values.source instanceof Source) { // @ts-ignore: type is checked above. @@ -2232,12 +3526,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.slice();clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = new Set(this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof); + clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length < vocabSparseArrayMinimumLength + ? this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.slice() : vocabCopyPropertyArray(this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof);clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = vocabCopyTrustSet( + this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof, clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof, + ); if (\\"proof\\" in values && values.proof != null) { if (values.proof instanceof DataIntegrityProof || values.proof instanceof URL) { // @ts-ignore: type is checked above. clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = [values.proof]; - clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = new Set([0]); + clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = new Set(); + clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The proof must be of type \\" + @@ -2256,15 +3554,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.proofs) && - values.proofs.every(v => v instanceof DataIntegrityProof || v instanceof URL)) { + let copied!: (DataIntegrityProof | URL)[]; + let valid = false; + if (Array.isArray(values.proofs)) { + const array = values.proofs; + const test = (v: DataIntegrityProof | URL): boolean => v instanceof DataIntegrityProof || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.proofs; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = values.proofs.slice(); + clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = copied; clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = new Set(); - for (let i = 0; i < values.proofs.length; i++) { - clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.add(i); - } + vocabSetTrustPrefix(clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof, clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length); } else { throw new TypeError( @@ -2273,7 +3593,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy = this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.slice(); + clone.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy = this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.length < vocabSparseArrayMinimumLength + ? this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.slice() : vocabCopyPropertyArray(this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy); if (\\"interactionPolicy\\" in values && values.interactionPolicy != null) { if (values.interactionPolicy instanceof InteractionPolicy) { // @ts-ignore: type is checked above. @@ -2286,7 +3607,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.slice(); + clone.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.length < vocabSparseArrayMinimumLength + ? this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.slice() : vocabCopyPropertyArray(this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy); if (\\"approvedBy\\" in values && values.approvedBy != null) { if (values.approvedBy instanceof URL) { // @ts-ignore: type is checked above. @@ -2299,12 +3621,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.slice();clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = new Set(this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization); + clone.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.slice() : vocabCopyPropertyArray(this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization);clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = vocabCopyTrustSet( + this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization, clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization, + ); if (\\"likeAuthorization\\" in values && values.likeAuthorization != null) { if (values.likeAuthorization instanceof LikeAuthorization || values.likeAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = [values.likeAuthorization]; - clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = new Set([0]); + clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = new Set(); + clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The likeAuthorization must be of type \\" + @@ -2312,12 +3638,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.slice();clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = new Set(this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization); + clone.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.slice() : vocabCopyPropertyArray(this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization);clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = vocabCopyTrustSet( + this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization, clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization, + ); if (\\"replyAuthorization\\" in values && values.replyAuthorization != null) { if (values.replyAuthorization instanceof ReplyAuthorization || values.replyAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = [values.replyAuthorization]; - clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = new Set([0]); + clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = new Set(); + clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The replyAuthorization must be of type \\" + @@ -2325,12 +3655,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.slice();clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = new Set(this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization); + clone.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.slice() : vocabCopyPropertyArray(this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization);clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = vocabCopyTrustSet( + this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization, clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization, + ); if (\\"announceAuthorization\\" in values && values.announceAuthorization != null) { if (values.announceAuthorization instanceof AnnounceAuthorization || values.announceAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = [values.announceAuthorization]; - clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = new Set([0]); + clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = new Set(); + clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The announceAuthorization must be of type \\" + @@ -2338,13 +3672,38 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.slice(); + clone.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.length < vocabSparseArrayMinimumLength + ? this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.slice() : vocabCopyPropertyArray(this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations); if (\\"translations\\" in values && values.translations != null) { - if (Array.isArray(values.translations) && - values.translations.every(v => v instanceof Translation)) { + let copied!: (Translation)[]; + let valid = false; + if (Array.isArray(values.translations)) { + const array = values.translations; + const test = (v: Translation): boolean => v instanceof Translation; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.translations; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = values.translations.slice(); + clone.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = copied; } else { throw new TypeError( @@ -2353,13 +3712,38 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.slice(); + clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.length < vocabSparseArrayMinimumLength + ? this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.slice() : vocabCopyPropertyArray(this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d); if (\\"licenses\\" in values && values.licenses != null) { - if (Array.isArray(values.licenses) && - values.licenses.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.licenses)) { + const array = values.licenses; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.licenses; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = values.licenses.slice(); + clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = copied; } else { throw new TypeError( @@ -2371,7 +3755,733 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Object { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Object; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Object; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.length; i++) { + const value = node.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment[i]; + if (value != null && typeof value === \\"object\\") { + node.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment[i] = context.value(value); + } + } + } + } + + { + const array = node.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length; i++) { + const value = node.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[i]; + if (value != null && typeof value === \\"object\\") { + node.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length; i++) { + const value = node.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3mhZzGXSpQ431mBSz2kvych22v4e_context; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3mhZzGXSpQ431mBSz2kvych22v4e_context.length; i++) { + const value = node.#_3mhZzGXSpQ431mBSz2kvych22v4e_context[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3mhZzGXSpQ431mBSz2kvych22v4e_context[i] = context.value(value); + } + } + } + } + + { + const array = node.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator.length; i++) { + const value = node.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator[i]; + if (value != null && typeof value === \\"object\\") { + node.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator[i] = context.value(value); + } + } + } + } + + { + const array = node.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length; i++) { + const value = node.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[i]; + if (value != null && typeof value === \\"object\\") { + node.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length; i++) { + const value = node.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length; i++) { + const value = node.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length; i++) { + const value = node.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[i]; + if (value != null && typeof value === \\"object\\") { + node.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[i] = context.value(value); + } + } + } + } + + { + const array = node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length; i++) { + const value = node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview[i]; + if (value != null && typeof value === \\"object\\") { + node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview[i] = context.value(value); + } + } + } + } + + { + const array = node.#_7UpwM3JWcXhADcscukEehBorf6k_replies; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_7UpwM3JWcXhADcscukEehBorf6k_replies.length; i++) { + const value = node.#_7UpwM3JWcXhADcscukEehBorf6k_replies[i]; + if (value != null && typeof value === \\"object\\") { + node.#_7UpwM3JWcXhADcscukEehBorf6k_replies[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares.length; i++) { + const value = node.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares[i] = context.value(value); + } + } + } + } + + { + const array = node.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.length; i++) { + const value = node.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[i]; + if (value != null && typeof value === \\"object\\") { + node.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[i] = context.value(value); + } + } + } + } + + { + const array = node.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.length; i++) { + const value = node.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[i]; + if (value != null && typeof value === \\"object\\") { + node.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[i] = context.value(value); + } + } + } + } + + { + const array = node.#_5chuqj6s95p5gg2sk1HntGfarRf_tag; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_5chuqj6s95p5gg2sk1HntGfarRf_tag.length; i++) { + const value = node.#_5chuqj6s95p5gg2sk1HntGfarRf_tag[i]; + if (value != null && typeof value === \\"object\\") { + node.#_5chuqj6s95p5gg2sk1HntGfarRf_tag[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length; i++) { + const value = node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length; i++) { + const value = node.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[i] = context.value(value); + } + } + } + } + + { + const array = node.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length; i++) { + const value = node.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[i]; + if (value != null && typeof value === \\"object\\") { + node.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[i] = context.value(value); + } + } + } + } + + { + const array = node.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length; i++) { + const value = node.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[i]; + if (value != null && typeof value === \\"object\\") { + node.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length; i++) { + const value = node.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.length; i++) { + const value = node.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source[i] = context.value(value); + } + } + } + } + + { + const array = node.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length; i++) { + const value = node.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[i]; + if (value != null && typeof value === \\"object\\") { + node.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.length; i++) { + const value = node.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy[i] = context.value(value); + } + } + } + } + + { + const array = node.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.length; i++) { + const value = node.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy[i]; + if (value != null && typeof value === \\"object\\") { + node.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.length; i++) { + const value = node.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[i] = context.value(value); + } + } + } + } + + { + const array = node.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.length; i++) { + const value = node.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[i]; + if (value != null && typeof value === \\"object\\") { + node.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[i] = context.value(value); + } + } + } + } + + { + const array = node.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.length; i++) { + const value = node.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[i]; + if (value != null && typeof value === \\"object\\") { + node.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[i] = context.value(value); + } + } + } + } + + { + const array = node.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.length; i++) { + const value = node.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations[i]; + if (value != null && typeof value === \\"object\\") { + node.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.length; i++) { + const value = node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d[i] = context.value(value); + } + } + } + } +} }); } + async #fetchAttachment( url: URL, options: { @@ -2730,7 +4840,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(i)) { + !(i < (this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment[vocabTrustPrefix] ?? 0) || + this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#attachment\\"); @@ -2802,7 +4913,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(i)) { + !(i < (this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment[vocabTrustPrefix] ?? 0) || + this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -3215,7 +5327,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0]; if (!(v instanceof URL) && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { + !(0 < (this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#attributedTo\\"); @@ -3283,7 +5396,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { + !(0 < (this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -3373,7 +5487,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(i)) { + !(i < (this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#attributedTo\\"); @@ -3445,7 +5560,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(i)) { + !(i < (this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -3797,7 +5913,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0]; if (!(v instanceof URL) && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + !(0 < (this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[vocabTrustPrefix] ?? 0) || + this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#audience\\"); @@ -3865,7 +5982,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + !(0 < (this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[vocabTrustPrefix] ?? 0) || + this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -3954,7 +6072,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(i)) { + !(i < (this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[vocabTrustPrefix] ?? 0) || + this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#audience\\"); @@ -4026,7 +6145,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(i)) { + !(i < (this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[vocabTrustPrefix] ?? 0) || + this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -4427,7 +6547,8 @@ get contents(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context.has(i)) { + !(i < (this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context[vocabTrustPrefix] ?? 0) || + this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#context\\"); @@ -4499,7 +6620,8 @@ get contents(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context.has(i)) { + !(i < (this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context[vocabTrustPrefix] ?? 0) || + this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -4907,7 +7029,8 @@ get names(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator.has(i)) { + !(i < (this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator[vocabTrustPrefix] ?? 0) || + this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#generator\\"); @@ -4979,7 +7102,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator.has(i)) { + !(i < (this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator[vocabTrustPrefix] ?? 0) || + this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -5354,7 +7478,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[0]; if (!(v instanceof URL) && - !this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(0)) { + !(0 < (this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[vocabTrustPrefix] ?? 0) || + this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#icon\\"); @@ -5422,7 +7547,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(0)) { + !(0 < (this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[vocabTrustPrefix] ?? 0) || + this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -5512,7 +7638,8 @@ get names(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(i)) { + !(i < (this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[vocabTrustPrefix] ?? 0) || + this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#icon\\"); @@ -5584,7 +7711,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(i)) { + !(i < (this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[vocabTrustPrefix] ?? 0) || + this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -5959,7 +8087,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[0]; if (!(v instanceof URL) && - !this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(0)) { + !(0 < (this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[vocabTrustPrefix] ?? 0) || + this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#image\\"); @@ -6027,7 +8156,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(0)) { + !(0 < (this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[vocabTrustPrefix] ?? 0) || + this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -6117,7 +8247,8 @@ get names(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(i)) { + !(i < (this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[vocabTrustPrefix] ?? 0) || + this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#image\\"); @@ -6189,7 +8320,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(i)) { + !(i < (this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[vocabTrustPrefix] ?? 0) || + this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -6556,7 +8688,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[0]; if (!(v instanceof URL) && - !this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(0)) { + !(0 < (this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[vocabTrustPrefix] ?? 0) || + this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#inReplyTo\\"); @@ -6624,7 +8757,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(0)) { + !(0 < (this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[vocabTrustPrefix] ?? 0) || + this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -6713,7 +8847,8 @@ get names(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(i)) { + !(i < (this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[vocabTrustPrefix] ?? 0) || + this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#inReplyTo\\"); @@ -6785,7 +8920,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(i)) { + !(i < (this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[vocabTrustPrefix] ?? 0) || + this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -7152,7 +9288,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[0]; if (!(v instanceof URL) && - !this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(0)) { + !(0 < (this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[vocabTrustPrefix] ?? 0) || + this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#location\\"); @@ -7220,7 +9357,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(0)) { + !(0 < (this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[vocabTrustPrefix] ?? 0) || + this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -7309,7 +9447,8 @@ get names(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(i)) { + !(i < (this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[vocabTrustPrefix] ?? 0) || + this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#location\\"); @@ -7381,7 +9520,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(i)) { + !(i < (this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[vocabTrustPrefix] ?? 0) || + this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -7747,7 +9887,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview[0]; if (!(v instanceof URL) && - !this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(0)) { + !(0 < (this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview[vocabTrustPrefix] ?? 0) || + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#preview\\"); @@ -7815,7 +9956,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(0)) { + !(0 < (this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview[vocabTrustPrefix] ?? 0) || + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -7903,7 +10045,8 @@ get names(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i)) { + !(i < (this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview[vocabTrustPrefix] ?? 0) || + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#preview\\"); @@ -7975,7 +10118,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i)) { + !(i < (this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview[vocabTrustPrefix] ?? 0) || + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -8340,7 +10484,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_7UpwM3JWcXhADcscukEehBorf6k_replies[0]; if (!(v instanceof URL) && - !this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies.has(0)) { + !(0 < (this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies[vocabTrustPrefix] ?? 0) || + this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#replies\\"); @@ -8408,7 +10553,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies.has(0)) { + !(0 < (this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies[vocabTrustPrefix] ?? 0) || + this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -8765,7 +10911,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares[0]; if (!(v instanceof URL) && - !this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares.has(0)) { + !(0 < (this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares[vocabTrustPrefix] ?? 0) || + this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#shares\\"); @@ -8833,7 +10980,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares.has(0)) { + !(0 < (this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares[vocabTrustPrefix] ?? 0) || + this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -9190,7 +11338,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[0]; if (!(v instanceof URL) && - !this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.has(0)) { + !(0 < (this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[vocabTrustPrefix] ?? 0) || + this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#likes\\"); @@ -9258,7 +11407,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.has(0)) { + !(0 < (this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[vocabTrustPrefix] ?? 0) || + this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -9609,7 +11759,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[0]; if (!(v instanceof URL) && - !this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.has(0)) { + !(0 < (this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[vocabTrustPrefix] ?? 0) || + this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://fedibird.com/ns#emojiReactions\\"); @@ -9677,7 +11828,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.has(0)) { + !(0 < (this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[vocabTrustPrefix] ?? 0) || + this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -10085,7 +12237,8 @@ get summaries(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.has(i)) { + !(i < (this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag[vocabTrustPrefix] ?? 0) || + this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#tag\\"); @@ -10157,7 +12310,8 @@ get summaries(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.has(i)) { + !(i < (this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag[vocabTrustPrefix] ?? 0) || + this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -10543,7 +12697,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[0]; if (!(v instanceof URL) && - !this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(0)) { + !(0 < (this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[vocabTrustPrefix] ?? 0) || + this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#to\\"); @@ -10611,7 +12766,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(0)) { + !(0 < (this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[vocabTrustPrefix] ?? 0) || + this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -10700,7 +12856,8 @@ get urls(): ((URL | Link))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(i)) { + !(i < (this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[vocabTrustPrefix] ?? 0) || + this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#to\\"); @@ -10772,7 +12929,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(i)) { + !(i < (this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[vocabTrustPrefix] ?? 0) || + this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -11124,7 +13282,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[0]; if (!(v instanceof URL) && - !this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(0)) { + !(0 < (this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[vocabTrustPrefix] ?? 0) || + this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#bto\\"); @@ -11192,7 +13351,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(0)) { + !(0 < (this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[vocabTrustPrefix] ?? 0) || + this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -11281,7 +13441,8 @@ get urls(): ((URL | Link))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(i)) { + !(i < (this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[vocabTrustPrefix] ?? 0) || + this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#bto\\"); @@ -11353,7 +13514,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(i)) { + !(i < (this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[vocabTrustPrefix] ?? 0) || + this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -11705,7 +13867,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[0]; if (!(v instanceof URL) && - !this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(0)) { + !(0 < (this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[vocabTrustPrefix] ?? 0) || + this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#cc\\"); @@ -11773,7 +13936,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(0)) { + !(0 < (this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[vocabTrustPrefix] ?? 0) || + this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -11862,7 +14026,8 @@ get urls(): ((URL | Link))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(i)) { + !(i < (this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[vocabTrustPrefix] ?? 0) || + this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#cc\\"); @@ -11934,7 +14099,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(i)) { + !(i < (this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[vocabTrustPrefix] ?? 0) || + this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -12286,7 +14452,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[0]; if (!(v instanceof URL) && - !this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(0)) { + !(0 < (this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[vocabTrustPrefix] ?? 0) || + this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#bcc\\"); @@ -12354,7 +14521,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(0)) { + !(0 < (this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[vocabTrustPrefix] ?? 0) || + this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -12443,7 +14611,8 @@ get urls(): ((URL | Link))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(i)) { + !(i < (this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[vocabTrustPrefix] ?? 0) || + this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#bcc\\"); @@ -12515,7 +14684,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(i)) { + !(i < (this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[vocabTrustPrefix] ?? 0) || + this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -12930,7 +15100,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[0]; if (!(v instanceof URL) && - !this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(0)) { + !(0 < (this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[vocabTrustPrefix] ?? 0) || + this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#proof\\"); @@ -12998,7 +15169,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(0)) { + !(0 < (this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[vocabTrustPrefix] ?? 0) || + this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -13086,7 +15258,8 @@ get urls(): ((URL | Link))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(i)) { + !(i < (this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[vocabTrustPrefix] ?? 0) || + this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#proof\\"); @@ -13158,7 +15331,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(i)) { + !(i < (this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[vocabTrustPrefix] ?? 0) || + this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -13549,7 +15723,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.has(0)) { + !(0 < (this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#likeAuthorization\\"); @@ -13617,7 +15792,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.has(0)) { + !(0 < (this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -13968,7 +16144,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.has(0)) { + !(0 < (this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#replyAuthorization\\"); @@ -14036,7 +16213,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.has(0)) { + !(0 < (this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -14387,7 +16565,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.has(0)) { + !(0 < (this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#announceAuthorization\\"); @@ -14455,7 +16634,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.has(0)) { + !(0 < (this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -16667,7 +18847,7 @@ get licenses(): (URL)[] { let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _49BipA5dq9eoH8LX8xdsVumveTca_attachment: (Object | Link | PropertyValue | URL)[] = []; - const _trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment: Set = new Set(); + const _trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment: VocabTrustSet = new Set(); let _49BipA5dq9eoH8LX8xdsVumveTca_attachment__array = values[\\"https://www.w3.org/ns/activitystreams#attachment\\"]; @@ -16719,7 +18899,7 @@ get licenses(): (URL)[] { instance.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = _49BipA5dq9eoH8LX8xdsVumveTca_attachment; const _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: Set = new Set(); + const _trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: VocabTrustSet = new Set(); let _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo__array = values[\\"https://www.w3.org/ns/activitystreams#attributedTo\\"]; @@ -16777,7 +18957,7 @@ get licenses(): (URL)[] { instance.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo; const _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience: (Object | URL)[] = []; - const _trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience: Set = new Set(); + const _trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience: VocabTrustSet = new Set(); let _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience__array = values[\\"https://www.w3.org/ns/activitystreams#audience\\"]; @@ -16851,7 +19031,7 @@ get licenses(): (URL)[] { instance.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content; const _3mhZzGXSpQ431mBSz2kvych22v4e_context: (Object | Link | URL)[] = []; - const _trust_3mhZzGXSpQ431mBSz2kvych22v4e_context: Set = new Set(); + const _trust_3mhZzGXSpQ431mBSz2kvych22v4e_context: VocabTrustSet = new Set(); let _3mhZzGXSpQ431mBSz2kvych22v4e_context__array = values[\\"https://www.w3.org/ns/activitystreams#context\\"]; @@ -16965,7 +19145,7 @@ get licenses(): (URL)[] { instance.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime; const _86xFhmgBapoMvYqjbjRuDPayTrS_generator: (Object | Link | URL)[] = []; - const _trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator: Set = new Set(); + const _trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator: VocabTrustSet = new Set(); let _86xFhmgBapoMvYqjbjRuDPayTrS_generator__array = values[\\"https://www.w3.org/ns/activitystreams#generator\\"]; @@ -17013,7 +19193,7 @@ get licenses(): (URL)[] { instance.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = _86xFhmgBapoMvYqjbjRuDPayTrS_generator; const _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon: (Image | URL)[] = []; - const _trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon: Set = new Set(); + const _trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon: VocabTrustSet = new Set(); let _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon__array = values[\\"https://www.w3.org/ns/activitystreams#icon\\"]; @@ -17077,7 +19257,7 @@ get licenses(): (URL)[] { instance.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon; const _3dXrUdkARxwyJLtJcYi1AJ92H41U_image: (Image | URL)[] = []; - const _trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image: Set = new Set(); + const _trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image: VocabTrustSet = new Set(); let _3dXrUdkARxwyJLtJcYi1AJ92H41U_image__array = values[\\"https://www.w3.org/ns/activitystreams#image\\"]; @@ -17141,7 +19321,7 @@ get licenses(): (URL)[] { instance.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = _3dXrUdkARxwyJLtJcYi1AJ92H41U_image; const _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo: (Object | Link | URL)[] = []; - const _trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo: Set = new Set(); + const _trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo: VocabTrustSet = new Set(); let _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo__array = values[\\"https://www.w3.org/ns/activitystreams#inReplyTo\\"]; @@ -17189,7 +19369,7 @@ get licenses(): (URL)[] { instance.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo; const _31k5MUZJsnsPNg8dQQJieWaXTFnR_location: (Object | Link | URL)[] = []; - const _trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location: Set = new Set(); + const _trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location: VocabTrustSet = new Set(); let _31k5MUZJsnsPNg8dQQJieWaXTFnR_location__array = values[\\"https://www.w3.org/ns/activitystreams#location\\"]; @@ -17237,7 +19417,7 @@ get licenses(): (URL)[] { instance.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = _31k5MUZJsnsPNg8dQQJieWaXTFnR_location; const _gCVTegXxWWCw6wWRxa1QF65zusg_preview: (Link | Object | URL)[] = []; - const _trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: Set = new Set(); + const _trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: VocabTrustSet = new Set(); let _gCVTegXxWWCw6wWRxa1QF65zusg_preview__array = values[\\"https://www.w3.org/ns/activitystreams#preview\\"]; @@ -17318,7 +19498,7 @@ get licenses(): (URL)[] { instance.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = _5e258TDXtuhaFRPZiGoDfEpjdMr_published; const _7UpwM3JWcXhADcscukEehBorf6k_replies: (Collection | URL)[] = []; - const _trust_7UpwM3JWcXhADcscukEehBorf6k_replies: Set = new Set(); + const _trust_7UpwM3JWcXhADcscukEehBorf6k_replies: VocabTrustSet = new Set(); let _7UpwM3JWcXhADcscukEehBorf6k_replies__array = values[\\"https://www.w3.org/ns/activitystreams#replies\\"]; @@ -17359,7 +19539,7 @@ get licenses(): (URL)[] { instance.#_7UpwM3JWcXhADcscukEehBorf6k_replies = _7UpwM3JWcXhADcscukEehBorf6k_replies; const _3kAfck9PcEYt2L7xug5y99YPbANs_shares: (Collection | URL)[] = []; - const _trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares: Set = new Set(); + const _trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares: VocabTrustSet = new Set(); let _3kAfck9PcEYt2L7xug5y99YPbANs_shares__array = values[\\"https://www.w3.org/ns/activitystreams#shares\\"]; @@ -17400,7 +19580,7 @@ get licenses(): (URL)[] { instance.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares = _3kAfck9PcEYt2L7xug5y99YPbANs_shares; const _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes: (Collection | URL)[] = []; - const _trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes: Set = new Set(); + const _trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes: VocabTrustSet = new Set(); let _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes__array = values[\\"https://www.w3.org/ns/activitystreams#likes\\"]; @@ -17441,7 +19621,7 @@ get licenses(): (URL)[] { instance.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes; const _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: (Collection | URL)[] = []; - const _trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: Set = new Set(); + const _trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: VocabTrustSet = new Set(); let _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions__array = values[\\"http://fedibird.com/ns#emojiReactions\\"]; @@ -17548,7 +19728,7 @@ get licenses(): (URL)[] { instance.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary; const _5chuqj6s95p5gg2sk1HntGfarRf_tag: (Object | Link | URL)[] = []; - const _trust_5chuqj6s95p5gg2sk1HntGfarRf_tag: Set = new Set(); + const _trust_5chuqj6s95p5gg2sk1HntGfarRf_tag: VocabTrustSet = new Set(); let _5chuqj6s95p5gg2sk1HntGfarRf_tag__array = values[\\"https://www.w3.org/ns/activitystreams#tag\\"]; @@ -17665,7 +19845,7 @@ get licenses(): (URL)[] { instance.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; const _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to: (Object | URL)[] = []; - const _trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to: Set = new Set(); + const _trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to: VocabTrustSet = new Set(); let _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to__array = values[\\"https://www.w3.org/ns/activitystreams#to\\"]; @@ -17706,7 +19886,7 @@ get licenses(): (URL)[] { instance.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to; const _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto: (Object | URL)[] = []; - const _trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto: Set = new Set(); + const _trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto: VocabTrustSet = new Set(); let _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto__array = values[\\"https://www.w3.org/ns/activitystreams#bto\\"]; @@ -17747,7 +19927,7 @@ get licenses(): (URL)[] { instance.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto; const _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc: (Object | URL)[] = []; - const _trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc: Set = new Set(); + const _trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc: VocabTrustSet = new Set(); let _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc__array = values[\\"https://www.w3.org/ns/activitystreams#cc\\"]; @@ -17788,7 +19968,7 @@ get licenses(): (URL)[] { instance.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc; const _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc: (Object | URL)[] = []; - const _trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc: Set = new Set(); + const _trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc: VocabTrustSet = new Set(); let _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc__array = values[\\"https://www.w3.org/ns/activitystreams#bcc\\"]; @@ -17948,7 +20128,7 @@ get licenses(): (URL)[] { instance.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source; const _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: (DataIntegrityProof | URL)[] = []; - const _trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: Set = new Set(); + const _trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: VocabTrustSet = new Set(); let _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof__array = values[\\"https://w3id.org/security#proof\\"]; @@ -18055,7 +20235,7 @@ get licenses(): (URL)[] { instance.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy; const _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: (LikeAuthorization | URL)[] = []; - const _trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: Set = new Set(); + const _trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: VocabTrustSet = new Set(); let _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization__array = values[\\"https://gotosocial.org/ns#likeAuthorization\\"]; @@ -18096,7 +20276,7 @@ get licenses(): (URL)[] { instance.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization; const _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: (ReplyAuthorization | URL)[] = []; - const _trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: Set = new Set(); + const _trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: VocabTrustSet = new Set(); let _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization__array = values[\\"https://gotosocial.org/ns#replyAuthorization\\"]; @@ -18137,7 +20317,7 @@ get licenses(): (URL)[] { instance.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization; const _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: (AnnounceAuthorization | URL)[] = []; - const _trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: Set = new Set(); + const _trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: VocabTrustSet = new Set(); let _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization__array = values[\\"https://gotosocial.org/ns#announceAuthorization\\"]; @@ -19265,8 +21445,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Emoji.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -19321,7 +21501,77 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const clone = super.clone(values, options) as unknown as Emoji; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Emoji { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -19669,11 +21919,11 @@ export class ChatMessage extends Object { } #_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); #_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; #_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); /** * Constructs a new instance of ChatMessage with the given values. @@ -19761,8 +22011,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link ChatMessage.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -19814,12 +22064,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as ChatMessage;clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice();clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote); + const clone = super.clone(values, options) as unknown as ChatMessage;clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length < vocabSparseArrayMinimumLength + ? this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice() : vocabCopyPropertyArray(this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote);clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = vocabCopyTrustSet( + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, + ); if (\\"quote\\" in values && values.quote != null) { if (values.quote instanceof Object || values.quote instanceof URL) { // @ts-ignore: type is checked above. clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = [values.quote]; - clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set([0]); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The quote must be of type \\" + @@ -19827,7 +22081,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice(); + clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length < vocabSparseArrayMinimumLength + ? this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice() : vocabCopyPropertyArray(this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl); if (\\"quoteUrl\\" in values && values.quoteUrl != null) { if (values.quoteUrl instanceof URL) { // @ts-ignore: type is checked above. @@ -19840,12 +22095,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice();clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization); + clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice() : vocabCopyPropertyArray(this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization);clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = vocabCopyTrustSet( + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, + ); if (\\"quoteAuthorization\\" in values && values.quoteAuthorization != null) { if (values.quoteAuthorization instanceof QuoteAuthorization || values.quoteAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = [values.quoteAuthorization]; - clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set([0]); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The quoteAuthorization must be of type \\" + @@ -19856,7 +22115,151 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];quote?: Object | URL | null;quoteUrl?: URL | null;quoteAuthorization?: QuoteAuthorization | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): ChatMessage { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as ChatMessage; + + { + const array = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length; i++) { + const value = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i] = context.value(value); + } + } + } + } + + { + const array = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length; i++) { + const value = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i]; + if (value != null && typeof value === \\"object\\") { + node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i] = context.value(value); + } + } + } + } + + { + const array = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length; i++) { + const value = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i]; + if (value != null && typeof value === \\"object\\") { + node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i] = context.value(value); + } + } + } + } +} }); } + async #fetchQuote( url: URL, options: { @@ -20185,7 +22588,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[0]; if (!(v instanceof URL) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/044f#quote\\"); @@ -20253,7 +22657,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -20627,7 +23032,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/044f#quoteAuthorization\\"); @@ -20695,7 +23101,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -21122,7 +23529,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); let _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote__array = values[\\"https://w3id.org/fep/044f#quote\\"]; @@ -21202,7 +23609,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; const _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); let _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization__array = values[\\"https://w3id.org/fep/044f#quoteAuthorization\\"]; @@ -21377,22 +23784,22 @@ export class Activity extends Object { } #_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: Set = new Set(); + #_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: VocabTrustSet = new Set(); #_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; - #_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); + #_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: VocabTrustSet = new Set(); #_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: (Object | URL)[] = []; - #_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: Set = new Set(); + #_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: VocabTrustSet = new Set(); #_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: (Object | URL)[] = []; - #_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: Set = new Set(); + #_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: VocabTrustSet = new Set(); #_25zu2s3VxVujgEKqrDycjE284XQR_origin: (Object | URL)[] = []; - #_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: Set = new Set(); + #_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: VocabTrustSet = new Set(); #_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: (Object | URL)[] = []; - #_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: Set = new Set(); + #_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: VocabTrustSet = new Set(); /** * Constructs a new instance of Activity with the given values. @@ -21458,14 +23865,36 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.actors) && - values.actors.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.actors)) { + const array = values.actors; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.actors; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = values.actors.slice(); + this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = copied; - for (let i = 0; i < values.actors.length; i++) { - this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); - } + vocabSetTrustPrefix(this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor, this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length); } else { throw new TypeError( @@ -21498,14 +23927,36 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.objects) && - values.objects.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.objects)) { + const array = values.objects; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.objects; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects.slice(); + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = copied; - for (let i = 0; i < values.objects.length; i++) { - this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); - } + vocabSetTrustPrefix(this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length); } else { throw new TypeError( @@ -21538,14 +23989,36 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.targets) && - values.targets.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.targets)) { + const array = values.targets; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.targets; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = values.targets.slice(); + this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = copied; - for (let i = 0; i < values.targets.length; i++) { - this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); - } + vocabSetTrustPrefix(this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target, this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length); } else { throw new TypeError( @@ -21578,14 +24051,36 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.results) && - values.results.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.results)) { + const array = values.results; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.results; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = values.results.slice(); + this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = copied; - for (let i = 0; i < values.results.length; i++) { - this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); - } + vocabSetTrustPrefix(this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result, this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length); } else { throw new TypeError( @@ -21618,14 +24113,36 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.origins) && - values.origins.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.origins)) { + const array = values.origins; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.origins; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = values.origins.slice(); + this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = copied; - for (let i = 0; i < values.origins.length; i++) { - this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); - } + vocabSetTrustPrefix(this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin, this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length); } else { throw new TypeError( @@ -21658,14 +24175,36 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.instruments) && - values.instruments.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.instruments)) { + const array = values.instruments; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.instruments; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = values.instruments.slice(); + this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = copied; - for (let i = 0; i < values.instruments.length; i++) { - this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); - } + vocabSetTrustPrefix(this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument, this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length); } else { throw new TypeError( @@ -21687,8 +24226,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Activity.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -21746,12 +24285,16 @@ instruments?: (Object | URL)[];} // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Activity;clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.slice();clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set(this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor); + const clone = super.clone(values, options) as unknown as Activity;clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length < vocabSparseArrayMinimumLength + ? this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.slice() : vocabCopyPropertyArray(this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor);clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = vocabCopyTrustSet( + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor, clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor, + ); if (\\"actor\\" in values && values.actor != null) { if (values.actor instanceof Application || values.actor instanceof Group || values.actor instanceof Organization || values.actor instanceof Person || values.actor instanceof Service || values.actor instanceof URL) { // @ts-ignore: type is checked above. clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = [values.actor]; - clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set([0]); + clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set(); + clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The actor must be of type \\" + @@ -21770,15 +24313,37 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.actors) && - values.actors.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.actors)) { + const array = values.actors; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.actors; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = values.actors.slice(); + clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = copied; clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set(); - for (let i = 0; i < values.actors.length; i++) { - clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor, clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length); } else { throw new TypeError( @@ -21787,12 +24352,16 @@ instruments?: (Object | URL)[];} ); } } - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.slice();clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object); + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length < vocabSparseArrayMinimumLength + ? this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.slice() : vocabCopyPropertyArray(this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object);clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = vocabCopyTrustSet( + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, + ); if (\\"object\\" in values && values.object != null) { if (values.object instanceof Object || values.object instanceof URL) { // @ts-ignore: type is checked above. clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = [values.object]; - clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set([0]); + clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(); + clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The object must be of type \\" + @@ -21811,15 +24380,37 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.objects) && - values.objects.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.objects)) { + const array = values.objects; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.objects; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects.slice(); + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = copied; clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(); - for (let i = 0; i < values.objects.length; i++) { - clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length); } else { throw new TypeError( @@ -21828,12 +24419,16 @@ instruments?: (Object | URL)[];} ); } } - clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.slice();clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set(this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target); + clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length < vocabSparseArrayMinimumLength + ? this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.slice() : vocabCopyPropertyArray(this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target);clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = vocabCopyTrustSet( + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target, clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target, + ); if (\\"target\\" in values && values.target != null) { if (values.target instanceof Object || values.target instanceof URL) { // @ts-ignore: type is checked above. clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = [values.target]; - clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set([0]); + clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set(); + clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The target must be of type \\" + @@ -21852,15 +24447,37 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.targets) && - values.targets.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.targets)) { + const array = values.targets; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.targets; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = values.targets.slice(); + clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = copied; clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set(); - for (let i = 0; i < values.targets.length; i++) { - clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target, clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length); } else { throw new TypeError( @@ -21869,12 +24486,16 @@ instruments?: (Object | URL)[];} ); } } - clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.slice();clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set(this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result); + clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length < vocabSparseArrayMinimumLength + ? this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.slice() : vocabCopyPropertyArray(this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result);clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = vocabCopyTrustSet( + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result, clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result, + ); if (\\"result\\" in values && values.result != null) { if (values.result instanceof Object || values.result instanceof URL) { // @ts-ignore: type is checked above. clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = [values.result]; - clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set([0]); + clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set(); + clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The result must be of type \\" + @@ -21893,15 +24514,37 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.results) && - values.results.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.results)) { + const array = values.results; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.results; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = values.results.slice(); + clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = copied; clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set(); - for (let i = 0; i < values.results.length; i++) { - clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); - } + vocabSetTrustPrefix(clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result, clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length); } else { throw new TypeError( @@ -21910,12 +24553,16 @@ instruments?: (Object | URL)[];} ); } } - clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.slice();clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set(this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin); + clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length < vocabSparseArrayMinimumLength + ? this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.slice() : vocabCopyPropertyArray(this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin);clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = vocabCopyTrustSet( + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin, clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin, + ); if (\\"origin\\" in values && values.origin != null) { if (values.origin instanceof Object || values.origin instanceof URL) { // @ts-ignore: type is checked above. clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = [values.origin]; - clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set([0]); + clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set(); + clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The origin must be of type \\" + @@ -21934,15 +24581,37 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.origins) && - values.origins.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.origins)) { + const array = values.origins; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.origins; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = values.origins.slice(); + clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = copied; clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set(); - for (let i = 0; i < values.origins.length; i++) { - clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); - } + vocabSetTrustPrefix(clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin, clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length); } else { throw new TypeError( @@ -21951,12 +24620,16 @@ instruments?: (Object | URL)[];} ); } } - clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.slice();clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set(this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument); + clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length < vocabSparseArrayMinimumLength + ? this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.slice() : vocabCopyPropertyArray(this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument);clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = vocabCopyTrustSet( + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument, clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument, + ); if (\\"instrument\\" in values && values.instrument != null) { if (values.instrument instanceof Object || values.instrument instanceof URL) { // @ts-ignore: type is checked above. clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = [values.instrument]; - clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set([0]); + clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set(); + clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The instrument must be of type \\" + @@ -21975,15 +24648,37 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.instruments) && - values.instruments.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.instruments)) { + const array = values.instruments; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.instruments; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = values.instruments.slice(); + clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = copied; clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set(); - for (let i = 0; i < values.instruments.length; i++) { - clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument, clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length); } else { throw new TypeError( @@ -21995,7 +24690,223 @@ instruments?: (Object | URL)[];} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Activity { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Activity; + + { + const array = node.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length; i++) { + const value = node.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length; i++) { + const value = node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length; i++) { + const value = node.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[i] = context.value(value); + } + } + } + } + + { + const array = node.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length; i++) { + const value = node.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[i]; + if (value != null && typeof value === \\"object\\") { + node.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[i] = context.value(value); + } + } + } + } + + { + const array = node.#_25zu2s3VxVujgEKqrDycjE284XQR_origin; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length; i++) { + const value = node.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[i]; + if (value != null && typeof value === \\"object\\") { + node.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length; i++) { + const value = node.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[i] = context.value(value); + } + } + } + } +} }); } + async #fetchActor( url: URL, options: { @@ -22384,7 +25295,8 @@ instruments?: (Object | URL)[];} } let v = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0]; if (!(v instanceof URL) && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { + !(0 < (this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[vocabTrustPrefix] ?? 0) || + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#actor\\"); @@ -22452,7 +25364,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { + !(0 < (this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[vocabTrustPrefix] ?? 0) || + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -22542,7 +25455,8 @@ instruments?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(i)) { + !(i < (this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[vocabTrustPrefix] ?? 0) || + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#actor\\"); @@ -22614,7 +25528,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(i)) { + !(i < (this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[vocabTrustPrefix] ?? 0) || + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -22967,7 +25882,8 @@ instruments?: (Object | URL)[];} } let v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; if (!(v instanceof URL) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { + !(0 < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#object\\"); @@ -23035,7 +25951,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { + !(0 < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -23125,7 +26042,8 @@ instruments?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i)) { + !(i < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#object\\"); @@ -23197,7 +26115,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i)) { + !(i < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -23553,7 +26472,8 @@ instruments?: (Object | URL)[];} } let v = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0]; if (!(v instanceof URL) && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { + !(0 < (this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[vocabTrustPrefix] ?? 0) || + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#target\\"); @@ -23621,7 +26541,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { + !(0 < (this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[vocabTrustPrefix] ?? 0) || + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -23714,7 +26635,8 @@ instruments?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(i)) { + !(i < (this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[vocabTrustPrefix] ?? 0) || + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#target\\"); @@ -23786,7 +26708,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(i)) { + !(i < (this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[vocabTrustPrefix] ?? 0) || + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -24139,7 +27062,8 @@ instruments?: (Object | URL)[];} } let v = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0]; if (!(v instanceof URL) && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { + !(0 < (this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[vocabTrustPrefix] ?? 0) || + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#result\\"); @@ -24207,7 +27131,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { + !(0 < (this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[vocabTrustPrefix] ?? 0) || + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -24297,7 +27222,8 @@ instruments?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(i)) { + !(i < (this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[vocabTrustPrefix] ?? 0) || + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#result\\"); @@ -24369,7 +27295,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(i)) { + !(i < (this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[vocabTrustPrefix] ?? 0) || + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -24723,7 +27650,8 @@ instruments?: (Object | URL)[];} } let v = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0]; if (!(v instanceof URL) && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { + !(0 < (this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin[vocabTrustPrefix] ?? 0) || + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#origin\\"); @@ -24791,7 +27719,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { + !(0 < (this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin[vocabTrustPrefix] ?? 0) || + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -24882,7 +27811,8 @@ instruments?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(i)) { + !(i < (this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin[vocabTrustPrefix] ?? 0) || + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#origin\\"); @@ -24954,7 +27884,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(i)) { + !(i < (this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin[vocabTrustPrefix] ?? 0) || + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -25306,7 +28237,8 @@ instruments?: (Object | URL)[];} } let v = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0]; if (!(v instanceof URL) && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { + !(0 < (this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[vocabTrustPrefix] ?? 0) || + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#instrument\\"); @@ -25374,7 +28306,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { + !(0 < (this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[vocabTrustPrefix] ?? 0) || + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -25463,7 +28396,8 @@ instruments?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(i)) { + !(i < (this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[vocabTrustPrefix] ?? 0) || + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#instrument\\"); @@ -25535,7 +28469,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(i)) { + !(i < (this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[vocabTrustPrefix] ?? 0) || + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -26074,7 +29009,7 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: Set = new Set(); + const _trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: VocabTrustSet = new Set(); let _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array = values[\\"https://www.w3.org/ns/activitystreams#actor\\"]; @@ -26132,7 +29067,7 @@ instruments?: (Object | URL)[];} instance.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; const _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; - const _trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); + const _trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: VocabTrustSet = new Set(); let _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array = values[\\"https://www.w3.org/ns/activitystreams#object\\"]; @@ -26173,7 +29108,7 @@ instruments?: (Object | URL)[];} instance.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; const _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: (Object | URL)[] = []; - const _trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: Set = new Set(); + const _trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: VocabTrustSet = new Set(); let _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array = values[\\"https://www.w3.org/ns/activitystreams#target\\"]; @@ -26214,7 +29149,7 @@ instruments?: (Object | URL)[];} instance.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; const _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: (Object | URL)[] = []; - const _trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: Set = new Set(); + const _trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: VocabTrustSet = new Set(); let _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array = values[\\"https://www.w3.org/ns/activitystreams#result\\"]; @@ -26255,7 +29190,7 @@ instruments?: (Object | URL)[];} instance.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; const _25zu2s3VxVujgEKqrDycjE284XQR_origin: (Object | URL)[] = []; - const _trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: Set = new Set(); + const _trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: VocabTrustSet = new Set(); let _25zu2s3VxVujgEKqrDycjE284XQR_origin__array = values[\\"https://www.w3.org/ns/activitystreams#origin\\"]; @@ -26296,7 +29231,7 @@ instruments?: (Object | URL)[];} instance.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = _25zu2s3VxVujgEKqrDycjE284XQR_origin; const _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: (Object | URL)[] = []; - const _trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: Set = new Set(); + const _trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: VocabTrustSet = new Set(); let _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array = values[\\"https://www.w3.org/ns/activitystreams#instrument\\"]; @@ -26615,8 +29550,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link EmojiReact.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -26677,7 +29612,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as EmojiReact; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): EmojiReact { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -27147,8 +30158,8 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link PropertyValue.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -27191,7 +30202,8 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} options ); copyPortableProvenance(this, clone); - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.slice(); + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length < vocabSparseArrayMinimumLength + ? this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.slice() : vocabCopyPropertyArray(this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name); if (\\"name\\" in values && values.name != null) { if (typeof values.name === \\"string\\" || values.name instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -27204,7 +30216,8 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} ); } } - clone.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.slice(); + clone.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length < vocabSparseArrayMinimumLength + ? this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.slice() : vocabCopyPropertyArray(this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value); if (\\"value\\" in values && values.value != null) { if (typeof values.value === \\"string\\" || values.value instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -27220,7 +30233,79 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +name?: string | LanguageString | null;value?: string | LanguageString | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): PropertyValue { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as PropertyValue; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as PropertyValue; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); +} }); } + /** The name of a property. */ get name(): (string | LanguageString | null) { @@ -27919,8 +31004,8 @@ unit?: string | null;numericalValue?: Decimal | null;} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Measure.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -27963,7 +31048,8 @@ unit?: string | null;numericalValue?: Decimal | null;} options ); copyPortableProvenance(this, clone); - clone.#_27fgyFbosTtMAhuepJH8K3ZGURT6 = this.#_27fgyFbosTtMAhuepJH8K3ZGURT6.slice(); + clone.#_27fgyFbosTtMAhuepJH8K3ZGURT6 = this.#_27fgyFbosTtMAhuepJH8K3ZGURT6.length < vocabSparseArrayMinimumLength + ? this.#_27fgyFbosTtMAhuepJH8K3ZGURT6.slice() : vocabCopyPropertyArray(this.#_27fgyFbosTtMAhuepJH8K3ZGURT6); if (\\"unit\\" in values && values.unit != null) { if (typeof values.unit === \\"string\\") { // @ts-ignore: type is checked above. @@ -27976,7 +31062,8 @@ unit?: string | null;numericalValue?: Decimal | null;} ); } } - clone.#_1GQx8o2RgxRs4x9G5uT39XYBv7D = this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D.slice(); + clone.#_1GQx8o2RgxRs4x9G5uT39XYBv7D = this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D.length < vocabSparseArrayMinimumLength + ? this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D.slice() : vocabCopyPropertyArray(this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D); if (\\"numericalValue\\" in values && values.numericalValue != null) { if (typeof values.numericalValue === \\"string\\" && isDecimal(values.numericalValue)) { // @ts-ignore: type is checked above. @@ -27992,7 +31079,79 @@ unit?: string | null;numericalValue?: Decimal | null;} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +unit?: string | null;numericalValue?: Decimal | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Measure { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Measure; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Measure; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); +} }); } + /** The name of the unit, according to the Ontology of units of Measure * classification. The recommended unit for countable items is \`\\"one\\"\`. * @@ -28531,10 +31690,10 @@ export class AnnounceAuthorization extends Object { } #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); /** * Constructs a new instance of AnnounceAuthorization with the given values. @@ -28609,8 +31768,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link AnnounceAuthorization.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -28662,12 +31821,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as AnnounceAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice();clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + const clone = super.clone(values, options) as unknown as AnnounceAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < vocabSparseArrayMinimumLength + ? this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice() : vocabCopyPropertyArray(this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject);clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = vocabCopyTrustSet( + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, + ); if (\\"interactingObject\\" in values && values.interactingObject != null) { if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { // @ts-ignore: type is checked above. clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; - clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The interactingObject must be of type \\" + @@ -28675,12 +31838,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice();clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < vocabSparseArrayMinimumLength + ? this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice() : vocabCopyPropertyArray(this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget);clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = vocabCopyTrustSet( + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, + ); if (\\"interactionTarget\\" in values && values.interactionTarget != null) { if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { // @ts-ignore: type is checked above. clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; - clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The interactionTarget must be of type \\" + @@ -28691,7 +31858,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): AnnounceAuthorization { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as AnnounceAuthorization; + + { + const array = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length; i++) { + const value = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length; i++) { + const value = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i] = context.value(value); + } + } + } + } +} }); } + async #fetchInteractingObject( url: URL, options: { @@ -29019,7 +32308,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; if (!(v instanceof URL) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#interactingObject\\"); @@ -29087,7 +32377,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -29437,7 +32728,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; if (!(v instanceof URL) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#interactionTarget\\"); @@ -29505,7 +32797,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -29882,7 +33175,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values[\\"https://gotosocial.org/ns#interactingObject\\"]; @@ -29923,7 +33216,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values[\\"https://gotosocial.org/ns#interactionTarget\\"]; @@ -30136,8 +33429,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link AnnounceRequest.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -30198,7 +33491,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as AnnounceRequest; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): AnnounceRequest { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -30717,8 +34086,8 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link InteractionPolicy.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -30761,7 +34130,8 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: options ); copyPortableProvenance(this, clone); - clone.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature = this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature.slice(); + clone.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature = this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature.length < vocabSparseArrayMinimumLength + ? this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature.slice() : vocabCopyPropertyArray(this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature); if (\\"canFeature\\" in values && values.canFeature != null) { if (values.canFeature instanceof InteractionRule) { // @ts-ignore: type is checked above. @@ -30774,7 +34144,8 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: ); } } - clone.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike = this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.slice(); + clone.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike = this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.length < vocabSparseArrayMinimumLength + ? this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.slice() : vocabCopyPropertyArray(this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike); if (\\"canLike\\" in values && values.canLike != null) { if (values.canLike instanceof InteractionRule) { // @ts-ignore: type is checked above. @@ -30787,7 +34158,8 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: ); } } - clone.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply = this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.slice(); + clone.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply = this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.length < vocabSparseArrayMinimumLength + ? this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.slice() : vocabCopyPropertyArray(this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply); if (\\"canReply\\" in values && values.canReply != null) { if (values.canReply instanceof InteractionRule) { // @ts-ignore: type is checked above. @@ -30800,7 +34172,8 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: ); } } - clone.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce = this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.slice(); + clone.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce = this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.length < vocabSparseArrayMinimumLength + ? this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.slice() : vocabCopyPropertyArray(this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce); if (\\"canAnnounce\\" in values && values.canAnnounce != null) { if (values.canAnnounce instanceof InteractionRule) { // @ts-ignore: type is checked above. @@ -30813,7 +34186,8 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: ); } } - clone.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote = this.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote.slice(); + clone.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote = this.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote.length < vocabSparseArrayMinimumLength + ? this.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote.slice() : vocabCopyPropertyArray(this.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote); if (\\"canQuote\\" in values && values.canQuote != null) { if (values.canQuote instanceof InteractionRule) { // @ts-ignore: type is checked above. @@ -30829,7 +34203,189 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: InteractionRule | null;canQuote?: InteractionRule | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): InteractionPolicy { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as InteractionPolicy; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as InteractionPolicy; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature.length; i++) { + const value = node.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.length; i++) { + const value = node.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.length; i++) { + const value = node.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply[i] = context.value(value); + } + } + } + } + + { + const array = node.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.length; i++) { + const value = node.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce[i]; + if (value != null && typeof value === \\"object\\") { + node.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce[i] = context.value(value); + } + } + } + } + + { + const array = node.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote.length; i++) { + const value = node.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote[i]; + if (value != null && typeof value === \\"object\\") { + node.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote[i] = context.value(value); + } + } + } + } +} }); } + /** The sub-policy specifying who can feature the actor in a * {@link FeaturedCollection}. * @@ -31764,10 +35320,34 @@ manualApprovals?: (URL)[];} ); } - if (Array.isArray(values.automaticApprovals) && - values.automaticApprovals.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.automaticApprovals)) { + const array = values.automaticApprovals; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.automaticApprovals; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = values.automaticApprovals.slice(); + this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = copied; } else { throw new TypeError( @@ -31800,10 +35380,34 @@ manualApprovals?: (URL)[];} ); } - if (Array.isArray(values.manualApprovals) && - values.manualApprovals.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.manualApprovals)) { + const array = values.manualApprovals; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.manualApprovals; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = values.manualApprovals.slice(); + this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = copied; } else { throw new TypeError( @@ -31825,8 +35429,8 @@ manualApprovals?: (URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link InteractionRule.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -31871,7 +35475,8 @@ manualApprovals?: (URL)[];} options ); copyPortableProvenance(this, clone); - clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.slice(); + clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.length < vocabSparseArrayMinimumLength + ? this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.slice() : vocabCopyPropertyArray(this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval); if (\\"automaticApproval\\" in values && values.automaticApproval != null) { if (values.automaticApproval instanceof URL) { // @ts-ignore: type is checked above. @@ -31895,10 +35500,34 @@ manualApprovals?: (URL)[];} ); } - if (Array.isArray(values.automaticApprovals) && - values.automaticApprovals.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.automaticApprovals)) { + const array = values.automaticApprovals; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.automaticApprovals; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = values.automaticApprovals.slice(); + clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = copied; } else { throw new TypeError( @@ -31907,7 +35536,8 @@ manualApprovals?: (URL)[];} ); } } - clone.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.slice(); + clone.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.length < vocabSparseArrayMinimumLength + ? this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.slice() : vocabCopyPropertyArray(this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval); if (\\"manualApproval\\" in values && values.manualApproval != null) { if (values.manualApproval instanceof URL) { // @ts-ignore: type is checked above. @@ -31931,10 +35561,34 @@ manualApprovals?: (URL)[];} ); } - if (Array.isArray(values.manualApprovals) && - values.manualApprovals.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.manualApprovals)) { + const array = values.manualApprovals; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.manualApprovals; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = values.manualApprovals.slice(); + clone.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = copied; } else { throw new TypeError( @@ -31946,7 +35600,125 @@ manualApprovals?: (URL)[];} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +automaticApproval?: URL | null; +automaticApprovals?: (URL)[];manualApproval?: URL | null; +manualApprovals?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): InteractionRule { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as InteractionRule; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as InteractionRule; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.length; i++) { + const value = node.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval[i] = context.value(value); + } + } + } + } + + { + const array = node.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.length; i++) { + const value = node.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval[i]; + if (value != null && typeof value === \\"object\\") { + node.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval[i] = context.value(value); + } + } + } + } +} }); } + /** URIs of actors or collections whose interactions are automatically * approved without requiring manual review by the post author. * @@ -32466,10 +36238,10 @@ export class LikeAuthorization extends Object { } #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); /** * Constructs a new instance of LikeAuthorization with the given values. @@ -32544,8 +36316,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link LikeAuthorization.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -32597,12 +36369,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as LikeAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice();clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + const clone = super.clone(values, options) as unknown as LikeAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < vocabSparseArrayMinimumLength + ? this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice() : vocabCopyPropertyArray(this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject);clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = vocabCopyTrustSet( + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, + ); if (\\"interactingObject\\" in values && values.interactingObject != null) { if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { // @ts-ignore: type is checked above. clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; - clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The interactingObject must be of type \\" + @@ -32610,12 +36386,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice();clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < vocabSparseArrayMinimumLength + ? this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice() : vocabCopyPropertyArray(this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget);clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = vocabCopyTrustSet( + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, + ); if (\\"interactionTarget\\" in values && values.interactionTarget != null) { if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { // @ts-ignore: type is checked above. clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; - clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The interactionTarget must be of type \\" + @@ -32626,7 +36406,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): LikeAuthorization { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as LikeAuthorization; + + { + const array = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length; i++) { + const value = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length; i++) { + const value = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i] = context.value(value); + } + } + } + } +} }); } + async #fetchInteractingObject( url: URL, options: { @@ -32954,7 +36856,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; if (!(v instanceof URL) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#interactingObject\\"); @@ -33022,7 +36925,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -33372,7 +37276,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; if (!(v instanceof URL) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#interactionTarget\\"); @@ -33440,7 +37345,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -33817,7 +37723,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values[\\"https://gotosocial.org/ns#interactingObject\\"]; @@ -33858,7 +37764,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values[\\"https://gotosocial.org/ns#interactionTarget\\"]; @@ -34070,8 +37976,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link LikeRequest.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -34132,7 +38038,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as LikeRequest; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): LikeRequest { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -34464,10 +38446,10 @@ export class ReplyAuthorization extends Object { } #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); /** * Constructs a new instance of ReplyAuthorization with the given values. @@ -34542,8 +38524,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link ReplyAuthorization.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -34595,12 +38577,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as ReplyAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice();clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + const clone = super.clone(values, options) as unknown as ReplyAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < vocabSparseArrayMinimumLength + ? this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice() : vocabCopyPropertyArray(this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject);clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = vocabCopyTrustSet( + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, + ); if (\\"interactingObject\\" in values && values.interactingObject != null) { if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { // @ts-ignore: type is checked above. clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; - clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The interactingObject must be of type \\" + @@ -34608,12 +38594,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice();clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < vocabSparseArrayMinimumLength + ? this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice() : vocabCopyPropertyArray(this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget);clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = vocabCopyTrustSet( + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, + ); if (\\"interactionTarget\\" in values && values.interactionTarget != null) { if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { // @ts-ignore: type is checked above. clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; - clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The interactionTarget must be of type \\" + @@ -34624,7 +38614,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): ReplyAuthorization { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as ReplyAuthorization; + + { + const array = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length; i++) { + const value = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length; i++) { + const value = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i] = context.value(value); + } + } + } + } +} }); } + async #fetchInteractingObject( url: URL, options: { @@ -34952,7 +39064,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; if (!(v instanceof URL) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#interactingObject\\"); @@ -35020,7 +39133,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -35370,7 +39484,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; if (!(v instanceof URL) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#interactionTarget\\"); @@ -35438,7 +39553,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -35815,7 +39931,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values[\\"https://gotosocial.org/ns#interactingObject\\"]; @@ -35856,7 +39972,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values[\\"https://gotosocial.org/ns#interactionTarget\\"]; @@ -36068,8 +40184,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link ReplyRequest.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -36130,7 +40246,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as ReplyRequest; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): ReplyRequest { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -36462,10 +40654,10 @@ export class QuoteAuthorization extends Object { } #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); /** * Constructs a new instance of QuoteAuthorization with the given values. @@ -36540,8 +40732,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link QuoteAuthorization.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -36593,12 +40785,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as QuoteAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice();clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + const clone = super.clone(values, options) as unknown as QuoteAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < vocabSparseArrayMinimumLength + ? this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice() : vocabCopyPropertyArray(this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject);clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = vocabCopyTrustSet( + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, + ); if (\\"interactingObject\\" in values && values.interactingObject != null) { if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { // @ts-ignore: type is checked above. clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; - clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The interactingObject must be of type \\" + @@ -36606,12 +40802,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice();clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < vocabSparseArrayMinimumLength + ? this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice() : vocabCopyPropertyArray(this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget);clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = vocabCopyTrustSet( + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, + ); if (\\"interactionTarget\\" in values && values.interactionTarget != null) { if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { // @ts-ignore: type is checked above. clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; - clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The interactionTarget must be of type \\" + @@ -36622,7 +40822,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): QuoteAuthorization { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as QuoteAuthorization; + + { + const array = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length; i++) { + const value = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length; i++) { + const value = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i] = context.value(value); + } + } + } + } +} }); } + async #fetchInteractingObject( url: URL, options: { @@ -36949,7 +41271,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; if (!(v instanceof URL) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#interactingObject\\"); @@ -37017,7 +41340,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -37367,7 +41691,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; if (!(v instanceof URL) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#interactionTarget\\"); @@ -37435,7 +41760,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -37812,7 +42138,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values[\\"https://gotosocial.org/ns#interactingObject\\"]; @@ -37853,7 +42179,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values[\\"https://gotosocial.org/ns#interactionTarget\\"]; @@ -38065,8 +42391,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link QuoteRequest.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -38127,7 +42453,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as QuoteRequest; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): QuoteRequest { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -38528,7 +42930,7 @@ export class Translation { #_diXuPmFWiEqfLPhhrxg6Xc7ixZG: (Intl.Locale)[] = []; #_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR: Set = new Set(); + #_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR: VocabTrustSet = new Set(); #_Msz9PwRg7cWkiXPL4ixyQLtuuH7: (URL)[] = []; #_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated: (Temporal.Instant)[] = []; #_4KvkQNz1JjGs8S7iJDcGrUYETbUW: (URL)[] = []; @@ -38610,14 +43012,36 @@ urls?: ((URL | Link))[];} ); } - if (Array.isArray(values.translators) && - values.translators.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.translators)) { + const array = values.translators; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.translators; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = values.translators.slice(); + this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = copied; - for (let i = 0; i < values.translators.length; i++) { - this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.add(i); - } + vocabSetTrustPrefix(this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR, this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length); } else { throw new TypeError( @@ -38689,10 +43113,34 @@ urls?: ((URL | Link))[];} ); } - if (Array.isArray(values.urls) && - values.urls.every(v => v instanceof URL || v instanceof Link)) { + let copied!: (URL | Link)[]; + let valid = false; + if (Array.isArray(values.urls)) { + const array = values.urls; + const test = (v: URL | Link): boolean => v instanceof URL || v instanceof Link; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.urls; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls.slice(); + this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = copied; } else { throw new TypeError( @@ -38714,8 +43162,8 @@ urls?: ((URL | Link))[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Translation.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -38760,7 +43208,8 @@ urls?: ((URL | Link))[];} options ); copyPortableProvenance(this, clone); - clone.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG.slice(); + clone.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG.length < vocabSparseArrayMinimumLength + ? this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG.slice() : vocabCopyPropertyArray(this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG); if (\\"language\\" in values && values.language != null) { if (values.language instanceof Intl.Locale) { // @ts-ignore: type is checked above. @@ -38773,12 +43222,16 @@ urls?: ((URL | Link))[];} ); } } - clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.slice();clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = new Set(this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR); + clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length < vocabSparseArrayMinimumLength + ? this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.slice() : vocabCopyPropertyArray(this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR);clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = vocabCopyTrustSet( + this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR, clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR, + ); if (\\"translator\\" in values && values.translator != null) { if (values.translator instanceof Application || values.translator instanceof Group || values.translator instanceof Organization || values.translator instanceof Person || values.translator instanceof Service || values.translator instanceof URL) { // @ts-ignore: type is checked above. clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = [values.translator]; - clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = new Set([0]); + clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = new Set(); + clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The translator must be of type \\" + @@ -38797,15 +43250,37 @@ urls?: ((URL | Link))[];} ); } - if (Array.isArray(values.translators) && - values.translators.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.translators)) { + const array = values.translators; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.translators; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = values.translators.slice(); + clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = copied; clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = new Set(); - for (let i = 0; i < values.translators.length; i++) { - clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.add(i); - } + vocabSetTrustPrefix(clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR, clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length); } else { throw new TypeError( @@ -38814,7 +43289,8 @@ urls?: ((URL | Link))[];} ); } } - clone.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7 = this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7.slice(); + clone.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7 = this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7.length < vocabSparseArrayMinimumLength + ? this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7.slice() : vocabCopyPropertyArray(this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7); if (\\"original\\" in values && values.original != null) { if (values.original instanceof URL) { // @ts-ignore: type is checked above. @@ -38827,7 +43303,8 @@ urls?: ((URL | Link))[];} ); } } - clone.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated.slice(); + clone.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated.length < vocabSparseArrayMinimumLength + ? this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated.slice() : vocabCopyPropertyArray(this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated); if (\\"sourceUpdated\\" in values && values.sourceUpdated != null) { if (isTemporalInstant(values.sourceUpdated)) { // @ts-ignore: type is checked above. @@ -38840,7 +43317,8 @@ urls?: ((URL | Link))[];} ); } } - clone.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW = this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW.slice(); + clone.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW = this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW.length < vocabSparseArrayMinimumLength + ? this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW.slice() : vocabCopyPropertyArray(this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW); if (\\"basis\\" in values && values.basis != null) { if (values.basis instanceof URL) { // @ts-ignore: type is checked above. @@ -38853,7 +43331,8 @@ urls?: ((URL | Link))[];} ); } } - clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.slice(); + clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length < vocabSparseArrayMinimumLength + ? this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.slice() : vocabCopyPropertyArray(this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url); if (\\"url\\" in values && values.url != null) { if (values.url instanceof URL || values.url instanceof Link) { // @ts-ignore: type is checked above. @@ -38877,10 +43356,34 @@ urls?: ((URL | Link))[];} ); } - if (Array.isArray(values.urls) && - values.urls.every(v => v instanceof URL || v instanceof Link)) { + let copied!: (URL | Link)[]; + let valid = false; + if (Array.isArray(values.urls)) { + const array = values.urls; + const test = (v: URL | Link): boolean => v instanceof URL || v instanceof Link; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.urls; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls.slice(); + clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = copied; } else { throw new TypeError( @@ -38892,7 +43395,169 @@ urls?: ((URL | Link))[];} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +language?: Intl.Locale | null;translator?: Application | Group | Organization | Person | Service | URL | null; +translators?: (Application | Group | Organization | Person | Service | URL)[];original?: URL | null;sourceUpdated?: Temporal.Instant | null;basis?: URL | null;url?: URL | Link | null; +urls?: ((URL | Link))[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Translation { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Translation; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Translation; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length; i++) { + const value = node.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[i]; + if (value != null && typeof value === \\"object\\") { + node.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[i] = context.value(value); + } + } + } + } + + { + const array = node.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7.length; i++) { + const value = node.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7[i]; + if (value != null && typeof value === \\"object\\") { + node.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW.length; i++) { + const value = node.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length; i++) { + const value = node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[i] = context.value(value); + } + } + } + } +} }); } + /** The translated language. Publishers must match a language in the * containing object's content, name, or summary map. * @@ -39299,7 +43964,8 @@ urls?: ((URL | Link))[];} } let v = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[0]; if (!(v instanceof URL) && - !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(0)) { + !(0 < (this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[vocabTrustPrefix] ?? 0) || + this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://schema.org/translator\\"); @@ -39367,7 +44033,8 @@ urls?: ((URL | Link))[];} mustDereferencePortableObject( this, null, v.id, options, )) && - !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(0)) { + !(0 < (this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[vocabTrustPrefix] ?? 0) || + this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -39460,7 +44127,8 @@ urls?: ((URL | Link))[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(i)) { + !(i < (this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[vocabTrustPrefix] ?? 0) || + this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://schema.org/translator\\"); @@ -39532,7 +44200,8 @@ urls?: ((URL | Link))[];} mustDereferencePortableObject( this, null, v.id, options, )) && - !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(i)) { + !(i < (this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[vocabTrustPrefix] ?? 0) || + this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -40144,7 +44813,7 @@ get urls(): ((URL | Link))[] { instance.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = _diXuPmFWiEqfLPhhrxg6Xc7ixZG; const _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR: Set = new Set(); + const _trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR: VocabTrustSet = new Set(); let _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR__array = values[\\"https://schema.org/translator\\"]; @@ -40549,10 +45218,10 @@ export class FeatureAuthorization extends Object { } #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); /** * Constructs a new instance of FeatureAuthorization with the given values. @@ -40627,8 +45296,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link FeatureAuthorization.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -40680,12 +45349,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as FeatureAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice();clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + const clone = super.clone(values, options) as unknown as FeatureAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < vocabSparseArrayMinimumLength + ? this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice() : vocabCopyPropertyArray(this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject);clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = vocabCopyTrustSet( + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, + ); if (\\"interactingObject\\" in values && values.interactingObject != null) { if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { // @ts-ignore: type is checked above. clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; - clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The interactingObject must be of type \\" + @@ -40693,12 +45366,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice();clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < vocabSparseArrayMinimumLength + ? this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice() : vocabCopyPropertyArray(this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget);clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = vocabCopyTrustSet( + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, + ); if (\\"interactionTarget\\" in values && values.interactionTarget != null) { if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { // @ts-ignore: type is checked above. clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; - clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The interactionTarget must be of type \\" + @@ -40709,7 +45386,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): FeatureAuthorization { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as FeatureAuthorization; + + { + const array = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length; i++) { + const value = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length; i++) { + const value = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i] = context.value(value); + } + } + } + } +} }); } + async #fetchInteractingObject( url: URL, options: { @@ -41035,7 +45834,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; if (!(v instanceof URL) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#interactingObject\\"); @@ -41103,7 +45903,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -41452,7 +46253,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; if (!(v instanceof URL) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://gotosocial.org/ns#interactionTarget\\"); @@ -41520,7 +46322,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -41897,7 +46700,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values[\\"https://gotosocial.org/ns#interactingObject\\"]; @@ -41938,7 +46741,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values[\\"https://gotosocial.org/ns#interactionTarget\\"]; @@ -42147,8 +46950,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link FeatureRequest.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -42209,7 +47012,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as FeatureRequest; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): FeatureRequest { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -42539,40 +47418,40 @@ export class Collection extends Object { #_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems: (number)[] = []; #_3UyUdxnyn6cDn53QKrh4MBiearma_current: (CollectionPage | URL)[] = []; - #_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current: Set = new Set(); + #_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current: VocabTrustSet = new Set(); #_J52RqweMe6hhv7RnLJMC8BExTE5_first: (CollectionPage | URL)[] = []; - #_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first: Set = new Set(); + #_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first: VocabTrustSet = new Set(); #_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last: (CollectionPage | URL)[] = []; - #_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last: Set = new Set(); + #_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last: VocabTrustSet = new Set(); #_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: (Object | Link | URL)[] = []; - #_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: Set = new Set(); + #_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: VocabTrustSet = new Set(); #_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf: (Object | URL)[] = []; - #_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf: Set = new Set(); + #_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf: VocabTrustSet = new Set(); #_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf: (Object | URL)[] = []; - #_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf: Set = new Set(); + #_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf: VocabTrustSet = new Set(); #_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf: (Object | URL)[] = []; - #_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf: Set = new Set(); + #_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf: VocabTrustSet = new Set(); #_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf: (Object | URL)[] = []; - #_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf: Set = new Set(); + #_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf: VocabTrustSet = new Set(); #_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf: (Object | URL)[] = []; - #_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf: Set = new Set(); + #_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf: VocabTrustSet = new Set(); #_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf: (Object | URL)[] = []; - #_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf: Set = new Set(); + #_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf: VocabTrustSet = new Set(); #_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf: (Object | URL)[] = []; - #_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf: Set = new Set(); + #_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf: VocabTrustSet = new Set(); #_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf: (Object | URL)[] = []; - #_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf: Set = new Set(); + #_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf: VocabTrustSet = new Set(); /** * Constructs a new instance of Collection with the given values. @@ -42663,14 +47542,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu if (\\"items\\" in values && values.items != null) { - if (Array.isArray(values.items) && - values.items.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.items)) { + const array = values.items; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.items; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = values.items.slice(); + this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = copied; - for (let i = 0; i < values.items.length; i++) { - this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.add(i); - } + vocabSetTrustPrefix(this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length); } else { throw new TypeError( @@ -42796,8 +47697,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Collection.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -42849,7 +47750,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Collection;clone.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems = this.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems.slice(); + const clone = super.clone(values, options) as unknown as Collection;clone.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems = this.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems.length < vocabSparseArrayMinimumLength + ? this.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems.slice() : vocabCopyPropertyArray(this.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems); if (\\"totalItems\\" in values && values.totalItems != null) { if (typeof values.totalItems === \\"number\\" && Number.isInteger(values.totalItems) && values.totalItems >= 0) { // @ts-ignore: type is checked above. @@ -42862,12 +47764,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3UyUdxnyn6cDn53QKrh4MBiearma_current = this.#_3UyUdxnyn6cDn53QKrh4MBiearma_current.slice();clone.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current = new Set(this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current); + clone.#_3UyUdxnyn6cDn53QKrh4MBiearma_current = this.#_3UyUdxnyn6cDn53QKrh4MBiearma_current.length < vocabSparseArrayMinimumLength + ? this.#_3UyUdxnyn6cDn53QKrh4MBiearma_current.slice() : vocabCopyPropertyArray(this.#_3UyUdxnyn6cDn53QKrh4MBiearma_current);clone.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current = vocabCopyTrustSet( + this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current, clone.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current, + ); if (\\"current\\" in values && values.current != null) { if (values.current instanceof CollectionPage || values.current instanceof URL) { // @ts-ignore: type is checked above. clone.#_3UyUdxnyn6cDn53QKrh4MBiearma_current = [values.current]; - clone.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current = new Set([0]); + clone.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current = new Set(); + clone.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The current must be of type \\" + @@ -42875,12 +47781,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_J52RqweMe6hhv7RnLJMC8BExTE5_first = this.#_J52RqweMe6hhv7RnLJMC8BExTE5_first.slice();clone.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first = new Set(this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first); + clone.#_J52RqweMe6hhv7RnLJMC8BExTE5_first = this.#_J52RqweMe6hhv7RnLJMC8BExTE5_first.length < vocabSparseArrayMinimumLength + ? this.#_J52RqweMe6hhv7RnLJMC8BExTE5_first.slice() : vocabCopyPropertyArray(this.#_J52RqweMe6hhv7RnLJMC8BExTE5_first);clone.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first = vocabCopyTrustSet( + this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first, clone.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first, + ); if (\\"first\\" in values && values.first != null) { if (values.first instanceof CollectionPage || values.first instanceof URL) { // @ts-ignore: type is checked above. clone.#_J52RqweMe6hhv7RnLJMC8BExTE5_first = [values.first]; - clone.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first = new Set([0]); + clone.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first = new Set(); + clone.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The first must be of type \\" + @@ -42888,12 +47798,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.slice();clone.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = new Set(this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last); + clone.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.length < vocabSparseArrayMinimumLength + ? this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.slice() : vocabCopyPropertyArray(this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last);clone.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = vocabCopyTrustSet( + this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last, clone.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last, + ); if (\\"last\\" in values && values.last != null) { if (values.last instanceof CollectionPage || values.last instanceof URL) { // @ts-ignore: type is checked above. clone.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = [values.last]; - clone.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = new Set([0]); + clone.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = new Set(); + clone.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The last must be of type \\" + @@ -42901,18 +47815,43 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.slice();clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = new Set(this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items); + clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length < vocabSparseArrayMinimumLength + ? this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.slice() : vocabCopyPropertyArray(this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items);clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = vocabCopyTrustSet( + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, + ); if (\\"items\\" in values && values.items != null) { - if (Array.isArray(values.items) && - values.items.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.items)) { + const array = values.items; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.items; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = values.items.slice(); + clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = copied; clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = new Set(); - for (let i = 0; i < values.items.length; i++) { - clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length); } else { throw new TypeError( @@ -42921,12 +47860,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = this.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.slice();clone.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = new Set(this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf); + clone.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = this.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.length < vocabSparseArrayMinimumLength + ? this.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.slice() : vocabCopyPropertyArray(this.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf);clone.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = vocabCopyTrustSet( + this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf, clone.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf, + ); if (\\"likesOf\\" in values && values.likesOf != null) { if (values.likesOf instanceof Object || values.likesOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = [values.likesOf]; - clone.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = new Set([0]); + clone.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = new Set(); + clone.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The likesOf must be of type \\" + @@ -42934,12 +47877,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = this.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.slice();clone.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = new Set(this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf); + clone.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = this.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.length < vocabSparseArrayMinimumLength + ? this.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.slice() : vocabCopyPropertyArray(this.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf);clone.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = vocabCopyTrustSet( + this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf, clone.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf, + ); if (\\"sharesOf\\" in values && values.sharesOf != null) { if (values.sharesOf instanceof Object || values.sharesOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = [values.sharesOf]; - clone.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = new Set([0]); + clone.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = new Set(); + clone.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The sharesOf must be of type \\" + @@ -42947,12 +47894,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = this.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.slice();clone.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = new Set(this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf); + clone.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = this.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.length < vocabSparseArrayMinimumLength + ? this.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.slice() : vocabCopyPropertyArray(this.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf);clone.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = vocabCopyTrustSet( + this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf, clone.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf, + ); if (\\"repliesOf\\" in values && values.repliesOf != null) { if (values.repliesOf instanceof Object || values.repliesOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = [values.repliesOf]; - clone.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = new Set([0]); + clone.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = new Set(); + clone.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The repliesOf must be of type \\" + @@ -42960,12 +47911,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = this.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.slice();clone.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = new Set(this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf); + clone.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = this.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.length < vocabSparseArrayMinimumLength + ? this.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.slice() : vocabCopyPropertyArray(this.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf);clone.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = vocabCopyTrustSet( + this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf, clone.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf, + ); if (\\"inboxOf\\" in values && values.inboxOf != null) { if (values.inboxOf instanceof Object || values.inboxOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = [values.inboxOf]; - clone.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = new Set([0]); + clone.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = new Set(); + clone.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The inboxOf must be of type \\" + @@ -42973,12 +47928,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = this.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.slice();clone.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = new Set(this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf); + clone.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = this.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.length < vocabSparseArrayMinimumLength + ? this.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.slice() : vocabCopyPropertyArray(this.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf);clone.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = vocabCopyTrustSet( + this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf, clone.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf, + ); if (\\"outboxOf\\" in values && values.outboxOf != null) { if (values.outboxOf instanceof Object || values.outboxOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = [values.outboxOf]; - clone.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = new Set([0]); + clone.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = new Set(); + clone.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The outboxOf must be of type \\" + @@ -42986,12 +47945,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = this.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.slice();clone.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = new Set(this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf); + clone.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = this.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.length < vocabSparseArrayMinimumLength + ? this.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.slice() : vocabCopyPropertyArray(this.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf);clone.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = vocabCopyTrustSet( + this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf, clone.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf, + ); if (\\"followersOf\\" in values && values.followersOf != null) { if (values.followersOf instanceof Object || values.followersOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = [values.followersOf]; - clone.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = new Set([0]); + clone.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = new Set(); + clone.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The followersOf must be of type \\" + @@ -42999,12 +47962,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = this.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.slice();clone.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = new Set(this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf); + clone.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = this.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.length < vocabSparseArrayMinimumLength + ? this.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.slice() : vocabCopyPropertyArray(this.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf);clone.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = vocabCopyTrustSet( + this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf, clone.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf, + ); if (\\"followingOf\\" in values && values.followingOf != null) { if (values.followingOf instanceof Object || values.followingOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = [values.followingOf]; - clone.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = new Set([0]); + clone.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = new Set(); + clone.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The followingOf must be of type \\" + @@ -43012,12 +47979,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = this.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.slice();clone.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = new Set(this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf); + clone.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = this.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.length < vocabSparseArrayMinimumLength + ? this.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.slice() : vocabCopyPropertyArray(this.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf);clone.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = vocabCopyTrustSet( + this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf, clone.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf, + ); if (\\"likedOf\\" in values && values.likedOf != null) { if (values.likedOf instanceof Object || values.likedOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = [values.likedOf]; - clone.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = new Set([0]); + clone.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = new Set(); + clone.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The likedOf must be of type \\" + @@ -43028,7 +47999,349 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Collection { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Collection; + + { + const array = node.#_3UyUdxnyn6cDn53QKrh4MBiearma_current; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3UyUdxnyn6cDn53QKrh4MBiearma_current.length; i++) { + const value = node.#_3UyUdxnyn6cDn53QKrh4MBiearma_current[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3UyUdxnyn6cDn53QKrh4MBiearma_current[i] = context.value(value); + } + } + } + } + + { + const array = node.#_J52RqweMe6hhv7RnLJMC8BExTE5_first; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_J52RqweMe6hhv7RnLJMC8BExTE5_first.length; i++) { + const value = node.#_J52RqweMe6hhv7RnLJMC8BExTE5_first[i]; + if (value != null && typeof value === \\"object\\") { + node.#_J52RqweMe6hhv7RnLJMC8BExTE5_first[i] = context.value(value); + } + } + } + } + + { + const array = node.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.length; i++) { + const value = node.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last[i]; + if (value != null && typeof value === \\"object\\") { + node.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length; i++) { + const value = node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.length; i++) { + const value = node.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.length; i++) { + const value = node.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.length; i++) { + const value = node.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.length; i++) { + const value = node.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.length; i++) { + const value = node.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.length; i++) { + const value = node.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.length; i++) { + const value = node.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.length; i++) { + const value = node.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf[i] = context.value(value); + } + } + } + } +} }); } + /** A non-negative integer specifying the total number of objects contained by * the logical view of the collection. This number might not reflect the actual * number of items serialized within the {@link Collection} object instance. @@ -43372,7 +48685,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3UyUdxnyn6cDn53QKrh4MBiearma_current[0]; if (!(v instanceof URL) && - !this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current.has(0)) { + !(0 < (this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current[vocabTrustPrefix] ?? 0) || + this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#current\\"); @@ -43440,7 +48754,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current.has(0)) { + !(0 < (this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current[vocabTrustPrefix] ?? 0) || + this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -43791,7 +49106,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_J52RqweMe6hhv7RnLJMC8BExTE5_first[0]; if (!(v instanceof URL) && - !this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first.has(0)) { + !(0 < (this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first[vocabTrustPrefix] ?? 0) || + this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#first\\"); @@ -43859,7 +49175,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first.has(0)) { + !(0 < (this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first[vocabTrustPrefix] ?? 0) || + this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -44210,7 +49527,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last[0]; if (!(v instanceof URL) && - !this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.has(0)) { + !(0 < (this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last[vocabTrustPrefix] ?? 0) || + this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#last\\"); @@ -44278,7 +49596,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.has(0)) { + !(0 < (this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last[vocabTrustPrefix] ?? 0) || + this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -44644,7 +49963,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i)) { + !(i < (this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[vocabTrustPrefix] ?? 0) || + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#items\\"); @@ -44716,7 +50036,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i)) { + !(i < (this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[vocabTrustPrefix] ?? 0) || + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -45067,7 +50388,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf[0]; if (!(v instanceof URL) && - !this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.has(0)) { + !(0 < (this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf[vocabTrustPrefix] ?? 0) || + this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/5711#likesOf\\"); @@ -45135,7 +50457,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.has(0)) { + !(0 < (this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf[vocabTrustPrefix] ?? 0) || + this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -45485,7 +50808,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf[0]; if (!(v instanceof URL) && - !this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.has(0)) { + !(0 < (this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf[vocabTrustPrefix] ?? 0) || + this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/5711#sharesOf\\"); @@ -45553,7 +50877,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.has(0)) { + !(0 < (this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf[vocabTrustPrefix] ?? 0) || + this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -45903,7 +51228,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf[0]; if (!(v instanceof URL) && - !this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.has(0)) { + !(0 < (this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf[vocabTrustPrefix] ?? 0) || + this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/5711#repliesOf\\"); @@ -45971,7 +51297,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.has(0)) { + !(0 < (this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf[vocabTrustPrefix] ?? 0) || + this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -46321,7 +51648,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf[0]; if (!(v instanceof URL) && - !this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.has(0)) { + !(0 < (this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/5711#inboxOf\\"); @@ -46389,7 +51717,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.has(0)) { + !(0 < (this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -46739,7 +52068,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf[0]; if (!(v instanceof URL) && - !this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.has(0)) { + !(0 < (this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf[vocabTrustPrefix] ?? 0) || + this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/5711#outboxOf\\"); @@ -46807,7 +52137,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.has(0)) { + !(0 < (this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf[vocabTrustPrefix] ?? 0) || + this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -47157,7 +52488,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf[0]; if (!(v instanceof URL) && - !this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.has(0)) { + !(0 < (this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf[vocabTrustPrefix] ?? 0) || + this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/5711#followersOf\\"); @@ -47225,7 +52557,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.has(0)) { + !(0 < (this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf[vocabTrustPrefix] ?? 0) || + this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -47575,7 +52908,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf[0]; if (!(v instanceof URL) && - !this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.has(0)) { + !(0 < (this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/5711#followingOf\\"); @@ -47643,7 +52977,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.has(0)) { + !(0 < (this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -47993,7 +53328,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf[0]; if (!(v instanceof URL) && - !this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.has(0)) { + !(0 < (this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/5711#likedOf\\"); @@ -48061,7 +53397,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.has(0)) { + !(0 < (this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -48926,7 +54263,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems = _XDbmNDuWHmrhqH712zqtecdbv1V_totalItems; const _3UyUdxnyn6cDn53QKrh4MBiearma_current: (CollectionPage | URL)[] = []; - const _trust_3UyUdxnyn6cDn53QKrh4MBiearma_current: Set = new Set(); + const _trust_3UyUdxnyn6cDn53QKrh4MBiearma_current: VocabTrustSet = new Set(); let _3UyUdxnyn6cDn53QKrh4MBiearma_current__array = values[\\"https://www.w3.org/ns/activitystreams#current\\"]; @@ -48967,7 +54304,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_3UyUdxnyn6cDn53QKrh4MBiearma_current = _3UyUdxnyn6cDn53QKrh4MBiearma_current; const _J52RqweMe6hhv7RnLJMC8BExTE5_first: (CollectionPage | URL)[] = []; - const _trust_J52RqweMe6hhv7RnLJMC8BExTE5_first: Set = new Set(); + const _trust_J52RqweMe6hhv7RnLJMC8BExTE5_first: VocabTrustSet = new Set(); let _J52RqweMe6hhv7RnLJMC8BExTE5_first__array = values[\\"https://www.w3.org/ns/activitystreams#first\\"]; @@ -49008,7 +54345,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_J52RqweMe6hhv7RnLJMC8BExTE5_first = _J52RqweMe6hhv7RnLJMC8BExTE5_first; const _gyJJnyEFnuNVi1HFZKfAn3Hfn26_last: (CollectionPage | URL)[] = []; - const _trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last: Set = new Set(); + const _trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last: VocabTrustSet = new Set(); let _gyJJnyEFnuNVi1HFZKfAn3Hfn26_last__array = values[\\"https://www.w3.org/ns/activitystreams#last\\"]; @@ -49049,7 +54386,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = _gyJJnyEFnuNVi1HFZKfAn3Hfn26_last; const _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: (Object | Link | URL)[] = []; - const _trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: Set = new Set(); + const _trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: VocabTrustSet = new Set(); let _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items__array = values[\\"https://www.w3.org/ns/activitystreams#items\\"]; @@ -49097,7 +54434,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items; const _4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf: (Object | URL)[] = []; - const _trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf: Set = new Set(); + const _trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf: VocabTrustSet = new Set(); let _4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf__array = values[\\"https://w3id.org/fep/5711#likesOf\\"]; @@ -49138,7 +54475,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = _4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf; const _3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf: (Object | URL)[] = []; - const _trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf: Set = new Set(); + const _trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf: VocabTrustSet = new Set(); let _3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf__array = values[\\"https://w3id.org/fep/5711#sharesOf\\"]; @@ -49179,7 +54516,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = _3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf; const _3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf: (Object | URL)[] = []; - const _trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf: Set = new Set(); + const _trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf: VocabTrustSet = new Set(); let _3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf__array = values[\\"https://w3id.org/fep/5711#repliesOf\\"]; @@ -49220,7 +54557,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = _3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf; const _2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf: (Object | URL)[] = []; - const _trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf: Set = new Set(); + const _trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf: VocabTrustSet = new Set(); let _2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf__array = values[\\"https://w3id.org/fep/5711#inboxOf\\"]; @@ -49261,7 +54598,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = _2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf; const _4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf: (Object | URL)[] = []; - const _trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf: Set = new Set(); + const _trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf: VocabTrustSet = new Set(); let _4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf__array = values[\\"https://w3id.org/fep/5711#outboxOf\\"]; @@ -49302,7 +54639,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = _4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf; const _41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf: (Object | URL)[] = []; - const _trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf: Set = new Set(); + const _trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf: VocabTrustSet = new Set(); let _41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf__array = values[\\"https://w3id.org/fep/5711#followersOf\\"]; @@ -49343,7 +54680,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = _41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf; const _2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf: (Object | URL)[] = []; - const _trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf: Set = new Set(); + const _trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf: VocabTrustSet = new Set(); let _2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf__array = values[\\"https://w3id.org/fep/5711#followingOf\\"]; @@ -49384,7 +54721,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = _2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf; const _2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf: (Object | URL)[] = []; - const _trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf: Set = new Set(); + const _trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf: VocabTrustSet = new Set(); let _2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf__array = values[\\"https://w3id.org/fep/5711#likedOf\\"]; @@ -49758,7 +55095,7 @@ export class OrderedCollection extends Collection { } #_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: (Object | Link | URL)[] = []; - #_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: Set = new Set(); + #_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: VocabTrustSet = new Set(); /** * Constructs a new instance of OrderedCollection with the given values. @@ -49797,14 +55134,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu super(values, options); if (\\"items\\" in values && values.items != null) { - if (Array.isArray(values.items) && - values.items.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.items)) { + const array = values.items; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.items; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = values.items.slice(); + this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = copied; - for (let i = 0; i < values.items.length; i++) { - this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.add(i); - } + vocabSetTrustPrefix(this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length); } else { throw new TypeError( @@ -49826,8 +55185,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link OrderedCollection.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -49879,18 +55238,43 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as OrderedCollection;clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.slice();clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = new Set(this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items); + const clone = super.clone(values, options) as unknown as OrderedCollection;clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length < vocabSparseArrayMinimumLength + ? this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.slice() : vocabCopyPropertyArray(this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items);clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = vocabCopyTrustSet( + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, + ); if (\\"items\\" in values && values.items != null) { - if (Array.isArray(values.items) && - values.items.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.items)) { + const array = values.items; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.items; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = values.items.slice(); + clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = copied; clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = new Set(); - for (let i = 0; i < values.items.length; i++) { - clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length); } else { throw new TypeError( @@ -49902,7 +55286,107 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;items?: (Object | Link | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): OrderedCollection { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as OrderedCollection; + + { + const array = node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length; i++) { + const value = node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[i] = context.value(value); + } + } + } + } +} }); } + async #fetchItem( url: URL, options: { @@ -50245,7 +55729,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i)) { + !(i < (this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[vocabTrustPrefix] ?? 0) || + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#items\\"); @@ -50317,7 +55802,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i)) { + !(i < (this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[vocabTrustPrefix] ?? 0) || + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -50660,7 +56146,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: (Object | Link | URL)[] = []; - const _trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: Set = new Set(); + const _trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: VocabTrustSet = new Set(); let _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items__array = values[\\"https://www.w3.org/ns/activitystreams#items\\"]; @@ -50876,8 +56362,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link FeaturedCollection.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -50929,7 +56415,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as FeaturedCollection;clone.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic = this.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic.slice(); + const clone = super.clone(values, options) as unknown as FeaturedCollection;clone.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic = this.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic.length < vocabSparseArrayMinimumLength + ? this.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic.slice() : vocabCopyPropertyArray(this.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic); if (\\"topic\\" in values && values.topic != null) { if (values.topic instanceof Hashtag) { // @ts-ignore: type is checked above. @@ -50942,7 +56429,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice(); + clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length < vocabSparseArrayMinimumLength + ? this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice() : vocabCopyPropertyArray(this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable); if (\\"discoverable\\" in values && values.discoverable != null) { if (typeof values.discoverable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -50958,7 +56446,107 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;items?: (Object | Link | URL)[];topic?: Hashtag | null;discoverable?: boolean | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): FeaturedCollection { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as FeaturedCollection; + + { + const array = node.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic.length; i++) { + const value = node.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic[i]; + if (value != null && typeof value === \\"object\\") { + node.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic[i] = context.value(value); + } + } + } + } +} }); } + /** A single {@link Hashtag} object that represents the main topic or category * of this featured collection. * @@ -51512,10 +57100,10 @@ export class FeaturedItem extends Object { } #_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject: (Object | URL)[] = []; - #_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject: Set = new Set(); + #_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject: VocabTrustSet = new Set(); #_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization: (FeatureAuthorization | URL)[] = []; - #_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization: Set = new Set(); + #_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization: VocabTrustSet = new Set(); /** * Constructs a new instance of FeaturedItem with the given values. @@ -51590,8 +57178,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link FeaturedItem.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -51643,12 +57231,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as FeaturedItem;clone.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = this.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.slice();clone.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = new Set(this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject); + const clone = super.clone(values, options) as unknown as FeaturedItem;clone.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = this.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.length < vocabSparseArrayMinimumLength + ? this.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.slice() : vocabCopyPropertyArray(this.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject);clone.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = vocabCopyTrustSet( + this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject, clone.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject, + ); if (\\"featuredObject\\" in values && values.featuredObject != null) { if (values.featuredObject instanceof Object || values.featuredObject instanceof URL) { // @ts-ignore: type is checked above. clone.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = [values.featuredObject]; - clone.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = new Set([0]); + clone.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = new Set(); + clone.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredObject must be of type \\" + @@ -51656,12 +57248,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = this.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.slice();clone.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = new Set(this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization); + clone.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = this.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.slice() : vocabCopyPropertyArray(this.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization);clone.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = vocabCopyTrustSet( + this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization, clone.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization, + ); if (\\"featureAuthorization\\" in values && values.featureAuthorization != null) { if (values.featureAuthorization instanceof FeatureAuthorization || values.featureAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = [values.featureAuthorization]; - clone.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = new Set([0]); + clone.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = new Set(); + clone.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featureAuthorization must be of type \\" + @@ -51672,7 +57268,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];featuredObject?: Object | URL | null;featureAuthorization?: FeatureAuthorization | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): FeaturedItem { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as FeaturedItem; + + { + const array = node.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.length; i++) { + const value = node.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject[i]; + if (value != null && typeof value === \\"object\\") { + node.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.length; i++) { + const value = node.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization[i] = context.value(value); + } + } + } + } +} }); } + async #fetchFeaturedObject( url: URL, options: { @@ -51998,7 +57716,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject[0]; if (!(v instanceof URL) && - !this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.has(0)) { + !(0 < (this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject[vocabTrustPrefix] ?? 0) || + this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/7aa9#featuredObject\\"); @@ -52066,7 +57785,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.has(0)) { + !(0 < (this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject[vocabTrustPrefix] ?? 0) || + this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -52417,7 +58137,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.has(0)) { + !(0 < (this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/7aa9#featureAuthorization\\"); @@ -52485,7 +58206,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.has(0)) { + !(0 < (this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -52862,7 +58584,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject: (Object | URL)[] = []; - const _trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject: Set = new Set(); + const _trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject: VocabTrustSet = new Set(); let _Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject__array = values[\\"https://w3id.org/fep/7aa9#featuredObject\\"]; @@ -52903,7 +58625,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = _Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject; const _2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization: (FeatureAuthorization | URL)[] = []; - const _trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization: Set = new Set(); + const _trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization: VocabTrustSet = new Set(); let _2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization__array = values[\\"https://w3id.org/fep/7aa9#featureAuthorization\\"]; @@ -53188,10 +58910,34 @@ endpoints?: (URL)[];} ); } - if (Array.isArray(values.endpoints) && - values.endpoints.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.endpoints)) { + const array = values.endpoints; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.endpoints; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = values.endpoints.slice(); + this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = copied; } else { throw new TypeError( @@ -53213,8 +58959,8 @@ endpoints?: (URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link DidService.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -53258,7 +59004,8 @@ endpoints?: (URL)[];} options ); copyPortableProvenance(this, clone); - clone.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.slice(); + clone.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.length < vocabSparseArrayMinimumLength + ? this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.slice() : vocabCopyPropertyArray(this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint); if (\\"endpoint\\" in values && values.endpoint != null) { if (values.endpoint instanceof URL) { // @ts-ignore: type is checked above. @@ -53282,10 +59029,34 @@ endpoints?: (URL)[];} ); } - if (Array.isArray(values.endpoints) && - values.endpoints.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.endpoints)) { + const array = values.endpoints; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.endpoints; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = values.endpoints.slice(); + clone.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = copied; } else { throw new TypeError( @@ -53297,7 +59068,102 @@ endpoints?: (URL)[];} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +endpoint?: URL | null; +endpoints?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): DidService { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as DidService; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as DidService; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.length; i++) { + const value = node.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint[i] = context.value(value); + } + } + } + } +} }); } + /** A network address, such as an HTTP URL, at which services operate on behalf * of a DID subject. * @@ -53745,8 +59611,8 @@ endpoints?: (URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Export.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -53786,7 +59652,62 @@ endpoints?: (URL)[];} const clone = super.clone(values, options) as unknown as Export; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +endpoint?: URL | null; +endpoints?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Export { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -54171,7 +60092,7 @@ export class DataIntegrityProof { #_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite: (\\"eddsa-jcs-2022\\")[] = []; #_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: (Multikey | URL)[] = []; - #_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: Set = new Set(); + #_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: VocabTrustSet = new Set(); #_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose: (\\"assertionMethod\\" | \\"authentication\\" | \\"capabilityInvocation\\" | \\"capabilityDelegation\\" | \\"keyAgreement\\")[] = []; #_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue: (Uint8Array)[] = []; #_3qzP3ukEZoUziK5FEiA1RhU4aqac: (Temporal.Instant)[] = []; @@ -54293,8 +60214,8 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link DataIntegrityProof.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -54337,7 +60258,8 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | options ); copyPortableProvenance(this, clone); - clone.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite.slice(); + clone.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite.length < vocabSparseArrayMinimumLength + ? this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite.slice() : vocabCopyPropertyArray(this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite); if (\\"cryptosuite\\" in values && values.cryptosuite != null) { if (values.cryptosuite == \\"eddsa-jcs-2022\\") { // @ts-ignore: type is checked above. @@ -54350,12 +60272,16 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | ); } } - clone.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.slice();clone.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = new Set(this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod); + clone.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.length < vocabSparseArrayMinimumLength + ? this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.slice() : vocabCopyPropertyArray(this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod);clone.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = vocabCopyTrustSet( + this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod, clone.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod, + ); if (\\"verificationMethod\\" in values && values.verificationMethod != null) { if (values.verificationMethod instanceof Multikey || values.verificationMethod instanceof URL) { // @ts-ignore: type is checked above. clone.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = [values.verificationMethod]; - clone.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = new Set([0]); + clone.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = new Set(); + clone.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The verificationMethod must be of type \\" + @@ -54363,7 +60289,8 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | ); } } - clone.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose = this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose.slice(); + clone.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose = this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose.length < vocabSparseArrayMinimumLength + ? this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose.slice() : vocabCopyPropertyArray(this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose); if (\\"proofPurpose\\" in values && values.proofPurpose != null) { if (values.proofPurpose === \\"assertionMethod\\" || values.proofPurpose === \\"authentication\\" || values.proofPurpose === \\"capabilityInvocation\\" || values.proofPurpose === \\"capabilityDelegation\\" || @@ -54378,7 +60305,8 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | ); } } - clone.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue.slice(); + clone.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue.length < vocabSparseArrayMinimumLength + ? this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue.slice() : vocabCopyPropertyArray(this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue); if (\\"proofValue\\" in values && values.proofValue != null) { if (values.proofValue instanceof Uint8Array) { // @ts-ignore: type is checked above. @@ -54391,7 +60319,8 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | ); } } - clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac.slice(); + clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac.length < vocabSparseArrayMinimumLength + ? this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac.slice() : vocabCopyPropertyArray(this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac); if (\\"created\\" in values && values.created != null) { if (isTemporalInstant(values.created)) { // @ts-ignore: type is checked above. @@ -54407,7 +60336,123 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | null;proofPurpose?: \\"assertionMethod\\" | \\"authentication\\" | \\"capabilityInvocation\\" | \\"capabilityDelegation\\" | \\"keyAgreement\\" | null;proofValue?: Uint8Array | null;created?: Temporal.Instant | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): DataIntegrityProof { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as DataIntegrityProof; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as DataIntegrityProof; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.length; i++) { + const value = node.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue.length; i++) { + const value = node.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue[i] = context.value(value); + } + } + } + } +} }); } + /** The cryptographic suite used to create the proof. * */ @@ -54751,7 +60796,8 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | } let v = this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[0]; if (!(v instanceof URL) && - !this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.has(0)) { + !(0 < (this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#verificationMethod\\"); @@ -54785,7 +60831,8 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.has(0)) { + !(0 < (this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -55221,7 +61268,7 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL | instance.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite; const _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: (Multikey | URL)[] = []; - const _trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: Set = new Set(); + const _trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: VocabTrustSet = new Set(); let _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod__array = values[\\"https://w3id.org/security#verificationMethod\\"]; @@ -55606,7 +61653,7 @@ export class CryptographicKey { } #_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: Set = new Set(); + #_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: VocabTrustSet = new Set(); #_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem: (CryptoKey)[] = []; /** @@ -55688,8 +61735,8 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link CryptographicKey.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -55732,12 +61779,16 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi options ); copyPortableProvenance(this, clone); - clone.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.slice();clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = new Set(this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner); + clone.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.length < vocabSparseArrayMinimumLength + ? this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.slice() : vocabCopyPropertyArray(this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner);clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = vocabCopyTrustSet( + this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner, clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner, + ); if (\\"owner\\" in values && values.owner != null) { if (values.owner instanceof Application || values.owner instanceof Group || values.owner instanceof Organization || values.owner instanceof Person || values.owner instanceof Service || values.owner instanceof URL) { // @ts-ignore: type is checked above. clone.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = [values.owner]; - clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = new Set([0]); + clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = new Set(); + clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The owner must be of type \\" + @@ -55745,7 +61796,8 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi ); } } - clone.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem = this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem.slice(); + clone.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem = this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem.length < vocabSparseArrayMinimumLength + ? this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem.slice() : vocabCopyPropertyArray(this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem); if (\\"publicKey\\" in values && values.publicKey != null) { if ( // @ts-ignore: CryptoKey exists in the global scope. @@ -55764,7 +61816,101 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +owner?: Application | Group | Organization | Person | Service | URL | null;publicKey?: CryptoKey | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): CryptographicKey { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as CryptographicKey; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as CryptographicKey; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.length; i++) { + const value = node.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[i]; + if (value != null && typeof value === \\"object\\") { + node.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[i] = context.value(value); + } + } + } + } +} }); } + async #fetchOwner( url: URL, options: { @@ -56150,7 +62296,8 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi } let v = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[0]; if (!(v instanceof URL) && - !this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.has(0)) { + !(0 < (this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[vocabTrustPrefix] ?? 0) || + this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#owner\\"); @@ -56218,7 +62365,8 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.has(0)) { + !(0 < (this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[vocabTrustPrefix] ?? 0) || + this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -56589,7 +62737,7 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: Set = new Set(); + const _trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: VocabTrustSet = new Set(); let _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner__array = values[\\"https://w3id.org/security#owner\\"]; @@ -56873,7 +63021,7 @@ export class Multikey { } #_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: Set = new Set(); + #_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: VocabTrustSet = new Set(); #_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase: (CryptoKey)[] = []; /** @@ -56955,8 +63103,8 @@ controller?: Application | Group | Organization | Person | Service | URL | null; * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Multikey.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -56999,12 +63147,16 @@ controller?: Application | Group | Organization | Person | Service | URL | null; options ); copyPortableProvenance(this, clone); - clone.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.slice();clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = new Set(this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller); + clone.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.length < vocabSparseArrayMinimumLength + ? this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.slice() : vocabCopyPropertyArray(this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller);clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = vocabCopyTrustSet( + this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller, clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller, + ); if (\\"controller\\" in values && values.controller != null) { if (values.controller instanceof Application || values.controller instanceof Group || values.controller instanceof Organization || values.controller instanceof Person || values.controller instanceof Service || values.controller instanceof URL) { // @ts-ignore: type is checked above. clone.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = [values.controller]; - clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = new Set([0]); + clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = new Set(); + clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The controller must be of type \\" + @@ -57012,7 +63164,8 @@ controller?: Application | Group | Organization | Person | Service | URL | null; ); } } - clone.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase = this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase.slice(); + clone.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase = this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase.length < vocabSparseArrayMinimumLength + ? this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase.slice() : vocabCopyPropertyArray(this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase); if (\\"publicKey\\" in values && values.publicKey != null) { if ( // @ts-ignore: CryptoKey exists in the global scope. @@ -57031,7 +63184,101 @@ controller?: Application | Group | Organization | Person | Service | URL | null; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +controller?: Application | Group | Organization | Person | Service | URL | null;publicKey?: CryptoKey | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Multikey { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Multikey; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Multikey; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.length; i++) { + const value = node.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[i] = context.value(value); + } + } + } + } +} }); } + async #fetchController( url: URL, options: { @@ -57417,7 +63664,8 @@ controller?: Application | Group | Organization | Person | Service | URL | null; } let v = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[0]; if (!(v instanceof URL) && - !this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.has(0)) { + !(0 < (this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[vocabTrustPrefix] ?? 0) || + this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#controller\\"); @@ -57485,7 +63733,8 @@ controller?: Application | Group | Organization | Person | Service | URL | null; mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.has(0)) { + !(0 < (this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[vocabTrustPrefix] ?? 0) || + this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -57863,7 +64112,7 @@ controller?: Application | Group | Organization | Person | Service | URL | null; let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: Set = new Set(); + const _trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: VocabTrustSet = new Set(); let _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller__array = values[\\"https://w3id.org/security#controller\\"]; @@ -58160,8 +64409,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Agreement.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -58213,7 +64462,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Agreement;clone.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates = this.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates.slice(); + const clone = super.clone(values, options) as unknown as Agreement;clone.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates = this.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates.length < vocabSparseArrayMinimumLength + ? this.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates.slice() : vocabCopyPropertyArray(this.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates); if (\\"stipulates\\" in values && values.stipulates != null) { if (values.stipulates instanceof Commitment) { // @ts-ignore: type is checked above. @@ -58226,7 +64476,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal = this.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal.slice(); + clone.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal = this.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal.length < vocabSparseArrayMinimumLength + ? this.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal.slice() : vocabCopyPropertyArray(this.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal); if (\\"stipulatesReciprocal\\" in values && values.stipulatesReciprocal != null) { if (values.stipulatesReciprocal instanceof Commitment) { // @ts-ignore: type is checked above. @@ -58242,7 +64493,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];stipulates?: Commitment | null;stipulatesReciprocal?: Commitment | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Agreement { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Agreement; + + { + const array = node.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates.length; i++) { + const value = node.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates[i]; + if (value != null && typeof value === \\"object\\") { + node.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal.length; i++) { + const value = node.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal[i] = context.value(value); + } + } + } + } +} }); } + /** The primary {@link Commitment} associated with the agreement. This * commitment satisfies the primary {@link Intent} of the corresponding * {@link Proposal}. @@ -58951,8 +65324,8 @@ satisfies?: URL | null;resourceQuantity?: Measure | null;} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Commitment.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -58995,7 +65368,8 @@ satisfies?: URL | null;resourceQuantity?: Measure | null;} options ); copyPortableProvenance(this, clone); - clone.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies = this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies.slice(); + clone.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies = this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies.length < vocabSparseArrayMinimumLength + ? this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies.slice() : vocabCopyPropertyArray(this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies); if (\\"satisfies\\" in values && values.satisfies != null) { if (values.satisfies instanceof URL) { // @ts-ignore: type is checked above. @@ -59008,7 +65382,8 @@ satisfies?: URL | null;resourceQuantity?: Measure | null;} ); } } - clone.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.slice(); + clone.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.length < vocabSparseArrayMinimumLength + ? this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.slice() : vocabCopyPropertyArray(this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity); if (\\"resourceQuantity\\" in values && values.resourceQuantity != null) { if (values.resourceQuantity instanceof Measure) { // @ts-ignore: type is checked above. @@ -59024,7 +65399,123 @@ satisfies?: URL | null;resourceQuantity?: Measure | null;} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +satisfies?: URL | null;resourceQuantity?: Measure | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Commitment { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Commitment; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Commitment; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies.length; i++) { + const value = node.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies[i]; + if (value != null && typeof value === \\"object\\") { + node.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.length; i++) { + const value = node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity[i] = context.value(value); + } + } + } + } +} }); } + /** The {@link Intent} of a {@link Proposal} that this commitment * satisfies. The value is the proposal's URI with a * [fragment](https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Fragment) @@ -59752,8 +66243,8 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Intent.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -59796,7 +66287,8 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur options ); copyPortableProvenance(this, clone); - clone.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action = this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.slice(); + clone.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action = this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.length < vocabSparseArrayMinimumLength + ? this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.slice() : vocabCopyPropertyArray(this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action); if (\\"action\\" in values && values.action != null) { if (typeof values.action === \\"string\\") { // @ts-ignore: type is checked above. @@ -59809,7 +66301,8 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur ); } } - clone.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo = this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.slice(); + clone.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo = this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.length < vocabSparseArrayMinimumLength + ? this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.slice() : vocabCopyPropertyArray(this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo); if (\\"resourceConformsTo\\" in values && values.resourceConformsTo != null) { if (values.resourceConformsTo instanceof URL) { // @ts-ignore: type is checked above. @@ -59822,7 +66315,8 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur ); } } - clone.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.slice(); + clone.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.length < vocabSparseArrayMinimumLength + ? this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.slice() : vocabCopyPropertyArray(this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity); if (\\"resourceQuantity\\" in values && values.resourceQuantity != null) { if (values.resourceQuantity instanceof Measure) { // @ts-ignore: type is checked above. @@ -59835,7 +66329,8 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur ); } } - clone.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity = this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.slice(); + clone.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity = this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.length < vocabSparseArrayMinimumLength + ? this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.slice() : vocabCopyPropertyArray(this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity); if (\\"availableQuantity\\" in values && values.availableQuantity != null) { if (values.availableQuantity instanceof Measure) { // @ts-ignore: type is checked above. @@ -59848,7 +66343,8 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur ); } } - clone.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.slice(); + clone.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.length < vocabSparseArrayMinimumLength + ? this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.slice() : vocabCopyPropertyArray(this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity); if (\\"minimumQuantity\\" in values && values.minimumQuantity != null) { if (values.minimumQuantity instanceof Measure) { // @ts-ignore: type is checked above. @@ -59864,7 +66360,167 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measure | null;availableQuantity?: Measure | null;minimumQuantity?: Measure | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Intent { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Intent; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Intent; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.length; i++) { + const value = node.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo[i]; + if (value != null && typeof value === \\"object\\") { + node.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.length; i++) { + const value = node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity[i] = context.value(value); + } + } + } + } + + { + const array = node.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.length; i++) { + const value = node.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity[i]; + if (value != null && typeof value === \\"object\\") { + node.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.length; i++) { + const value = node.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity[i] = context.value(value); + } + } + } + } +} }); } + /** The type of economic transaction. The value of this property should be * either \`\\"deliverService\\"\` or \`\\"transfer\\"\`. * @@ -60822,8 +67478,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Proposal.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -60875,7 +67531,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Proposal;clone.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose = this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose.slice(); + const clone = super.clone(values, options) as unknown as Proposal;clone.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose = this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose.length < vocabSparseArrayMinimumLength + ? this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose.slice() : vocabCopyPropertyArray(this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose); if (\\"purpose\\" in values && values.purpose != null) { if (typeof values.purpose === \\"string\\") { // @ts-ignore: type is checked above. @@ -60888,7 +67545,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes = this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.slice(); + clone.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes = this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.length < vocabSparseArrayMinimumLength + ? this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.slice() : vocabCopyPropertyArray(this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes); if (\\"publishes\\" in values && values.publishes != null) { if (values.publishes instanceof Intent) { // @ts-ignore: type is checked above. @@ -60901,7 +67559,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal = this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.slice(); + clone.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal = this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.length < vocabSparseArrayMinimumLength + ? this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.slice() : vocabCopyPropertyArray(this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal); if (\\"reciprocal\\" in values && values.reciprocal != null) { if (values.reciprocal instanceof Intent) { // @ts-ignore: type is checked above. @@ -60914,7 +67573,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased.slice(); + clone.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased.length < vocabSparseArrayMinimumLength + ? this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased.slice() : vocabCopyPropertyArray(this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased); if (\\"unitBased\\" in values && values.unitBased != null) { if (typeof values.unitBased === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -60930,7 +67590,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];purpose?: string | null;publishes?: Intent | null;reciprocal?: Intent | null;unitBased?: boolean | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Proposal { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Proposal; + + { + const array = node.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.length; i++) { + const value = node.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes[i]; + if (value != null && typeof value === \\"object\\") { + node.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes[i] = context.value(value); + } + } + } + } + + { + const array = node.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.length; i++) { + const value = node.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal[i]; + if (value != null && typeof value === \\"object\\") { + node.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal[i] = context.value(value); + } + } + } + } +} }); } + /** The type of proposal. Possible values are \`\\"offer\\"\` and \`\\"request\\"\`. * */ @@ -61741,8 +68523,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Accept.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -61803,7 +68585,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Accept; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Accept { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -62187,8 +69045,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Add.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -62249,7 +69107,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Add; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Add { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -62628,8 +69562,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Announce.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -62690,7 +69624,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Announce; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Announce { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -63015,39 +70025,39 @@ export class Application extends Object { #_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername: ((string | LanguageString))[] = []; #_axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); #_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); #_hQiaHhZP8hqxckxTBrpsGNs57E3: (URL)[] = []; #_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers: (boolean)[] = []; #_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); #_41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); #_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); #_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); #_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); #_4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); #_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); #_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); #_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); #_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints: (Endpoints)[] = []; #_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable: (boolean)[] = []; #_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended: (boolean)[] = []; @@ -63055,13 +70065,13 @@ export class Application extends Object { #_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable: (boolean)[] = []; #_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); #_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); #_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); #_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage: (string)[] = []; #_2xEU4QtkC53RAun67T81Egqt9vmL_isCat: (boolean)[] = []; #_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense: (URL)[] = []; @@ -63130,10 +70140,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -63166,14 +70200,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; - for (let i = 0; i < values.publicKeys.length; i++) { - this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -63206,14 +70262,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; - for (let i = 0; i < values.assertionMethods.length; i++) { - this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -63246,10 +70324,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -63378,14 +70480,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | if (\\"streams\\" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; - for (let i = 0; i < values.streams.length; i++) { - this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -63496,14 +70620,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; - for (let i = 0; i < values.aliases.length; i++) { - this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -63536,14 +70682,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; - for (let i = 0; i < values.services.length; i++) { - this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -63604,8 +70772,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Application.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -63663,7 +70831,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Application;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice(); + const clone = super.clone(values, options) as unknown as Application;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < vocabSparseArrayMinimumLength + ? this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice() : vocabCopyPropertyArray(this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername); if (\\"preferredUsername\\" in values && values.preferredUsername != null) { if (typeof values.preferredUsername === \\"string\\" || values.preferredUsername instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -63687,10 +70856,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -63699,12 +70892,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice();clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length < vocabSparseArrayMinimumLength + ? this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice() : vocabCopyPropertyArray(this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey);clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = vocabCopyTrustSet( + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, + ); if (\\"publicKey\\" in values && values.publicKey != null) { if (values.publicKey instanceof CryptographicKey || values.publicKey instanceof URL) { // @ts-ignore: type is checked above. clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = [values.publicKey]; - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set([0]); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The publicKey must be of type \\" + @@ -63723,15 +70920,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); - for (let i = 0; i < values.publicKeys.length; i++) { - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -63740,12 +70959,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice();clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length < vocabSparseArrayMinimumLength + ? this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice() : vocabCopyPropertyArray(this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod);clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = vocabCopyTrustSet( + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, + ); if (\\"assertionMethod\\" in values && values.assertionMethod != null) { if (values.assertionMethod instanceof Multikey || values.assertionMethod instanceof URL) { // @ts-ignore: type is checked above. clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = [values.assertionMethod]; - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set([0]); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The assertionMethod must be of type \\" + @@ -63764,15 +70987,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); - for (let i = 0; i < values.assertionMethods.length; i++) { - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -63781,7 +71026,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length < vocabSparseArrayMinimumLength + ? this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice() : vocabCopyPropertyArray(this.#_hQiaHhZP8hqxckxTBrpsGNs57E3); if (\\"gateway\\" in values && values.gateway != null) { if (values.gateway instanceof URL && isGatewayUrl(values.gateway)) { // @ts-ignore: type is checked above. @@ -63805,10 +71051,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -63817,7 +71087,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice(); + clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.length < vocabSparseArrayMinimumLength + ? this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice() : vocabCopyPropertyArray(this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers); if (\\"manuallyApprovesFollowers\\" in values && values.manuallyApprovesFollowers != null) { if (typeof values.manuallyApprovesFollowers === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -63830,12 +71101,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice();clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox); + clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length < vocabSparseArrayMinimumLength + ? this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice() : vocabCopyPropertyArray(this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox);clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = vocabCopyTrustSet( + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, + ); if (\\"inbox\\" in values && values.inbox != null) { if (values.inbox instanceof OrderedCollection || values.inbox instanceof OrderedCollectionPage || values.inbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = [values.inbox]; - clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set([0]); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The inbox must be of type \\" + @@ -63843,12 +71118,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice();clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox); + clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length < vocabSparseArrayMinimumLength + ? this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice() : vocabCopyPropertyArray(this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox);clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = vocabCopyTrustSet( + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, + ); if (\\"outbox\\" in values && values.outbox != null) { if (values.outbox instanceof OrderedCollection || values.outbox instanceof OrderedCollectionPage || values.outbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = [values.outbox]; - clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set([0]); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The outbox must be of type \\" + @@ -63856,12 +71135,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice();clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following); + clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length < vocabSparseArrayMinimumLength + ? this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice() : vocabCopyPropertyArray(this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following);clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = vocabCopyTrustSet( + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, + ); if (\\"following\\" in values && values.following != null) { if (values.following instanceof Collection || values.following instanceof URL) { // @ts-ignore: type is checked above. clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = [values.following]; - clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set([0]); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The following must be of type \\" + @@ -63869,12 +71152,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice();clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers); + clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length < vocabSparseArrayMinimumLength + ? this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice() : vocabCopyPropertyArray(this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers);clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = vocabCopyTrustSet( + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, + ); if (\\"followers\\" in values && values.followers != null) { if (values.followers instanceof Collection || values.followers instanceof URL) { // @ts-ignore: type is checked above. clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = [values.followers]; - clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set([0]); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The followers must be of type \\" + @@ -63882,12 +71169,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice();clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked); + clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length < vocabSparseArrayMinimumLength + ? this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice() : vocabCopyPropertyArray(this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked);clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = vocabCopyTrustSet( + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, + ); if (\\"liked\\" in values && values.liked != null) { if (values.liked instanceof Collection || values.liked instanceof URL) { // @ts-ignore: type is checked above. clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = [values.liked]; - clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set([0]); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The liked must be of type \\" + @@ -63895,12 +71186,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice();clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured); + clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length < vocabSparseArrayMinimumLength + ? this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice() : vocabCopyPropertyArray(this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured);clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = vocabCopyTrustSet( + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, + ); if (\\"featured\\" in values && values.featured != null) { if (values.featured instanceof Collection || values.featured instanceof URL) { // @ts-ignore: type is checked above. clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = [values.featured]; - clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set([0]); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featured must be of type \\" + @@ -63908,12 +71203,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice();clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags); + clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length < vocabSparseArrayMinimumLength + ? this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice() : vocabCopyPropertyArray(this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags);clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = vocabCopyTrustSet( + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, + ); if (\\"featuredTags\\" in values && values.featuredTags != null) { if (values.featuredTags instanceof Collection || values.featuredTags instanceof URL) { // @ts-ignore: type is checked above. clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = [values.featuredTags]; - clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set([0]); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredTags must be of type \\" + @@ -63921,12 +71220,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice();clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections); + clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length < vocabSparseArrayMinimumLength + ? this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice() : vocabCopyPropertyArray(this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections);clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = vocabCopyTrustSet( + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, + ); if (\\"featuredCollections\\" in values && values.featuredCollections != null) { if (values.featuredCollections instanceof Collection || values.featuredCollections instanceof URL) { // @ts-ignore: type is checked above. clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = [values.featuredCollections]; - clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set([0]); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredCollections must be of type \\" + @@ -63934,18 +71237,43 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice();clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length < vocabSparseArrayMinimumLength + ? this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice() : vocabCopyPropertyArray(this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams);clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = vocabCopyTrustSet( + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, + ); if (\\"streams\\" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(); - for (let i = 0; i < values.streams.length; i++) { - clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -63954,7 +71282,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice(); + clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length < vocabSparseArrayMinimumLength + ? this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice() : vocabCopyPropertyArray(this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints); if (\\"endpoints\\" in values && values.endpoints != null) { if (values.endpoints instanceof Endpoints) { // @ts-ignore: type is checked above. @@ -63967,7 +71296,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice(); + clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length < vocabSparseArrayMinimumLength + ? this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice() : vocabCopyPropertyArray(this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable); if (\\"discoverable\\" in values && values.discoverable != null) { if (typeof values.discoverable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -63980,7 +71310,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice(); + clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.length < vocabSparseArrayMinimumLength + ? this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice() : vocabCopyPropertyArray(this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended); if (\\"suspended\\" in values && values.suspended != null) { if (typeof values.suspended === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -63993,7 +71324,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice(); + clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.length < vocabSparseArrayMinimumLength + ? this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice() : vocabCopyPropertyArray(this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial); if (\\"memorial\\" in values && values.memorial != null) { if (typeof values.memorial === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -64006,7 +71338,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice(); + clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.length < vocabSparseArrayMinimumLength + ? this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice() : vocabCopyPropertyArray(this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable); if (\\"indexable\\" in values && values.indexable != null) { if (typeof values.indexable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -64019,12 +71352,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice();clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo); + clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length < vocabSparseArrayMinimumLength + ? this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice() : vocabCopyPropertyArray(this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo);clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = vocabCopyTrustSet( + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, + ); if (\\"successor\\" in values && values.successor != null) { if (values.successor instanceof Application || values.successor instanceof Group || values.successor instanceof Organization || values.successor instanceof Person || values.successor instanceof Service || values.successor instanceof URL) { // @ts-ignore: type is checked above. clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = [values.successor]; - clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set([0]); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The successor must be of type \\" + @@ -64032,12 +71369,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice();clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length < vocabSparseArrayMinimumLength + ? this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice() : vocabCopyPropertyArray(this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs);clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = vocabCopyTrustSet( + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, + ); if (\\"alias\\" in values && values.alias != null) { if (values.alias instanceof Application || values.alias instanceof Group || values.alias instanceof Organization || values.alias instanceof Person || values.alias instanceof Service || values.alias instanceof URL) { // @ts-ignore: type is checked above. clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = [values.alias]; - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set([0]); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The alias must be of type \\" + @@ -64056,15 +71397,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); - for (let i = 0; i < values.aliases.length; i++) { - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -64073,12 +71436,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice();clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length < vocabSparseArrayMinimumLength + ? this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice() : vocabCopyPropertyArray(this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service);clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = vocabCopyTrustSet( + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, + ); if (\\"service\\" in values && values.service != null) { if (values.service instanceof DidService || values.service instanceof URL) { // @ts-ignore: type is checked above. clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = [values.service]; - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set([0]); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The service must be of type \\" + @@ -64097,15 +71464,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); - for (let i = 0; i < values.services.length; i++) { - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -64114,7 +71503,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice(); + clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.length < vocabSparseArrayMinimumLength + ? this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice() : vocabCopyPropertyArray(this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage); if (\\"followedMessage\\" in values && values.followedMessage != null) { if (typeof values.followedMessage === \\"string\\") { // @ts-ignore: type is checked above. @@ -64127,7 +71517,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice(); + clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.length < vocabSparseArrayMinimumLength + ? this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice() : vocabCopyPropertyArray(this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat); if (\\"cat\\" in values && values.cat != null) { if (typeof values.cat === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -64140,7 +71531,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice(); + clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length < vocabSparseArrayMinimumLength + ? this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice() : vocabCopyPropertyArray(this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense); if (\\"preferredLicense\\" in values && values.preferredLicense != null) { if (values.preferredLicense instanceof URL) { // @ts-ignore: type is checked above. @@ -64156,7 +71548,465 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];preferredUsername?: string | LanguageString | null; +preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; +publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; +assertionMethods?: (Multikey | URL)[];gateway?: URL | null; +gateways?: (URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;featuredCollections?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; +aliases?: (Application | Group | Organization | Person | Service | URL)[];service?: DidService | URL | null; +services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | null;preferredLicense?: URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Application { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Application; + + { + const array = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length; i++) { + const value = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i]; + if (value != null && typeof value === \\"object\\") { + node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length; i++) { + const value = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i] = context.value(value); + } + } + } + } + + { + const array = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length; i++) { + const value = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i]; + if (value != null && typeof value === \\"object\\") { + node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length; i++) { + const value = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length; i++) { + const value = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length; i++) { + const value = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i] = context.value(value); + } + } + } + } + + { + const array = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length; i++) { + const value = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i]; + if (value != null && typeof value === \\"object\\") { + node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length; i++) { + const value = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length; i++) { + const value = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length; i++) { + const value = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i] = context.value(value); + } + } + } + } + + { + const array = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length; i++) { + const value = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i]; + if (value != null && typeof value === \\"object\\") { + node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length; i++) { + const value = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i] = context.value(value); + } + } + } + } + + { + const array = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length; i++) { + const value = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i]; + if (value != null && typeof value === \\"object\\") { + node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length; i++) { + const value = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length; i++) { + const value = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length; i++) { + const value = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i] = context.value(value); + } + } + } + } + + { + const array = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length; i++) { + const value = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i]; + if (value != null && typeof value === \\"object\\") { + node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i] = context.value(value); + } + } + } + } +} }); } + /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. * @@ -64505,7 +72355,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[0]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#publicKey\\"); @@ -64573,7 +72424,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -64660,7 +72512,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#publicKey\\"); @@ -64732,7 +72585,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -65086,7 +72940,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#assertionMethod\\"); @@ -65154,7 +73009,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -65245,7 +73101,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#assertionMethod\\"); @@ -65317,7 +73174,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -65741,7 +73599,8 @@ get gateways(): (URL)[] { } let v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0]; if (!(v instanceof URL) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://www.w3.org/ns/ldp#inbox\\"); @@ -65809,7 +73668,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -66183,7 +74043,8 @@ get gateways(): (URL)[] { } let v = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[0]; if (!(v instanceof URL) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#outbox\\"); @@ -66251,7 +74112,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -66605,7 +74467,8 @@ get gateways(): (URL)[] { } let v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0]; if (!(v instanceof URL) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#following\\"); @@ -66673,7 +74536,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -67030,7 +74894,8 @@ get gateways(): (URL)[] { } let v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0]; if (!(v instanceof URL) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#followers\\"); @@ -67098,7 +74963,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -67453,7 +75319,8 @@ get gateways(): (URL)[] { } let v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0]; if (!(v instanceof URL) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#liked\\"); @@ -67521,7 +75388,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -67874,7 +75742,8 @@ get gateways(): (URL)[] { } let v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[0]; if (!(v instanceof URL) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://joinmastodon.org/ns#featured\\"); @@ -67942,7 +75811,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -68295,7 +76165,8 @@ get gateways(): (URL)[] { } let v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0]; if (!(v instanceof URL) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://joinmastodon.org/ns#featuredTags\\"); @@ -68363,7 +76234,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -68713,7 +76585,8 @@ get gateways(): (URL)[] { } let v = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[0]; if (!(v instanceof URL) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/7aa9#featuredCollections\\"); @@ -68781,7 +76654,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -69131,7 +77005,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#streams\\"); @@ -69203,7 +77078,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -69688,7 +77564,8 @@ get gateways(): (URL)[] { } let v = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0]; if (!(v instanceof URL) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#movedTo\\"); @@ -69756,7 +77633,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -70169,7 +78047,8 @@ get gateways(): (URL)[] { } let v = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"); @@ -70237,7 +78116,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -70328,7 +78208,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"); @@ -70400,7 +78281,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -70754,7 +78636,8 @@ get gateways(): (URL)[] { } let v = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/did#service\\"); @@ -70822,7 +78705,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -70913,7 +78797,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/did#service\\"); @@ -70985,7 +78870,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -72384,7 +80270,7 @@ get gateways(): (URL)[] { instance.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; const _axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); let _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array = values[\\"https://w3id.org/security#publicKey\\"]; @@ -72425,7 +80311,7 @@ get gateways(): (URL)[] { instance.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = _axq166E2eZADq34V4MYUc8KMZdC_publicKey; const _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); let _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array = values[\\"https://w3id.org/security#assertionMethod\\"]; @@ -72524,7 +80410,7 @@ get gateways(): (URL)[] { instance.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers; const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); let _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array = values[\\"http://www.w3.org/ns/ldp#inbox\\"]; @@ -72571,7 +80457,7 @@ get gateways(): (URL)[] { instance.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; const _41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); let _41QwhqJouoLg3h8dRPKat21brynC_outbox__array = values[\\"https://www.w3.org/ns/activitystreams#outbox\\"]; @@ -72618,7 +80504,7 @@ get gateways(): (URL)[] { instance.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = _41QwhqJouoLg3h8dRPKat21brynC_outbox; const _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); let _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array = values[\\"https://www.w3.org/ns/activitystreams#following\\"]; @@ -72659,7 +80545,7 @@ get gateways(): (URL)[] { instance.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; const _BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); let _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array = values[\\"https://www.w3.org/ns/activitystreams#followers\\"]; @@ -72700,7 +80586,7 @@ get gateways(): (URL)[] { instance.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = _BBCTgfphhsFzpVfKTykGSpBNwoA_followers; const _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); let _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array = values[\\"https://www.w3.org/ns/activitystreams#liked\\"]; @@ -72741,7 +80627,7 @@ get gateways(): (URL)[] { instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; const _4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); let _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array = values[\\"http://joinmastodon.org/ns#featured\\"]; @@ -72782,7 +80668,7 @@ get gateways(): (URL)[] { instance.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = _4N1vBJzXDf8NbBumeECQMFvKetja_featured; const _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); let _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array = values[\\"http://joinmastodon.org/ns#featuredTags\\"]; @@ -72823,7 +80709,7 @@ get gateways(): (URL)[] { instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; const _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); let _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections__array = values[\\"https://w3id.org/fep/7aa9#featuredCollections\\"]; @@ -72864,7 +80750,7 @@ get gateways(): (URL)[] { instance.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); let _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array = values[\\"https://www.w3.org/ns/activitystreams#streams\\"]; @@ -73053,7 +80939,7 @@ get gateways(): (URL)[] { instance.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable; const _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); let _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array = values[\\"https://www.w3.org/ns/activitystreams#movedTo\\"]; @@ -73111,7 +80997,7 @@ get gateways(): (URL)[] { instance.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; const _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); let _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array = values[\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"]; @@ -73169,7 +81055,7 @@ get gateways(): (URL)[] { instance.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; const _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); let _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array = values[\\"https://www.w3.org/ns/did#service\\"]; @@ -73938,46 +81824,127 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} -, +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + verifyPortableObject?: PortableObjectVerifier, + } = {}, + ) { + super(values, options);} + + /** + * Clones this instance, optionally updating it with the given values. + * + * This is a shallow copy: property arrays are copied, but nested objects + * and URLs are shared with this instance. Dereferencing accessors can cache + * fetched objects in the instance whose accessor is called. Hydrating a + * shared nested object through the clone can affect the original as well, + * and can change JSON-LD output when either is embedded in another + * object. Hydrating a top-level property of the clone does not update this + * instance's property. + * + * To resolve properties without sharing nested objects, use + * {@link IntransitiveActivity.deepClone} before hydration. + * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) + * for details, including how cached JSON-LD affects serialization. + * + * A clone never inherits a signed JSON-LD representation retained by + * \`signObject()\`: the clone may differ from the document that the proof + * covers, so embedding the original secured JSON in a parent document + * would be wrong. Sign the clone again if it has to be embedded as a + * secured child. + * + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance with its own property arrays. Nested objects + * and URLs are shared with this instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} + + = {}, options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, verifyPortableObject?: PortableObjectVerifier, - } = {}, - ) { - super(values, options);} + } = {} + ): IntransitiveActivity { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as IntransitiveActivity; + return clone; + } /** - * Clones this instance, optionally updating it with the given values. + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. * - * This is a shallow copy: property arrays are copied, but nested objects - * and URLs are shared with this instance. Dereferencing accessors can cache - * fetched objects in the instance whose accessor is called. Hydrating a - * shared nested object through the clone can affect the original as well, - * and can change JSON-LD output when either is embedded in another - * object. Hydrating a top-level property of the clone does not update this - * instance's property. + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. - * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) - * for details, including how cached JSON-LD affects serialization. + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. * - * A clone never inherits a signed JSON-LD representation retained by - * \`signObject()\`: the clone may differ from the document that the proof - * covers, so embedding the original secured JSON in a parent document - * would be wrong. Sign the clone again if it has to be embedded as a - * secured child. + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. * - * @param values The values to update the clone with. - * @param options The options to use for cloning. - * @returns The cloned instance with its own property arrays. Nested objects - * and URLs are shared with this instance. + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 */ - override clone( - values: - { + override deepClone(values: +{ id?: URL | null; attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; @@ -74002,26 +81969,21 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - verifyPortableObject?: PortableObjectVerifier, - } = {} - ): IntransitiveActivity { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - // @ts-ignore: $warning is not recognized as a property, but it is. - options = { ...options, $warning: this._warning }; - } - const clone = super.clone(values, options) as unknown as IntransitiveActivity; - return clone; += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): IntransitiveActivity { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -74412,8 +82374,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Arrive.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -74474,7 +82436,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Arrive; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Arrive { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -74798,11 +82836,11 @@ export class Article extends Object { } #_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); #_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; #_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); /** * Constructs a new instance of Article with the given values. @@ -74890,8 +82928,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Article.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -74943,12 +82981,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Article;clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice();clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote); + const clone = super.clone(values, options) as unknown as Article;clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length < vocabSparseArrayMinimumLength + ? this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice() : vocabCopyPropertyArray(this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote);clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = vocabCopyTrustSet( + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, + ); if (\\"quote\\" in values && values.quote != null) { if (values.quote instanceof Object || values.quote instanceof URL) { // @ts-ignore: type is checked above. clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = [values.quote]; - clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set([0]); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The quote must be of type \\" + @@ -74956,7 +82998,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice(); + clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length < vocabSparseArrayMinimumLength + ? this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice() : vocabCopyPropertyArray(this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl); if (\\"quoteUrl\\" in values && values.quoteUrl != null) { if (values.quoteUrl instanceof URL) { // @ts-ignore: type is checked above. @@ -74969,12 +83012,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice();clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization); + clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice() : vocabCopyPropertyArray(this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization);clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = vocabCopyTrustSet( + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, + ); if (\\"quoteAuthorization\\" in values && values.quoteAuthorization != null) { if (values.quoteAuthorization instanceof QuoteAuthorization || values.quoteAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = [values.quoteAuthorization]; - clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set([0]); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The quoteAuthorization must be of type \\" + @@ -74985,7 +83032,151 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];quote?: Object | URL | null;quoteUrl?: URL | null;quoteAuthorization?: QuoteAuthorization | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Article { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Article; + + { + const array = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length; i++) { + const value = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i] = context.value(value); + } + } + } + } + + { + const array = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length; i++) { + const value = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i]; + if (value != null && typeof value === \\"object\\") { + node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i] = context.value(value); + } + } + } + } + + { + const array = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length; i++) { + const value = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i]; + if (value != null && typeof value === \\"object\\") { + node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i] = context.value(value); + } + } + } + } +} }); } + async #fetchQuote( url: URL, options: { @@ -75314,7 +83505,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[0]; if (!(v instanceof URL) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/044f#quote\\"); @@ -75382,7 +83574,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -75756,7 +83949,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/044f#quoteAuthorization\\"); @@ -75824,7 +84018,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -76251,7 +84446,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); let _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote__array = values[\\"https://w3id.org/fep/044f#quote\\"]; @@ -76331,7 +84526,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; const _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); let _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization__array = values[\\"https://w3id.org/fep/044f#quoteAuthorization\\"]; @@ -76589,8 +84784,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Document.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -76642,7 +84837,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Document;clone.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.slice(); + const clone = super.clone(values, options) as unknown as Document;clone.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.length < vocabSparseArrayMinimumLength + ? this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.slice() : vocabCopyPropertyArray(this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width); if (\\"width\\" in values && values.width != null) { if (typeof values.width === \\"number\\" && Number.isInteger(values.width) && values.width >= 0) { // @ts-ignore: type is checked above. @@ -76655,7 +84851,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.slice(); + clone.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.length < vocabSparseArrayMinimumLength + ? this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.slice() : vocabCopyPropertyArray(this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height); if (\\"height\\" in values && values.height != null) { if (typeof values.height === \\"number\\" && Number.isInteger(values.height) && values.height >= 0) { // @ts-ignore: type is checked above. @@ -76668,7 +84865,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase = this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase.slice(); + clone.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase = this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase.length < vocabSparseArrayMinimumLength + ? this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase.slice() : vocabCopyPropertyArray(this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase); if (\\"digestMultibase\\" in values && values.digestMultibase != null) { if (typeof values.digestMultibase === \\"string\\") { // @ts-ignore: type is checked above. @@ -76684,7 +84882,77 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];width?: number | null;height?: number | null;digestMultibase?: string | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Document { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** Specifies a hint as to the rendering width in * device-independent pixels of the linked resource. * @@ -77397,8 +85665,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Audio.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -77453,7 +85721,77 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const clone = super.clone(values, options) as unknown as Audio; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];width?: number | null;height?: number | null;digestMultibase?: string | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Audio { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -77829,46 +86167,127 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} -, +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + verifyPortableObject?: PortableObjectVerifier, + } = {}, + ) { + super(values, options);} + + /** + * Clones this instance, optionally updating it with the given values. + * + * This is a shallow copy: property arrays are copied, but nested objects + * and URLs are shared with this instance. Dereferencing accessors can cache + * fetched objects in the instance whose accessor is called. Hydrating a + * shared nested object through the clone can affect the original as well, + * and can change JSON-LD output when either is embedded in another + * object. Hydrating a top-level property of the clone does not update this + * instance's property. + * + * To resolve properties without sharing nested objects, use + * {@link Ignore.deepClone} before hydration. + * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) + * for details, including how cached JSON-LD affects serialization. + * + * A clone never inherits a signed JSON-LD representation retained by + * \`signObject()\`: the clone may differ from the document that the proof + * covers, so embedding the original secured JSON in a parent document + * would be wrong. Sign the clone again if it has to be embedded as a + * secured child. + * + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance with its own property arrays. Nested objects + * and URLs are shared with this instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} + + = {}, options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, verifyPortableObject?: PortableObjectVerifier, - } = {}, - ) { - super(values, options);} + } = {} + ): Ignore { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as Ignore; + return clone; + } /** - * Clones this instance, optionally updating it with the given values. + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. * - * This is a shallow copy: property arrays are copied, but nested objects - * and URLs are shared with this instance. Dereferencing accessors can cache - * fetched objects in the instance whose accessor is called. Hydrating a - * shared nested object through the clone can affect the original as well, - * and can change JSON-LD output when either is embedded in another - * object. Hydrating a top-level property of the clone does not update this - * instance's property. + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. - * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) - * for details, including how cached JSON-LD affects serialization. + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. * - * A clone never inherits a signed JSON-LD representation retained by - * \`signObject()\`: the clone may differ from the document that the proof - * covers, so embedding the original secured JSON in a parent document - * would be wrong. Sign the clone again if it has to be embedded as a - * secured child. + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. * - * @param values The values to update the clone with. - * @param options The options to use for cloning. - * @returns The cloned instance with its own property arrays. Nested objects - * and URLs are shared with this instance. + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 */ - override clone( - values: - { + override deepClone(values: +{ id?: URL | null; attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; @@ -77893,26 +86312,21 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - verifyPortableObject?: PortableObjectVerifier, - } = {} - ): Ignore { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - // @ts-ignore: $warning is not recognized as a property, but it is. - options = { ...options, $warning: this._warning }; - } - const clone = super.clone(values, options) as unknown as Ignore; - return clone; += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Ignore { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -78296,8 +86710,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Block.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -78358,7 +86772,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Block; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Block { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -78685,13 +87175,13 @@ export class CollectionPage extends Collection { } #_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf: (Collection | URL)[] = []; - #_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf: Set = new Set(); + #_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf: VocabTrustSet = new Set(); #_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next: (CollectionPage | URL)[] = []; - #_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next: Set = new Set(); + #_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next: VocabTrustSet = new Set(); #_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev: (CollectionPage | URL)[] = []; - #_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev: Set = new Set(); + #_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev: VocabTrustSet = new Set(); /** * Constructs a new instance of CollectionPage with the given values. @@ -78779,8 +87269,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link CollectionPage.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -78832,12 +87322,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as CollectionPage;clone.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.slice();clone.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = new Set(this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf); + const clone = super.clone(values, options) as unknown as CollectionPage;clone.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.length < vocabSparseArrayMinimumLength + ? this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.slice() : vocabCopyPropertyArray(this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf);clone.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = vocabCopyTrustSet( + this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf, clone.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf, + ); if (\\"partOf\\" in values && values.partOf != null) { if (values.partOf instanceof Collection || values.partOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = [values.partOf]; - clone.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = new Set([0]); + clone.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = new Set(); + clone.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The partOf must be of type \\" + @@ -78845,12 +87339,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.slice();clone.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = new Set(this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next); + clone.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.length < vocabSparseArrayMinimumLength + ? this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.slice() : vocabCopyPropertyArray(this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next);clone.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = vocabCopyTrustSet( + this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next, clone.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next, + ); if (\\"next\\" in values && values.next != null) { if (values.next instanceof CollectionPage || values.next instanceof URL) { // @ts-ignore: type is checked above. clone.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = [values.next]; - clone.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = new Set([0]); + clone.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = new Set(); + clone.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The next must be of type \\" + @@ -78858,12 +87356,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.slice();clone.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = new Set(this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev); + clone.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.length < vocabSparseArrayMinimumLength + ? this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.slice() : vocabCopyPropertyArray(this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev);clone.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = vocabCopyTrustSet( + this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev, clone.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev, + ); if (\\"prev\\" in values && values.prev != null) { if (values.prev instanceof CollectionPage || values.prev instanceof URL) { // @ts-ignore: type is checked above. clone.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = [values.prev]; - clone.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = new Set([0]); + clone.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = new Set(); + clone.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The prev must be of type \\" + @@ -78874,7 +87376,151 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): CollectionPage { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as CollectionPage; + + { + const array = node.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.length; i++) { + const value = node.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.length; i++) { + const value = node.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.length; i++) { + const value = node.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev[i] = context.value(value); + } + } + } + } +} }); } + async #fetchPartOf( url: URL, options: { @@ -79202,7 +87848,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf[0]; if (!(v instanceof URL) && - !this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.has(0)) { + !(0 < (this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#partOf\\"); @@ -79270,7 +87917,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.has(0)) { + !(0 < (this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -79619,7 +88267,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next[0]; if (!(v instanceof URL) && - !this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.has(0)) { + !(0 < (this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next[vocabTrustPrefix] ?? 0) || + this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#next\\"); @@ -79687,7 +88336,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.has(0)) { + !(0 < (this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next[vocabTrustPrefix] ?? 0) || + this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -80037,7 +88687,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev[0]; if (!(v instanceof URL) && - !this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.has(0)) { + !(0 < (this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev[vocabTrustPrefix] ?? 0) || + this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#prev\\"); @@ -80105,7 +88756,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.has(0)) { + !(0 < (this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev[vocabTrustPrefix] ?? 0) || + this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -80526,7 +89178,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf: (Collection | URL)[] = []; - const _trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf: Set = new Set(); + const _trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf: VocabTrustSet = new Set(); let _2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf__array = values[\\"https://www.w3.org/ns/activitystreams#partOf\\"]; @@ -80567,7 +89219,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = _2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf; const _3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next: (CollectionPage | URL)[] = []; - const _trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next: Set = new Set(); + const _trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next: VocabTrustSet = new Set(); let _3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next__array = values[\\"https://www.w3.org/ns/activitystreams#next\\"]; @@ -80608,7 +89260,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = _3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next; const _3b8yG8tDNzQFFEnWhCc13G8eHooA_prev: (CollectionPage | URL)[] = []; - const _trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev: Set = new Set(); + const _trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev: VocabTrustSet = new Set(); let _3b8yG8tDNzQFFEnWhCc13G8eHooA_prev__array = values[\\"https://www.w3.org/ns/activitystreams#prev\\"]; @@ -80830,8 +89482,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Create.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -80892,7 +89544,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Create; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Create { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -81270,8 +89998,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Delete.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -81332,7 +90060,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Delete; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Delete { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -81708,8 +90512,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Dislike.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -81770,7 +90574,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Dislike; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Dislike { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -82310,8 +91190,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Endpoints.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -82354,7 +91234,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint options ); copyPortableProvenance(this, clone); - clone.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl = this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl.slice(); + clone.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl = this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl.length < vocabSparseArrayMinimumLength + ? this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl.slice() : vocabCopyPropertyArray(this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl); if (\\"proxyUrl\\" in values && values.proxyUrl != null) { if (values.proxyUrl instanceof URL) { // @ts-ignore: type is checked above. @@ -82367,7 +91248,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint ); } } - clone.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint = this.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint.slice(); + clone.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint = this.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint.length < vocabSparseArrayMinimumLength + ? this.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint.slice() : vocabCopyPropertyArray(this.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint); if (\\"oauthAuthorizationEndpoint\\" in values && values.oauthAuthorizationEndpoint != null) { if (values.oauthAuthorizationEndpoint instanceof URL) { // @ts-ignore: type is checked above. @@ -82380,7 +91262,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint ); } } - clone.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint = this.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint.slice(); + clone.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint = this.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint.length < vocabSparseArrayMinimumLength + ? this.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint.slice() : vocabCopyPropertyArray(this.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint); if (\\"oauthTokenEndpoint\\" in values && values.oauthTokenEndpoint != null) { if (values.oauthTokenEndpoint instanceof URL) { // @ts-ignore: type is checked above. @@ -82393,7 +91276,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint ); } } - clone.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey = this.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey.slice(); + clone.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey = this.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey.length < vocabSparseArrayMinimumLength + ? this.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey.slice() : vocabCopyPropertyArray(this.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey); if (\\"provideClientKey\\" in values && values.provideClientKey != null) { if (values.provideClientKey instanceof URL) { // @ts-ignore: type is checked above. @@ -82406,7 +91290,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint ); } } - clone.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey = this.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey.slice(); + clone.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey = this.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey.length < vocabSparseArrayMinimumLength + ? this.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey.slice() : vocabCopyPropertyArray(this.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey); if (\\"signClientKey\\" in values && values.signClientKey != null) { if (values.signClientKey instanceof URL) { // @ts-ignore: type is checked above. @@ -82419,7 +91304,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint ); } } - clone.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox = this.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox.slice(); + clone.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox = this.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox.length < vocabSparseArrayMinimumLength + ? this.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox.slice() : vocabCopyPropertyArray(this.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox); if (\\"sharedInbox\\" in values && values.sharedInbox != null) { if (values.sharedInbox instanceof URL) { // @ts-ignore: type is checked above. @@ -82432,7 +91318,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint ); } } - clone.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia = this.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia.slice(); + clone.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia = this.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia.length < vocabSparseArrayMinimumLength + ? this.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia.slice() : vocabCopyPropertyArray(this.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia); if (\\"uploadMedia\\" in values && values.uploadMedia != null) { if (values.uploadMedia instanceof URL) { // @ts-ignore: type is checked above. @@ -82448,7 +91335,233 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint?: URL | null;provideClientKey?: URL | null;signClientKey?: URL | null;sharedInbox?: URL | null;uploadMedia?: URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Endpoints { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Endpoints; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Endpoints; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl.length; i++) { + const value = node.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl[i] = context.value(value); + } + } + } + } + + { + const array = node.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint.length; i++) { + const value = node.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint[i]; + if (value != null && typeof value === \\"object\\") { + node.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint[i] = context.value(value); + } + } + } + } + + { + const array = node.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint.length; i++) { + const value = node.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint[i]; + if (value != null && typeof value === \\"object\\") { + node.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint[i] = context.value(value); + } + } + } + } + + { + const array = node.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey.length; i++) { + const value = node.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey[i]; + if (value != null && typeof value === \\"object\\") { + node.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey.length; i++) { + const value = node.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox.length; i++) { + const value = node.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia.length; i++) { + const value = node.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia[i]; + if (value != null && typeof value === \\"object\\") { + node.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia[i] = context.value(value); + } + } + } + } +} }); } + /** Endpoint URI so this actor's clients may access remote ActivityStreams * objects which require authentication to access. To use this endpoint, * the client posts an \`x-www-form-urlencoded\` \`id\` parameter with the value @@ -83542,8 +92655,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Event.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -83598,7 +92711,77 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const clone = super.clone(values, options) as unknown as Event; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Event { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -83996,8 +93179,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Flag.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -84058,7 +93241,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Flag; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Flag { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -84438,8 +93697,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Follow.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -84500,7 +93759,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Follow; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Follow { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -84825,39 +94160,39 @@ export class Group extends Object { #_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername: ((string | LanguageString))[] = []; #_axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); #_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); #_hQiaHhZP8hqxckxTBrpsGNs57E3: (URL)[] = []; #_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers: (boolean)[] = []; #_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); #_41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); #_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); #_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); #_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); #_4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); #_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); #_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); #_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); #_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints: (Endpoints)[] = []; #_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable: (boolean)[] = []; #_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended: (boolean)[] = []; @@ -84865,13 +94200,13 @@ export class Group extends Object { #_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable: (boolean)[] = []; #_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); #_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); #_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); #_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage: (string)[] = []; #_2xEU4QtkC53RAun67T81Egqt9vmL_isCat: (boolean)[] = []; #_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense: (URL)[] = []; @@ -84940,10 +94275,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -84976,14 +94335,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; - for (let i = 0; i < values.publicKeys.length; i++) { - this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -85016,14 +94397,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; - for (let i = 0; i < values.assertionMethods.length; i++) { - this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -85056,10 +94459,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -85188,14 +94615,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | if (\\"streams\\" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; - for (let i = 0; i < values.streams.length; i++) { - this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -85306,14 +94755,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; - for (let i = 0; i < values.aliases.length; i++) { - this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -85346,14 +94817,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; - for (let i = 0; i < values.services.length; i++) { - this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -85414,8 +94907,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Group.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -85473,7 +94966,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Group;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice(); + const clone = super.clone(values, options) as unknown as Group;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < vocabSparseArrayMinimumLength + ? this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice() : vocabCopyPropertyArray(this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername); if (\\"preferredUsername\\" in values && values.preferredUsername != null) { if (typeof values.preferredUsername === \\"string\\" || values.preferredUsername instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -85497,10 +94991,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -85509,12 +95027,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice();clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length < vocabSparseArrayMinimumLength + ? this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice() : vocabCopyPropertyArray(this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey);clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = vocabCopyTrustSet( + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, + ); if (\\"publicKey\\" in values && values.publicKey != null) { if (values.publicKey instanceof CryptographicKey || values.publicKey instanceof URL) { // @ts-ignore: type is checked above. clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = [values.publicKey]; - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set([0]); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The publicKey must be of type \\" + @@ -85533,15 +95055,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); - for (let i = 0; i < values.publicKeys.length; i++) { - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -85550,12 +95094,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice();clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length < vocabSparseArrayMinimumLength + ? this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice() : vocabCopyPropertyArray(this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod);clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = vocabCopyTrustSet( + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, + ); if (\\"assertionMethod\\" in values && values.assertionMethod != null) { if (values.assertionMethod instanceof Multikey || values.assertionMethod instanceof URL) { // @ts-ignore: type is checked above. clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = [values.assertionMethod]; - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set([0]); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The assertionMethod must be of type \\" + @@ -85574,15 +95122,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); - for (let i = 0; i < values.assertionMethods.length; i++) { - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -85591,7 +95161,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length < vocabSparseArrayMinimumLength + ? this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice() : vocabCopyPropertyArray(this.#_hQiaHhZP8hqxckxTBrpsGNs57E3); if (\\"gateway\\" in values && values.gateway != null) { if (values.gateway instanceof URL && isGatewayUrl(values.gateway)) { // @ts-ignore: type is checked above. @@ -85615,10 +95186,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -85627,7 +95222,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice(); + clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.length < vocabSparseArrayMinimumLength + ? this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice() : vocabCopyPropertyArray(this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers); if (\\"manuallyApprovesFollowers\\" in values && values.manuallyApprovesFollowers != null) { if (typeof values.manuallyApprovesFollowers === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -85640,12 +95236,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice();clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox); + clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length < vocabSparseArrayMinimumLength + ? this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice() : vocabCopyPropertyArray(this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox);clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = vocabCopyTrustSet( + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, + ); if (\\"inbox\\" in values && values.inbox != null) { if (values.inbox instanceof OrderedCollection || values.inbox instanceof OrderedCollectionPage || values.inbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = [values.inbox]; - clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set([0]); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The inbox must be of type \\" + @@ -85653,12 +95253,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice();clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox); + clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length < vocabSparseArrayMinimumLength + ? this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice() : vocabCopyPropertyArray(this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox);clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = vocabCopyTrustSet( + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, + ); if (\\"outbox\\" in values && values.outbox != null) { if (values.outbox instanceof OrderedCollection || values.outbox instanceof OrderedCollectionPage || values.outbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = [values.outbox]; - clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set([0]); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The outbox must be of type \\" + @@ -85666,12 +95270,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice();clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following); + clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length < vocabSparseArrayMinimumLength + ? this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice() : vocabCopyPropertyArray(this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following);clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = vocabCopyTrustSet( + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, + ); if (\\"following\\" in values && values.following != null) { if (values.following instanceof Collection || values.following instanceof URL) { // @ts-ignore: type is checked above. clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = [values.following]; - clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set([0]); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The following must be of type \\" + @@ -85679,12 +95287,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice();clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers); + clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length < vocabSparseArrayMinimumLength + ? this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice() : vocabCopyPropertyArray(this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers);clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = vocabCopyTrustSet( + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, + ); if (\\"followers\\" in values && values.followers != null) { if (values.followers instanceof Collection || values.followers instanceof URL) { // @ts-ignore: type is checked above. clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = [values.followers]; - clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set([0]); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The followers must be of type \\" + @@ -85692,12 +95304,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice();clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked); + clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length < vocabSparseArrayMinimumLength + ? this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice() : vocabCopyPropertyArray(this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked);clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = vocabCopyTrustSet( + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, + ); if (\\"liked\\" in values && values.liked != null) { if (values.liked instanceof Collection || values.liked instanceof URL) { // @ts-ignore: type is checked above. clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = [values.liked]; - clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set([0]); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The liked must be of type \\" + @@ -85705,12 +95321,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice();clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured); + clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length < vocabSparseArrayMinimumLength + ? this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice() : vocabCopyPropertyArray(this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured);clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = vocabCopyTrustSet( + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, + ); if (\\"featured\\" in values && values.featured != null) { if (values.featured instanceof Collection || values.featured instanceof URL) { // @ts-ignore: type is checked above. clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = [values.featured]; - clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set([0]); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featured must be of type \\" + @@ -85718,12 +95338,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice();clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags); + clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length < vocabSparseArrayMinimumLength + ? this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice() : vocabCopyPropertyArray(this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags);clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = vocabCopyTrustSet( + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, + ); if (\\"featuredTags\\" in values && values.featuredTags != null) { if (values.featuredTags instanceof Collection || values.featuredTags instanceof URL) { // @ts-ignore: type is checked above. clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = [values.featuredTags]; - clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set([0]); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredTags must be of type \\" + @@ -85731,12 +95355,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice();clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections); + clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length < vocabSparseArrayMinimumLength + ? this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice() : vocabCopyPropertyArray(this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections);clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = vocabCopyTrustSet( + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, + ); if (\\"featuredCollections\\" in values && values.featuredCollections != null) { if (values.featuredCollections instanceof Collection || values.featuredCollections instanceof URL) { // @ts-ignore: type is checked above. clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = [values.featuredCollections]; - clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set([0]); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredCollections must be of type \\" + @@ -85744,18 +95372,43 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice();clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length < vocabSparseArrayMinimumLength + ? this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice() : vocabCopyPropertyArray(this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams);clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = vocabCopyTrustSet( + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, + ); if (\\"streams\\" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(); - for (let i = 0; i < values.streams.length; i++) { - clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -85764,7 +95417,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice(); + clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length < vocabSparseArrayMinimumLength + ? this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice() : vocabCopyPropertyArray(this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints); if (\\"endpoints\\" in values && values.endpoints != null) { if (values.endpoints instanceof Endpoints) { // @ts-ignore: type is checked above. @@ -85777,7 +95431,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice(); + clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length < vocabSparseArrayMinimumLength + ? this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice() : vocabCopyPropertyArray(this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable); if (\\"discoverable\\" in values && values.discoverable != null) { if (typeof values.discoverable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -85790,7 +95445,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice(); + clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.length < vocabSparseArrayMinimumLength + ? this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice() : vocabCopyPropertyArray(this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended); if (\\"suspended\\" in values && values.suspended != null) { if (typeof values.suspended === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -85803,7 +95459,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice(); + clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.length < vocabSparseArrayMinimumLength + ? this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice() : vocabCopyPropertyArray(this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial); if (\\"memorial\\" in values && values.memorial != null) { if (typeof values.memorial === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -85816,7 +95473,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice(); + clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.length < vocabSparseArrayMinimumLength + ? this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice() : vocabCopyPropertyArray(this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable); if (\\"indexable\\" in values && values.indexable != null) { if (typeof values.indexable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -85829,12 +95487,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice();clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo); + clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length < vocabSparseArrayMinimumLength + ? this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice() : vocabCopyPropertyArray(this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo);clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = vocabCopyTrustSet( + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, + ); if (\\"successor\\" in values && values.successor != null) { if (values.successor instanceof Application || values.successor instanceof Group || values.successor instanceof Organization || values.successor instanceof Person || values.successor instanceof Service || values.successor instanceof URL) { // @ts-ignore: type is checked above. clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = [values.successor]; - clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set([0]); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The successor must be of type \\" + @@ -85842,12 +95504,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice();clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length < vocabSparseArrayMinimumLength + ? this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice() : vocabCopyPropertyArray(this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs);clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = vocabCopyTrustSet( + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, + ); if (\\"alias\\" in values && values.alias != null) { if (values.alias instanceof Application || values.alias instanceof Group || values.alias instanceof Organization || values.alias instanceof Person || values.alias instanceof Service || values.alias instanceof URL) { // @ts-ignore: type is checked above. clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = [values.alias]; - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set([0]); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The alias must be of type \\" + @@ -85866,15 +95532,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); - for (let i = 0; i < values.aliases.length; i++) { - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -85883,12 +95571,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice();clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length < vocabSparseArrayMinimumLength + ? this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice() : vocabCopyPropertyArray(this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service);clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = vocabCopyTrustSet( + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, + ); if (\\"service\\" in values && values.service != null) { if (values.service instanceof DidService || values.service instanceof URL) { // @ts-ignore: type is checked above. clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = [values.service]; - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set([0]); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The service must be of type \\" + @@ -85907,15 +95599,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); - for (let i = 0; i < values.services.length; i++) { - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -85924,7 +95638,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice(); + clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.length < vocabSparseArrayMinimumLength + ? this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice() : vocabCopyPropertyArray(this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage); if (\\"followedMessage\\" in values && values.followedMessage != null) { if (typeof values.followedMessage === \\"string\\") { // @ts-ignore: type is checked above. @@ -85937,7 +95652,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice(); + clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.length < vocabSparseArrayMinimumLength + ? this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice() : vocabCopyPropertyArray(this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat); if (\\"cat\\" in values && values.cat != null) { if (typeof values.cat === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -85950,7 +95666,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice(); + clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length < vocabSparseArrayMinimumLength + ? this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice() : vocabCopyPropertyArray(this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense); if (\\"preferredLicense\\" in values && values.preferredLicense != null) { if (values.preferredLicense instanceof URL) { // @ts-ignore: type is checked above. @@ -85966,7 +95683,465 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];preferredUsername?: string | LanguageString | null; +preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; +publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; +assertionMethods?: (Multikey | URL)[];gateway?: URL | null; +gateways?: (URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;featuredCollections?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; +aliases?: (Application | Group | Organization | Person | Service | URL)[];service?: DidService | URL | null; +services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | null;preferredLicense?: URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Group { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Group; + + { + const array = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length; i++) { + const value = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i]; + if (value != null && typeof value === \\"object\\") { + node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length; i++) { + const value = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i] = context.value(value); + } + } + } + } + + { + const array = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length; i++) { + const value = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i]; + if (value != null && typeof value === \\"object\\") { + node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length; i++) { + const value = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length; i++) { + const value = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length; i++) { + const value = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i] = context.value(value); + } + } + } + } + + { + const array = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length; i++) { + const value = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i]; + if (value != null && typeof value === \\"object\\") { + node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length; i++) { + const value = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length; i++) { + const value = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length; i++) { + const value = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i] = context.value(value); + } + } + } + } + + { + const array = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length; i++) { + const value = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i]; + if (value != null && typeof value === \\"object\\") { + node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length; i++) { + const value = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i] = context.value(value); + } + } + } + } + + { + const array = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length; i++) { + const value = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i]; + if (value != null && typeof value === \\"object\\") { + node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length; i++) { + const value = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length; i++) { + const value = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length; i++) { + const value = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i] = context.value(value); + } + } + } + } + + { + const array = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length; i++) { + const value = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i]; + if (value != null && typeof value === \\"object\\") { + node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i] = context.value(value); + } + } + } + } +} }); } + /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. * @@ -86315,7 +96490,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[0]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#publicKey\\"); @@ -86383,7 +96559,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -86470,7 +96647,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#publicKey\\"); @@ -86542,7 +96720,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -86896,7 +97075,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#assertionMethod\\"); @@ -86964,7 +97144,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -87055,7 +97236,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#assertionMethod\\"); @@ -87127,7 +97309,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -87551,7 +97734,8 @@ get gateways(): (URL)[] { } let v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0]; if (!(v instanceof URL) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://www.w3.org/ns/ldp#inbox\\"); @@ -87619,7 +97803,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -87993,7 +98178,8 @@ get gateways(): (URL)[] { } let v = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[0]; if (!(v instanceof URL) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#outbox\\"); @@ -88061,7 +98247,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -88415,7 +98602,8 @@ get gateways(): (URL)[] { } let v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0]; if (!(v instanceof URL) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#following\\"); @@ -88483,7 +98671,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -88840,7 +99029,8 @@ get gateways(): (URL)[] { } let v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0]; if (!(v instanceof URL) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#followers\\"); @@ -88908,7 +99098,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -89263,7 +99454,8 @@ get gateways(): (URL)[] { } let v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0]; if (!(v instanceof URL) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#liked\\"); @@ -89331,7 +99523,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -89684,7 +99877,8 @@ get gateways(): (URL)[] { } let v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[0]; if (!(v instanceof URL) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://joinmastodon.org/ns#featured\\"); @@ -89752,7 +99946,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -90105,7 +100300,8 @@ get gateways(): (URL)[] { } let v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0]; if (!(v instanceof URL) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://joinmastodon.org/ns#featuredTags\\"); @@ -90173,7 +100369,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -90523,7 +100720,8 @@ get gateways(): (URL)[] { } let v = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[0]; if (!(v instanceof URL) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/7aa9#featuredCollections\\"); @@ -90591,7 +100789,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -90941,7 +101140,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#streams\\"); @@ -91013,7 +101213,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -91498,7 +101699,8 @@ get gateways(): (URL)[] { } let v = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0]; if (!(v instanceof URL) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#movedTo\\"); @@ -91566,7 +101768,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -91979,7 +102182,8 @@ get gateways(): (URL)[] { } let v = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"); @@ -92047,7 +102251,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -92138,7 +102343,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"); @@ -92210,7 +102416,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -92564,7 +102771,8 @@ get gateways(): (URL)[] { } let v = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/did#service\\"); @@ -92632,7 +102840,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -92723,7 +102932,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/did#service\\"); @@ -92795,7 +103005,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -94194,7 +104405,7 @@ get gateways(): (URL)[] { instance.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; const _axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); let _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array = values[\\"https://w3id.org/security#publicKey\\"]; @@ -94235,7 +104446,7 @@ get gateways(): (URL)[] { instance.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = _axq166E2eZADq34V4MYUc8KMZdC_publicKey; const _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); let _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array = values[\\"https://w3id.org/security#assertionMethod\\"]; @@ -94334,7 +104545,7 @@ get gateways(): (URL)[] { instance.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers; const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); let _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array = values[\\"http://www.w3.org/ns/ldp#inbox\\"]; @@ -94381,7 +104592,7 @@ get gateways(): (URL)[] { instance.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; const _41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); let _41QwhqJouoLg3h8dRPKat21brynC_outbox__array = values[\\"https://www.w3.org/ns/activitystreams#outbox\\"]; @@ -94428,7 +104639,7 @@ get gateways(): (URL)[] { instance.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = _41QwhqJouoLg3h8dRPKat21brynC_outbox; const _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); let _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array = values[\\"https://www.w3.org/ns/activitystreams#following\\"]; @@ -94469,7 +104680,7 @@ get gateways(): (URL)[] { instance.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; const _BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); let _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array = values[\\"https://www.w3.org/ns/activitystreams#followers\\"]; @@ -94510,7 +104721,7 @@ get gateways(): (URL)[] { instance.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = _BBCTgfphhsFzpVfKTykGSpBNwoA_followers; const _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); let _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array = values[\\"https://www.w3.org/ns/activitystreams#liked\\"]; @@ -94551,7 +104762,7 @@ get gateways(): (URL)[] { instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; const _4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); let _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array = values[\\"http://joinmastodon.org/ns#featured\\"]; @@ -94592,7 +104803,7 @@ get gateways(): (URL)[] { instance.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = _4N1vBJzXDf8NbBumeECQMFvKetja_featured; const _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); let _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array = values[\\"http://joinmastodon.org/ns#featuredTags\\"]; @@ -94633,7 +104844,7 @@ get gateways(): (URL)[] { instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; const _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); let _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections__array = values[\\"https://w3id.org/fep/7aa9#featuredCollections\\"]; @@ -94674,7 +104885,7 @@ get gateways(): (URL)[] { instance.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); let _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array = values[\\"https://www.w3.org/ns/activitystreams#streams\\"]; @@ -94863,7 +105074,7 @@ get gateways(): (URL)[] { instance.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable; const _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); let _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array = values[\\"https://www.w3.org/ns/activitystreams#movedTo\\"]; @@ -94921,7 +105132,7 @@ get gateways(): (URL)[] { instance.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; const _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); let _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array = values[\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"]; @@ -94979,7 +105190,7 @@ get gateways(): (URL)[] { instance.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; const _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); let _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array = values[\\"https://www.w3.org/ns/did#service\\"]; @@ -95799,7 +106010,7 @@ export class Link { #_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width: (number)[] = []; #_gCVTegXxWWCw6wWRxa1QF65zusg_preview: (Link | Object | URL)[] = []; - #_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: Set = new Set(); + #_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: VocabTrustSet = new Set(); #_2rzkBRS4gNPrkJk9DohHAMUAxA2d: (URL)[] = []; /** @@ -95878,10 +106089,34 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } - if (Array.isArray(values.rels) && - values.rels.every(v => typeof v === \\"string\\")) { + let copied!: (string)[]; + let valid = false; + if (Array.isArray(values.rels)) { + const array = values.rels; + const test = (v: string): boolean => typeof v === \\"string\\"; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.rels; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel = values.rels.slice(); + this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel = copied; } else { throw new TypeError( @@ -95940,10 +106175,34 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } - if (Array.isArray(values.names) && - values.names.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.names)) { + const array = values.names; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.names; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = values.names.slice(); + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = copied; } else { throw new TypeError( @@ -95994,14 +106253,36 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num if (\\"previews\\" in values && values.previews != null) { - if (Array.isArray(values.previews) && - values.previews.every(v => v instanceof Link || v instanceof Object || v instanceof URL)) { + let copied!: (Link | Object | URL)[]; + let valid = false; + if (Array.isArray(values.previews)) { + const array = values.previews; + const test = (v: Link | Object | URL): boolean => v instanceof Link || v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.previews; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = values.previews.slice(); + this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = copied; - for (let i = 0; i < values.previews.length; i++) { - this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.add(i); - } + vocabSetTrustPrefix(this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length); } else { throw new TypeError( @@ -96013,10 +106294,34 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num if (\\"licenses\\" in values && values.licenses != null) { - if (Array.isArray(values.licenses) && - values.licenses.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.licenses)) { + const array = values.licenses; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.licenses; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = values.licenses.slice(); + this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = copied; } else { throw new TypeError( @@ -96038,8 +106343,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Link.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -96084,7 +106389,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num options ); copyPortableProvenance(this, clone); - clone.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href = this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href.slice(); + clone.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href = this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href.length < vocabSparseArrayMinimumLength + ? this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href.slice() : vocabCopyPropertyArray(this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href); if (\\"href\\" in values && values.href != null) { if (values.href instanceof URL) { // @ts-ignore: type is checked above. @@ -96097,7 +106403,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel = this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel.slice(); + clone.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel = this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel.length < vocabSparseArrayMinimumLength + ? this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel.slice() : vocabCopyPropertyArray(this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel); if (\\"rel\\" in values && values.rel != null) { if (typeof values.rel === \\"string\\") { // @ts-ignore: type is checked above. @@ -96121,10 +106428,34 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } - if (Array.isArray(values.rels) && - values.rels.every(v => typeof v === \\"string\\")) { + let copied!: (string)[]; + let valid = false; + if (Array.isArray(values.rels)) { + const array = values.rels; + const test = (v: string): boolean => typeof v === \\"string\\"; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.rels; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel = values.rels.slice(); + clone.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel = copied; } else { throw new TypeError( @@ -96133,7 +106464,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.slice(); + clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.length < vocabSparseArrayMinimumLength + ? this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.slice() : vocabCopyPropertyArray(this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType); if (\\"mediaType\\" in values && values.mediaType != null) { if (typeof values.mediaType === \\"string\\") { // @ts-ignore: type is checked above. @@ -96146,7 +106478,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase = this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase.slice(); + clone.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase = this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase.length < vocabSparseArrayMinimumLength + ? this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase.slice() : vocabCopyPropertyArray(this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase); if (\\"digestMultibase\\" in values && values.digestMultibase != null) { if (typeof values.digestMultibase === \\"string\\") { // @ts-ignore: type is checked above. @@ -96159,7 +106492,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.slice(); + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length < vocabSparseArrayMinimumLength + ? this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.slice() : vocabCopyPropertyArray(this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name); if (\\"name\\" in values && values.name != null) { if (typeof values.name === \\"string\\" || values.name instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -96183,10 +106517,34 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } - if (Array.isArray(values.names) && - values.names.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.names)) { + const array = values.names; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.names; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = values.names.slice(); + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = copied; } else { throw new TypeError( @@ -96195,7 +106553,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang = this.#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang.slice(); + clone.#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang = this.#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang.length < vocabSparseArrayMinimumLength + ? this.#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang.slice() : vocabCopyPropertyArray(this.#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang); if (\\"language\\" in values && values.language != null) { if (values.language instanceof Intl.Locale) { // @ts-ignore: type is checked above. @@ -96208,7 +106567,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.slice(); + clone.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.length < vocabSparseArrayMinimumLength + ? this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.slice() : vocabCopyPropertyArray(this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height); if (\\"height\\" in values && values.height != null) { if (typeof values.height === \\"number\\" && Number.isInteger(values.height) && values.height >= 0) { // @ts-ignore: type is checked above. @@ -96221,7 +106581,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.slice(); + clone.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.length < vocabSparseArrayMinimumLength + ? this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.slice() : vocabCopyPropertyArray(this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width); if (\\"width\\" in values && values.width != null) { if (typeof values.width === \\"number\\" && Number.isInteger(values.width) && values.width >= 0) { // @ts-ignore: type is checked above. @@ -96234,18 +106595,43 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.slice();clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = new Set(this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview); + clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length < vocabSparseArrayMinimumLength + ? this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.slice() : vocabCopyPropertyArray(this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview);clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = vocabCopyTrustSet( + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, + ); if (\\"previews\\" in values && values.previews != null) { - if (Array.isArray(values.previews) && - values.previews.every(v => v instanceof Link || v instanceof Object || v instanceof URL)) { + let copied!: (Link | Object | URL)[]; + let valid = false; + if (Array.isArray(values.previews)) { + const array = values.previews; + const test = (v: Link | Object | URL): boolean => v instanceof Link || v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.previews; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = values.previews.slice(); + clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = copied; clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = new Set(); - for (let i = 0; i < values.previews.length; i++) { - clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.add(i); - } + vocabSetTrustPrefix(clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length); } else { throw new TypeError( @@ -96254,13 +106640,38 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.slice(); + clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.length < vocabSparseArrayMinimumLength + ? this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.slice() : vocabCopyPropertyArray(this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d); if (\\"licenses\\" in values && values.licenses != null) { - if (Array.isArray(values.licenses) && - values.licenses.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.licenses)) { + const array = values.licenses; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.licenses; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = values.licenses.slice(); + clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = copied; } else { throw new TypeError( @@ -96272,7 +106683,147 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +href?: URL | null;rel?: string | null; +rels?: (string)[];mediaType?: string | null;digestMultibase?: string | null;name?: string | LanguageString | null; +names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: number | null;width?: number | null;previews?: (Link | Object | URL)[];licenses?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Link { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Link; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Link; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href.length; i++) { + const value = node.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href[i]; + if (value != null && typeof value === \\"object\\") { + node.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href[i] = context.value(value); + } + } + } + } + + { + const array = node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length; i++) { + const value = node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview[i]; + if (value != null && typeof value === \\"object\\") { + node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.length; i++) { + const value = node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d[i] = context.value(value); + } + } + } + } +} }); } + /** The target resource pointed to by a {@link Link}. */ get href(): (URL | null) { @@ -96758,7 +107309,8 @@ get names(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i)) { + !(i < (this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview[vocabTrustPrefix] ?? 0) || + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#preview\\"); @@ -96830,7 +107382,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i)) { + !(i < (this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview[vocabTrustPrefix] ?? 0) || + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -97749,7 +108302,7 @@ get licenses(): (URL)[] { instance.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = _2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width; const _gCVTegXxWWCw6wWRxa1QF65zusg_preview: (Link | Object | URL)[] = []; - const _trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: Set = new Set(); + const _trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: VocabTrustSet = new Set(); let _gCVTegXxWWCw6wWRxa1QF65zusg_preview__array = values[\\"https://www.w3.org/ns/activitystreams#preview\\"]; @@ -98169,8 +108722,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Hashtag.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -98211,7 +108764,63 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num const clone = super.clone(values, options) as unknown as Hashtag; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +href?: URL | null;rel?: string | null; +rels?: (string)[];mediaType?: string | null;digestMultibase?: string | null;name?: string | LanguageString | null; +names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: number | null;width?: number | null;previews?: (Link | Object | URL)[];licenses?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Hashtag { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -98589,8 +109198,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Image.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -98645,7 +109254,77 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const clone = super.clone(values, options) as unknown as Image; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];width?: number | null;height?: number | null;digestMultibase?: string | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Image { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -99043,8 +109722,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Offer.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -99086,26 +109765,102 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - verifyPortableObject?: PortableObjectVerifier, - } = {} - ): Offer { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - // @ts-ignore: $warning is not recognized as a property, but it is. - options = { ...options, $warning: this._warning }; - } - const clone = super.clone(values, options) as unknown as Offer; - return clone; + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {} + ): Offer { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as Offer; + return clone; + } + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Offer { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -99487,8 +110242,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Invite.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -99549,7 +110304,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Invite; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Invite { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -99927,8 +110758,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Join.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -99989,7 +110820,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Join; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Join { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -100367,8 +111274,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Leave.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -100429,7 +111336,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Leave; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Leave { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -100807,8 +111790,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Like.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -100869,7 +111852,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Like; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Like { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -101245,8 +112304,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Listen.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -101307,7 +112366,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Listen; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Listen { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -101663,8 +112798,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Mention.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -101705,7 +112840,63 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num const clone = super.clone(values, options) as unknown as Mention; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +href?: URL | null;rel?: string | null; +rels?: (string)[];mediaType?: string | null;digestMultibase?: string | null;name?: string | LanguageString | null; +names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: number | null;width?: number | null;previews?: (Link | Object | URL)[];licenses?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Mention { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -102092,8 +113283,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Move.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -102135,26 +113326,102 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - verifyPortableObject?: PortableObjectVerifier, - } = {} - ): Move { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - // @ts-ignore: $warning is not recognized as a property, but it is. - options = { ...options, $warning: this._warning }; - } - const clone = super.clone(values, options) as unknown as Move; - return clone; + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {} + ): Move { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as Move; + return clone; + } + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Move { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -102480,11 +113747,11 @@ export class Note extends Object { } #_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); #_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; #_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); /** * Constructs a new instance of Note with the given values. @@ -102572,8 +113839,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Note.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -102625,12 +113892,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Note;clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice();clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote); + const clone = super.clone(values, options) as unknown as Note;clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length < vocabSparseArrayMinimumLength + ? this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice() : vocabCopyPropertyArray(this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote);clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = vocabCopyTrustSet( + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, + ); if (\\"quote\\" in values && values.quote != null) { if (values.quote instanceof Object || values.quote instanceof URL) { // @ts-ignore: type is checked above. clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = [values.quote]; - clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set([0]); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The quote must be of type \\" + @@ -102638,7 +113909,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice(); + clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length < vocabSparseArrayMinimumLength + ? this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice() : vocabCopyPropertyArray(this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl); if (\\"quoteUrl\\" in values && values.quoteUrl != null) { if (values.quoteUrl instanceof URL) { // @ts-ignore: type is checked above. @@ -102651,12 +113923,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice();clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization); + clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice() : vocabCopyPropertyArray(this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization);clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = vocabCopyTrustSet( + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, + ); if (\\"quoteAuthorization\\" in values && values.quoteAuthorization != null) { if (values.quoteAuthorization instanceof QuoteAuthorization || values.quoteAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = [values.quoteAuthorization]; - clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set([0]); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The quoteAuthorization must be of type \\" + @@ -102667,7 +113943,151 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];quote?: Object | URL | null;quoteUrl?: URL | null;quoteAuthorization?: QuoteAuthorization | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Note { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Note; + + { + const array = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length; i++) { + const value = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i] = context.value(value); + } + } + } + } + + { + const array = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length; i++) { + const value = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i]; + if (value != null && typeof value === \\"object\\") { + node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i] = context.value(value); + } + } + } + } + + { + const array = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length; i++) { + const value = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i]; + if (value != null && typeof value === \\"object\\") { + node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i] = context.value(value); + } + } + } + } +} }); } + async #fetchQuote( url: URL, options: { @@ -102996,7 +114416,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[0]; if (!(v instanceof URL) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/044f#quote\\"); @@ -103064,7 +114485,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -103438,7 +114860,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/044f#quoteAuthorization\\"); @@ -103506,7 +114929,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -103933,7 +115357,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); let _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote__array = values[\\"https://w3id.org/fep/044f#quote\\"]; @@ -104013,7 +115437,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; const _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); let _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization__array = values[\\"https://w3id.org/fep/044f#quoteAuthorization\\"]; @@ -104186,7 +115610,7 @@ export class OrderedCollectionPage extends CollectionPage { } #_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: (Object | Link | URL)[] = []; - #_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: Set = new Set(); + #_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: VocabTrustSet = new Set(); #_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex: (number)[] = []; /** @@ -104226,14 +115650,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu super(values, options); if (\\"items\\" in values && values.items != null) { - if (Array.isArray(values.items) && - values.items.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.items)) { + const array = values.items; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.items; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = values.items.slice(); + this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = copied; - for (let i = 0; i < values.items.length; i++) { - this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.add(i); - } + vocabSetTrustPrefix(this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length); } else { throw new TypeError( @@ -104268,8 +115714,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link OrderedCollectionPage.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -104321,18 +115767,43 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as OrderedCollectionPage;clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.slice();clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = new Set(this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items); + const clone = super.clone(values, options) as unknown as OrderedCollectionPage;clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length < vocabSparseArrayMinimumLength + ? this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.slice() : vocabCopyPropertyArray(this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items);clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = vocabCopyTrustSet( + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, + ); if (\\"items\\" in values && values.items != null) { - if (Array.isArray(values.items) && - values.items.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.items)) { + const array = values.items; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.items; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = values.items.slice(); + clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = copied; clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = new Set(); - for (let i = 0; i < values.items.length; i++) { - clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length); } else { throw new TypeError( @@ -104341,7 +115812,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex = this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex.slice(); + clone.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex = this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex.length < vocabSparseArrayMinimumLength + ? this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex.slice() : vocabCopyPropertyArray(this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex); if (\\"startIndex\\" in values && values.startIndex != null) { if (typeof values.startIndex === \\"number\\" && Number.isInteger(values.startIndex) && values.startIndex >= 0) { // @ts-ignore: type is checked above. @@ -104357,7 +115829,107 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;items?: (Object | Link | URL)[];startIndex?: number | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): OrderedCollectionPage { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as OrderedCollectionPage; + + { + const array = node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length; i++) { + const value = node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[i] = context.value(value); + } + } + } + } +} }); } + async #fetchItem( url: URL, options: { @@ -104700,7 +116272,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i)) { + !(i < (this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[vocabTrustPrefix] ?? 0) || + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#items\\"); @@ -104772,7 +116345,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i)) { + !(i < (this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[vocabTrustPrefix] ?? 0) || + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -105165,7 +116739,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: (Object | Link | URL)[] = []; - const _trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: Set = new Set(); + const _trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: VocabTrustSet = new Set(); let _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items__array = values[\\"https://www.w3.org/ns/activitystreams#items\\"]; @@ -105354,39 +116928,39 @@ export class Organization extends Object { #_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername: ((string | LanguageString))[] = []; #_axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); #_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); #_hQiaHhZP8hqxckxTBrpsGNs57E3: (URL)[] = []; #_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers: (boolean)[] = []; #_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); #_41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); #_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); #_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); #_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); #_4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); #_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); #_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); #_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); #_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints: (Endpoints)[] = []; #_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable: (boolean)[] = []; #_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended: (boolean)[] = []; @@ -105394,13 +116968,13 @@ export class Organization extends Object { #_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable: (boolean)[] = []; #_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); #_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); #_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); #_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage: (string)[] = []; #_2xEU4QtkC53RAun67T81Egqt9vmL_isCat: (boolean)[] = []; #_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense: (URL)[] = []; @@ -105469,10 +117043,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -105505,14 +117103,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; - for (let i = 0; i < values.publicKeys.length; i++) { - this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -105545,14 +117165,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; - for (let i = 0; i < values.assertionMethods.length; i++) { - this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -105585,10 +117227,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -105717,14 +117383,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | if (\\"streams\\" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; - for (let i = 0; i < values.streams.length; i++) { - this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -105835,14 +117523,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; - for (let i = 0; i < values.aliases.length; i++) { - this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -105875,14 +117585,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; - for (let i = 0; i < values.services.length; i++) { - this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -105943,8 +117675,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Organization.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -106002,7 +117734,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Organization;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice(); + const clone = super.clone(values, options) as unknown as Organization;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < vocabSparseArrayMinimumLength + ? this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice() : vocabCopyPropertyArray(this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername); if (\\"preferredUsername\\" in values && values.preferredUsername != null) { if (typeof values.preferredUsername === \\"string\\" || values.preferredUsername instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -106026,10 +117759,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -106038,12 +117795,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice();clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length < vocabSparseArrayMinimumLength + ? this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice() : vocabCopyPropertyArray(this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey);clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = vocabCopyTrustSet( + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, + ); if (\\"publicKey\\" in values && values.publicKey != null) { if (values.publicKey instanceof CryptographicKey || values.publicKey instanceof URL) { // @ts-ignore: type is checked above. clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = [values.publicKey]; - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set([0]); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The publicKey must be of type \\" + @@ -106062,15 +117823,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); - for (let i = 0; i < values.publicKeys.length; i++) { - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -106079,12 +117862,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice();clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length < vocabSparseArrayMinimumLength + ? this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice() : vocabCopyPropertyArray(this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod);clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = vocabCopyTrustSet( + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, + ); if (\\"assertionMethod\\" in values && values.assertionMethod != null) { if (values.assertionMethod instanceof Multikey || values.assertionMethod instanceof URL) { // @ts-ignore: type is checked above. clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = [values.assertionMethod]; - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set([0]); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The assertionMethod must be of type \\" + @@ -106103,15 +117890,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); - for (let i = 0; i < values.assertionMethods.length; i++) { - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -106120,7 +117929,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length < vocabSparseArrayMinimumLength + ? this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice() : vocabCopyPropertyArray(this.#_hQiaHhZP8hqxckxTBrpsGNs57E3); if (\\"gateway\\" in values && values.gateway != null) { if (values.gateway instanceof URL && isGatewayUrl(values.gateway)) { // @ts-ignore: type is checked above. @@ -106144,10 +117954,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -106156,7 +117990,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice(); + clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.length < vocabSparseArrayMinimumLength + ? this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice() : vocabCopyPropertyArray(this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers); if (\\"manuallyApprovesFollowers\\" in values && values.manuallyApprovesFollowers != null) { if (typeof values.manuallyApprovesFollowers === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -106169,12 +118004,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice();clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox); + clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length < vocabSparseArrayMinimumLength + ? this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice() : vocabCopyPropertyArray(this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox);clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = vocabCopyTrustSet( + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, + ); if (\\"inbox\\" in values && values.inbox != null) { if (values.inbox instanceof OrderedCollection || values.inbox instanceof OrderedCollectionPage || values.inbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = [values.inbox]; - clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set([0]); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The inbox must be of type \\" + @@ -106182,12 +118021,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice();clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox); + clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length < vocabSparseArrayMinimumLength + ? this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice() : vocabCopyPropertyArray(this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox);clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = vocabCopyTrustSet( + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, + ); if (\\"outbox\\" in values && values.outbox != null) { if (values.outbox instanceof OrderedCollection || values.outbox instanceof OrderedCollectionPage || values.outbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = [values.outbox]; - clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set([0]); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The outbox must be of type \\" + @@ -106195,12 +118038,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice();clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following); + clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length < vocabSparseArrayMinimumLength + ? this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice() : vocabCopyPropertyArray(this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following);clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = vocabCopyTrustSet( + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, + ); if (\\"following\\" in values && values.following != null) { if (values.following instanceof Collection || values.following instanceof URL) { // @ts-ignore: type is checked above. clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = [values.following]; - clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set([0]); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The following must be of type \\" + @@ -106208,12 +118055,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice();clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers); + clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length < vocabSparseArrayMinimumLength + ? this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice() : vocabCopyPropertyArray(this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers);clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = vocabCopyTrustSet( + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, + ); if (\\"followers\\" in values && values.followers != null) { if (values.followers instanceof Collection || values.followers instanceof URL) { // @ts-ignore: type is checked above. clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = [values.followers]; - clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set([0]); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The followers must be of type \\" + @@ -106221,12 +118072,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice();clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked); + clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length < vocabSparseArrayMinimumLength + ? this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice() : vocabCopyPropertyArray(this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked);clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = vocabCopyTrustSet( + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, + ); if (\\"liked\\" in values && values.liked != null) { if (values.liked instanceof Collection || values.liked instanceof URL) { // @ts-ignore: type is checked above. clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = [values.liked]; - clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set([0]); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The liked must be of type \\" + @@ -106234,12 +118089,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice();clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured); + clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length < vocabSparseArrayMinimumLength + ? this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice() : vocabCopyPropertyArray(this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured);clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = vocabCopyTrustSet( + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, + ); if (\\"featured\\" in values && values.featured != null) { if (values.featured instanceof Collection || values.featured instanceof URL) { // @ts-ignore: type is checked above. clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = [values.featured]; - clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set([0]); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featured must be of type \\" + @@ -106247,12 +118106,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice();clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags); + clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length < vocabSparseArrayMinimumLength + ? this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice() : vocabCopyPropertyArray(this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags);clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = vocabCopyTrustSet( + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, + ); if (\\"featuredTags\\" in values && values.featuredTags != null) { if (values.featuredTags instanceof Collection || values.featuredTags instanceof URL) { // @ts-ignore: type is checked above. clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = [values.featuredTags]; - clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set([0]); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredTags must be of type \\" + @@ -106260,12 +118123,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice();clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections); + clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length < vocabSparseArrayMinimumLength + ? this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice() : vocabCopyPropertyArray(this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections);clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = vocabCopyTrustSet( + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, + ); if (\\"featuredCollections\\" in values && values.featuredCollections != null) { if (values.featuredCollections instanceof Collection || values.featuredCollections instanceof URL) { // @ts-ignore: type is checked above. clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = [values.featuredCollections]; - clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set([0]); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredCollections must be of type \\" + @@ -106273,18 +118140,43 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice();clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length < vocabSparseArrayMinimumLength + ? this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice() : vocabCopyPropertyArray(this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams);clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = vocabCopyTrustSet( + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, + ); if (\\"streams\\" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(); - for (let i = 0; i < values.streams.length; i++) { - clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -106293,7 +118185,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice(); + clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length < vocabSparseArrayMinimumLength + ? this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice() : vocabCopyPropertyArray(this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints); if (\\"endpoints\\" in values && values.endpoints != null) { if (values.endpoints instanceof Endpoints) { // @ts-ignore: type is checked above. @@ -106306,7 +118199,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice(); + clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length < vocabSparseArrayMinimumLength + ? this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice() : vocabCopyPropertyArray(this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable); if (\\"discoverable\\" in values && values.discoverable != null) { if (typeof values.discoverable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -106319,7 +118213,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice(); + clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.length < vocabSparseArrayMinimumLength + ? this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice() : vocabCopyPropertyArray(this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended); if (\\"suspended\\" in values && values.suspended != null) { if (typeof values.suspended === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -106332,7 +118227,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice(); + clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.length < vocabSparseArrayMinimumLength + ? this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice() : vocabCopyPropertyArray(this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial); if (\\"memorial\\" in values && values.memorial != null) { if (typeof values.memorial === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -106345,7 +118241,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice(); + clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.length < vocabSparseArrayMinimumLength + ? this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice() : vocabCopyPropertyArray(this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable); if (\\"indexable\\" in values && values.indexable != null) { if (typeof values.indexable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -106358,12 +118255,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice();clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo); + clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length < vocabSparseArrayMinimumLength + ? this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice() : vocabCopyPropertyArray(this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo);clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = vocabCopyTrustSet( + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, + ); if (\\"successor\\" in values && values.successor != null) { if (values.successor instanceof Application || values.successor instanceof Group || values.successor instanceof Organization || values.successor instanceof Person || values.successor instanceof Service || values.successor instanceof URL) { // @ts-ignore: type is checked above. clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = [values.successor]; - clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set([0]); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The successor must be of type \\" + @@ -106371,12 +118272,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice();clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length < vocabSparseArrayMinimumLength + ? this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice() : vocabCopyPropertyArray(this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs);clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = vocabCopyTrustSet( + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, + ); if (\\"alias\\" in values && values.alias != null) { if (values.alias instanceof Application || values.alias instanceof Group || values.alias instanceof Organization || values.alias instanceof Person || values.alias instanceof Service || values.alias instanceof URL) { // @ts-ignore: type is checked above. clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = [values.alias]; - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set([0]); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The alias must be of type \\" + @@ -106395,15 +118300,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); - for (let i = 0; i < values.aliases.length; i++) { - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -106412,12 +118339,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice();clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length < vocabSparseArrayMinimumLength + ? this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice() : vocabCopyPropertyArray(this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service);clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = vocabCopyTrustSet( + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, + ); if (\\"service\\" in values && values.service != null) { if (values.service instanceof DidService || values.service instanceof URL) { // @ts-ignore: type is checked above. clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = [values.service]; - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set([0]); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The service must be of type \\" + @@ -106436,15 +118367,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); - for (let i = 0; i < values.services.length; i++) { - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -106453,7 +118406,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice(); + clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.length < vocabSparseArrayMinimumLength + ? this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice() : vocabCopyPropertyArray(this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage); if (\\"followedMessage\\" in values && values.followedMessage != null) { if (typeof values.followedMessage === \\"string\\") { // @ts-ignore: type is checked above. @@ -106466,7 +118420,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice(); + clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.length < vocabSparseArrayMinimumLength + ? this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice() : vocabCopyPropertyArray(this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat); if (\\"cat\\" in values && values.cat != null) { if (typeof values.cat === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -106479,7 +118434,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice(); + clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length < vocabSparseArrayMinimumLength + ? this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice() : vocabCopyPropertyArray(this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense); if (\\"preferredLicense\\" in values && values.preferredLicense != null) { if (values.preferredLicense instanceof URL) { // @ts-ignore: type is checked above. @@ -106495,7 +118451,465 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];preferredUsername?: string | LanguageString | null; +preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; +publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; +assertionMethods?: (Multikey | URL)[];gateway?: URL | null; +gateways?: (URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;featuredCollections?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; +aliases?: (Application | Group | Organization | Person | Service | URL)[];service?: DidService | URL | null; +services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | null;preferredLicense?: URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Organization { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Organization; + + { + const array = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length; i++) { + const value = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i]; + if (value != null && typeof value === \\"object\\") { + node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length; i++) { + const value = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i] = context.value(value); + } + } + } + } + + { + const array = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length; i++) { + const value = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i]; + if (value != null && typeof value === \\"object\\") { + node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length; i++) { + const value = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length; i++) { + const value = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length; i++) { + const value = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i] = context.value(value); + } + } + } + } + + { + const array = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length; i++) { + const value = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i]; + if (value != null && typeof value === \\"object\\") { + node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length; i++) { + const value = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length; i++) { + const value = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length; i++) { + const value = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i] = context.value(value); + } + } + } + } + + { + const array = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length; i++) { + const value = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i]; + if (value != null && typeof value === \\"object\\") { + node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length; i++) { + const value = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i] = context.value(value); + } + } + } + } + + { + const array = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length; i++) { + const value = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i]; + if (value != null && typeof value === \\"object\\") { + node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length; i++) { + const value = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length; i++) { + const value = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length; i++) { + const value = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i] = context.value(value); + } + } + } + } + + { + const array = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length; i++) { + const value = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i]; + if (value != null && typeof value === \\"object\\") { + node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i] = context.value(value); + } + } + } + } +} }); } + /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. * @@ -106844,7 +119258,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[0]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#publicKey\\"); @@ -106912,7 +119327,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -106999,7 +119415,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#publicKey\\"); @@ -107071,7 +119488,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -107425,7 +119843,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#assertionMethod\\"); @@ -107493,7 +119912,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -107584,7 +120004,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#assertionMethod\\"); @@ -107656,7 +120077,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -108080,7 +120502,8 @@ get gateways(): (URL)[] { } let v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0]; if (!(v instanceof URL) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://www.w3.org/ns/ldp#inbox\\"); @@ -108148,7 +120571,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -108522,7 +120946,8 @@ get gateways(): (URL)[] { } let v = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[0]; if (!(v instanceof URL) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#outbox\\"); @@ -108590,7 +121015,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -108944,7 +121370,8 @@ get gateways(): (URL)[] { } let v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0]; if (!(v instanceof URL) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#following\\"); @@ -109012,7 +121439,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -109369,7 +121797,8 @@ get gateways(): (URL)[] { } let v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0]; if (!(v instanceof URL) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#followers\\"); @@ -109437,7 +121866,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -109792,7 +122222,8 @@ get gateways(): (URL)[] { } let v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0]; if (!(v instanceof URL) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#liked\\"); @@ -109860,7 +122291,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -110213,7 +122645,8 @@ get gateways(): (URL)[] { } let v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[0]; if (!(v instanceof URL) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://joinmastodon.org/ns#featured\\"); @@ -110281,7 +122714,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -110634,7 +123068,8 @@ get gateways(): (URL)[] { } let v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0]; if (!(v instanceof URL) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://joinmastodon.org/ns#featuredTags\\"); @@ -110702,7 +123137,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -111052,7 +123488,8 @@ get gateways(): (URL)[] { } let v = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[0]; if (!(v instanceof URL) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/7aa9#featuredCollections\\"); @@ -111120,7 +123557,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -111470,7 +123908,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#streams\\"); @@ -111542,7 +123981,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -112027,7 +124467,8 @@ get gateways(): (URL)[] { } let v = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0]; if (!(v instanceof URL) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#movedTo\\"); @@ -112095,7 +124536,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -112508,7 +124950,8 @@ get gateways(): (URL)[] { } let v = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"); @@ -112576,7 +125019,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -112667,7 +125111,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"); @@ -112739,7 +125184,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -113093,7 +125539,8 @@ get gateways(): (URL)[] { } let v = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/did#service\\"); @@ -113161,7 +125608,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -113252,7 +125700,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/did#service\\"); @@ -113324,7 +125773,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -114723,7 +127173,7 @@ get gateways(): (URL)[] { instance.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; const _axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); let _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array = values[\\"https://w3id.org/security#publicKey\\"]; @@ -114764,7 +127214,7 @@ get gateways(): (URL)[] { instance.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = _axq166E2eZADq34V4MYUc8KMZdC_publicKey; const _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); let _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array = values[\\"https://w3id.org/security#assertionMethod\\"]; @@ -114863,7 +127313,7 @@ get gateways(): (URL)[] { instance.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers; const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); let _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array = values[\\"http://www.w3.org/ns/ldp#inbox\\"]; @@ -114910,7 +127360,7 @@ get gateways(): (URL)[] { instance.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; const _41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); let _41QwhqJouoLg3h8dRPKat21brynC_outbox__array = values[\\"https://www.w3.org/ns/activitystreams#outbox\\"]; @@ -114957,7 +127407,7 @@ get gateways(): (URL)[] { instance.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = _41QwhqJouoLg3h8dRPKat21brynC_outbox; const _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); let _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array = values[\\"https://www.w3.org/ns/activitystreams#following\\"]; @@ -114998,7 +127448,7 @@ get gateways(): (URL)[] { instance.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; const _BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); let _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array = values[\\"https://www.w3.org/ns/activitystreams#followers\\"]; @@ -115039,7 +127489,7 @@ get gateways(): (URL)[] { instance.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = _BBCTgfphhsFzpVfKTykGSpBNwoA_followers; const _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); let _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array = values[\\"https://www.w3.org/ns/activitystreams#liked\\"]; @@ -115080,7 +127530,7 @@ get gateways(): (URL)[] { instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; const _4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); let _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array = values[\\"http://joinmastodon.org/ns#featured\\"]; @@ -115121,7 +127571,7 @@ get gateways(): (URL)[] { instance.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = _4N1vBJzXDf8NbBumeECQMFvKetja_featured; const _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); let _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array = values[\\"http://joinmastodon.org/ns#featuredTags\\"]; @@ -115162,7 +127612,7 @@ get gateways(): (URL)[] { instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; const _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); let _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections__array = values[\\"https://w3id.org/fep/7aa9#featuredCollections\\"]; @@ -115203,7 +127653,7 @@ get gateways(): (URL)[] { instance.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); let _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array = values[\\"https://www.w3.org/ns/activitystreams#streams\\"]; @@ -115392,7 +127842,7 @@ get gateways(): (URL)[] { instance.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable; const _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); let _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array = values[\\"https://www.w3.org/ns/activitystreams#movedTo\\"]; @@ -115450,7 +127900,7 @@ get gateways(): (URL)[] { instance.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; const _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); let _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array = values[\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"]; @@ -115508,7 +127958,7 @@ get gateways(): (URL)[] { instance.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; const _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); let _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array = values[\\"https://www.w3.org/ns/did#service\\"]; @@ -116289,8 +128739,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Page.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -116345,7 +128795,77 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const clone = super.clone(values, options) as unknown as Page; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];width?: number | null;height?: number | null;digestMultibase?: string | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Page { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -116689,39 +129209,39 @@ export class Person extends Object { #_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername: ((string | LanguageString))[] = []; #_axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); #_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); #_hQiaHhZP8hqxckxTBrpsGNs57E3: (URL)[] = []; #_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers: (boolean)[] = []; #_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); #_41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); #_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); #_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); #_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); #_4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); #_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); #_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); #_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); #_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints: (Endpoints)[] = []; #_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable: (boolean)[] = []; #_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended: (boolean)[] = []; @@ -116729,13 +129249,13 @@ export class Person extends Object { #_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable: (boolean)[] = []; #_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); #_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); #_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); #_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage: (string)[] = []; #_2xEU4QtkC53RAun67T81Egqt9vmL_isCat: (boolean)[] = []; #_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense: (URL)[] = []; @@ -116804,10 +129324,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -116840,14 +129384,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; - for (let i = 0; i < values.publicKeys.length; i++) { - this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -116880,14 +129446,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; - for (let i = 0; i < values.assertionMethods.length; i++) { - this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -116920,10 +129508,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -117052,14 +129664,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | if (\\"streams\\" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; - for (let i = 0; i < values.streams.length; i++) { - this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -117170,14 +129804,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; - for (let i = 0; i < values.aliases.length; i++) { - this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -117210,14 +129866,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; - for (let i = 0; i < values.services.length; i++) { - this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -117278,8 +129956,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Person.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -117337,7 +130015,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Person;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice(); + const clone = super.clone(values, options) as unknown as Person;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < vocabSparseArrayMinimumLength + ? this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice() : vocabCopyPropertyArray(this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername); if (\\"preferredUsername\\" in values && values.preferredUsername != null) { if (typeof values.preferredUsername === \\"string\\" || values.preferredUsername instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -117361,10 +130040,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -117373,12 +130076,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice();clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length < vocabSparseArrayMinimumLength + ? this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice() : vocabCopyPropertyArray(this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey);clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = vocabCopyTrustSet( + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, + ); if (\\"publicKey\\" in values && values.publicKey != null) { if (values.publicKey instanceof CryptographicKey || values.publicKey instanceof URL) { // @ts-ignore: type is checked above. clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = [values.publicKey]; - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set([0]); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The publicKey must be of type \\" + @@ -117397,15 +130104,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); - for (let i = 0; i < values.publicKeys.length; i++) { - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -117414,12 +130143,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice();clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length < vocabSparseArrayMinimumLength + ? this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice() : vocabCopyPropertyArray(this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod);clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = vocabCopyTrustSet( + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, + ); if (\\"assertionMethod\\" in values && values.assertionMethod != null) { if (values.assertionMethod instanceof Multikey || values.assertionMethod instanceof URL) { // @ts-ignore: type is checked above. clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = [values.assertionMethod]; - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set([0]); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The assertionMethod must be of type \\" + @@ -117438,15 +130171,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); - for (let i = 0; i < values.assertionMethods.length; i++) { - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -117455,7 +130210,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length < vocabSparseArrayMinimumLength + ? this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice() : vocabCopyPropertyArray(this.#_hQiaHhZP8hqxckxTBrpsGNs57E3); if (\\"gateway\\" in values && values.gateway != null) { if (values.gateway instanceof URL && isGatewayUrl(values.gateway)) { // @ts-ignore: type is checked above. @@ -117479,10 +130235,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -117491,7 +130271,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice(); + clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.length < vocabSparseArrayMinimumLength + ? this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice() : vocabCopyPropertyArray(this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers); if (\\"manuallyApprovesFollowers\\" in values && values.manuallyApprovesFollowers != null) { if (typeof values.manuallyApprovesFollowers === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -117504,12 +130285,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice();clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox); + clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length < vocabSparseArrayMinimumLength + ? this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice() : vocabCopyPropertyArray(this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox);clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = vocabCopyTrustSet( + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, + ); if (\\"inbox\\" in values && values.inbox != null) { if (values.inbox instanceof OrderedCollection || values.inbox instanceof OrderedCollectionPage || values.inbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = [values.inbox]; - clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set([0]); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The inbox must be of type \\" + @@ -117517,12 +130302,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice();clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox); + clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length < vocabSparseArrayMinimumLength + ? this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice() : vocabCopyPropertyArray(this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox);clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = vocabCopyTrustSet( + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, + ); if (\\"outbox\\" in values && values.outbox != null) { if (values.outbox instanceof OrderedCollection || values.outbox instanceof OrderedCollectionPage || values.outbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = [values.outbox]; - clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set([0]); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The outbox must be of type \\" + @@ -117530,12 +130319,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice();clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following); + clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length < vocabSparseArrayMinimumLength + ? this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice() : vocabCopyPropertyArray(this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following);clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = vocabCopyTrustSet( + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, + ); if (\\"following\\" in values && values.following != null) { if (values.following instanceof Collection || values.following instanceof URL) { // @ts-ignore: type is checked above. clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = [values.following]; - clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set([0]); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The following must be of type \\" + @@ -117543,12 +130336,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice();clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers); + clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length < vocabSparseArrayMinimumLength + ? this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice() : vocabCopyPropertyArray(this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers);clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = vocabCopyTrustSet( + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, + ); if (\\"followers\\" in values && values.followers != null) { if (values.followers instanceof Collection || values.followers instanceof URL) { // @ts-ignore: type is checked above. clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = [values.followers]; - clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set([0]); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The followers must be of type \\" + @@ -117556,12 +130353,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice();clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked); + clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length < vocabSparseArrayMinimumLength + ? this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice() : vocabCopyPropertyArray(this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked);clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = vocabCopyTrustSet( + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, + ); if (\\"liked\\" in values && values.liked != null) { if (values.liked instanceof Collection || values.liked instanceof URL) { // @ts-ignore: type is checked above. clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = [values.liked]; - clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set([0]); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The liked must be of type \\" + @@ -117569,12 +130370,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice();clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured); + clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length < vocabSparseArrayMinimumLength + ? this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice() : vocabCopyPropertyArray(this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured);clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = vocabCopyTrustSet( + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, + ); if (\\"featured\\" in values && values.featured != null) { if (values.featured instanceof Collection || values.featured instanceof URL) { // @ts-ignore: type is checked above. clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = [values.featured]; - clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set([0]); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featured must be of type \\" + @@ -117582,12 +130387,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice();clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags); + clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length < vocabSparseArrayMinimumLength + ? this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice() : vocabCopyPropertyArray(this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags);clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = vocabCopyTrustSet( + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, + ); if (\\"featuredTags\\" in values && values.featuredTags != null) { if (values.featuredTags instanceof Collection || values.featuredTags instanceof URL) { // @ts-ignore: type is checked above. clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = [values.featuredTags]; - clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set([0]); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredTags must be of type \\" + @@ -117595,12 +130404,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice();clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections); + clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length < vocabSparseArrayMinimumLength + ? this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice() : vocabCopyPropertyArray(this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections);clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = vocabCopyTrustSet( + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, + ); if (\\"featuredCollections\\" in values && values.featuredCollections != null) { if (values.featuredCollections instanceof Collection || values.featuredCollections instanceof URL) { // @ts-ignore: type is checked above. clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = [values.featuredCollections]; - clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set([0]); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredCollections must be of type \\" + @@ -117608,18 +130421,43 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice();clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length < vocabSparseArrayMinimumLength + ? this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice() : vocabCopyPropertyArray(this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams);clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = vocabCopyTrustSet( + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, + ); if (\\"streams\\" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(); - for (let i = 0; i < values.streams.length; i++) { - clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -117628,7 +130466,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice(); + clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length < vocabSparseArrayMinimumLength + ? this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice() : vocabCopyPropertyArray(this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints); if (\\"endpoints\\" in values && values.endpoints != null) { if (values.endpoints instanceof Endpoints) { // @ts-ignore: type is checked above. @@ -117641,7 +130480,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice(); + clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length < vocabSparseArrayMinimumLength + ? this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice() : vocabCopyPropertyArray(this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable); if (\\"discoverable\\" in values && values.discoverable != null) { if (typeof values.discoverable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -117654,7 +130494,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice(); + clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.length < vocabSparseArrayMinimumLength + ? this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice() : vocabCopyPropertyArray(this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended); if (\\"suspended\\" in values && values.suspended != null) { if (typeof values.suspended === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -117667,7 +130508,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice(); + clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.length < vocabSparseArrayMinimumLength + ? this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice() : vocabCopyPropertyArray(this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial); if (\\"memorial\\" in values && values.memorial != null) { if (typeof values.memorial === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -117680,7 +130522,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice(); + clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.length < vocabSparseArrayMinimumLength + ? this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice() : vocabCopyPropertyArray(this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable); if (\\"indexable\\" in values && values.indexable != null) { if (typeof values.indexable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -117693,12 +130536,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice();clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo); + clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length < vocabSparseArrayMinimumLength + ? this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice() : vocabCopyPropertyArray(this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo);clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = vocabCopyTrustSet( + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, + ); if (\\"successor\\" in values && values.successor != null) { if (values.successor instanceof Application || values.successor instanceof Group || values.successor instanceof Organization || values.successor instanceof Person || values.successor instanceof Service || values.successor instanceof URL) { // @ts-ignore: type is checked above. clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = [values.successor]; - clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set([0]); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The successor must be of type \\" + @@ -117706,12 +130553,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice();clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length < vocabSparseArrayMinimumLength + ? this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice() : vocabCopyPropertyArray(this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs);clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = vocabCopyTrustSet( + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, + ); if (\\"alias\\" in values && values.alias != null) { if (values.alias instanceof Application || values.alias instanceof Group || values.alias instanceof Organization || values.alias instanceof Person || values.alias instanceof Service || values.alias instanceof URL) { // @ts-ignore: type is checked above. clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = [values.alias]; - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set([0]); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The alias must be of type \\" + @@ -117730,15 +130581,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); - for (let i = 0; i < values.aliases.length; i++) { - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -117747,12 +130620,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice();clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length < vocabSparseArrayMinimumLength + ? this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice() : vocabCopyPropertyArray(this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service);clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = vocabCopyTrustSet( + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, + ); if (\\"service\\" in values && values.service != null) { if (values.service instanceof DidService || values.service instanceof URL) { // @ts-ignore: type is checked above. clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = [values.service]; - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set([0]); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The service must be of type \\" + @@ -117771,15 +130648,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); - for (let i = 0; i < values.services.length; i++) { - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -117788,7 +130687,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice(); + clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.length < vocabSparseArrayMinimumLength + ? this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice() : vocabCopyPropertyArray(this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage); if (\\"followedMessage\\" in values && values.followedMessage != null) { if (typeof values.followedMessage === \\"string\\") { // @ts-ignore: type is checked above. @@ -117801,7 +130701,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice(); + clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.length < vocabSparseArrayMinimumLength + ? this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice() : vocabCopyPropertyArray(this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat); if (\\"cat\\" in values && values.cat != null) { if (typeof values.cat === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -117814,7 +130715,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice(); + clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length < vocabSparseArrayMinimumLength + ? this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice() : vocabCopyPropertyArray(this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense); if (\\"preferredLicense\\" in values && values.preferredLicense != null) { if (values.preferredLicense instanceof URL) { // @ts-ignore: type is checked above. @@ -117830,7 +130732,465 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];preferredUsername?: string | LanguageString | null; +preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; +publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; +assertionMethods?: (Multikey | URL)[];gateway?: URL | null; +gateways?: (URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;featuredCollections?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; +aliases?: (Application | Group | Organization | Person | Service | URL)[];service?: DidService | URL | null; +services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | null;preferredLicense?: URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Person { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Person; + + { + const array = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length; i++) { + const value = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i]; + if (value != null && typeof value === \\"object\\") { + node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length; i++) { + const value = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i] = context.value(value); + } + } + } + } + + { + const array = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length; i++) { + const value = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i]; + if (value != null && typeof value === \\"object\\") { + node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length; i++) { + const value = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length; i++) { + const value = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length; i++) { + const value = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i] = context.value(value); + } + } + } + } + + { + const array = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length; i++) { + const value = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i]; + if (value != null && typeof value === \\"object\\") { + node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length; i++) { + const value = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length; i++) { + const value = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length; i++) { + const value = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i] = context.value(value); + } + } + } + } + + { + const array = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length; i++) { + const value = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i]; + if (value != null && typeof value === \\"object\\") { + node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length; i++) { + const value = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i] = context.value(value); + } + } + } + } + + { + const array = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length; i++) { + const value = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i]; + if (value != null && typeof value === \\"object\\") { + node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length; i++) { + const value = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length; i++) { + const value = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length; i++) { + const value = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i] = context.value(value); + } + } + } + } + + { + const array = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length; i++) { + const value = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i]; + if (value != null && typeof value === \\"object\\") { + node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i] = context.value(value); + } + } + } + } +} }); } + /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. * @@ -118179,7 +131539,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[0]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#publicKey\\"); @@ -118247,7 +131608,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -118334,7 +131696,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#publicKey\\"); @@ -118406,7 +131769,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -118760,7 +132124,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#assertionMethod\\"); @@ -118828,7 +132193,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -118919,7 +132285,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#assertionMethod\\"); @@ -118991,7 +132358,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -119415,7 +132783,8 @@ get gateways(): (URL)[] { } let v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0]; if (!(v instanceof URL) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://www.w3.org/ns/ldp#inbox\\"); @@ -119483,7 +132852,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -119857,7 +133227,8 @@ get gateways(): (URL)[] { } let v = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[0]; if (!(v instanceof URL) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#outbox\\"); @@ -119925,7 +133296,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -120279,7 +133651,8 @@ get gateways(): (URL)[] { } let v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0]; if (!(v instanceof URL) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#following\\"); @@ -120347,7 +133720,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -120704,7 +134078,8 @@ get gateways(): (URL)[] { } let v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0]; if (!(v instanceof URL) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#followers\\"); @@ -120772,7 +134147,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -121127,7 +134503,8 @@ get gateways(): (URL)[] { } let v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0]; if (!(v instanceof URL) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#liked\\"); @@ -121195,7 +134572,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -121548,7 +134926,8 @@ get gateways(): (URL)[] { } let v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[0]; if (!(v instanceof URL) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://joinmastodon.org/ns#featured\\"); @@ -121616,7 +134995,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -121969,7 +135349,8 @@ get gateways(): (URL)[] { } let v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0]; if (!(v instanceof URL) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://joinmastodon.org/ns#featuredTags\\"); @@ -122037,7 +135418,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -122387,7 +135769,8 @@ get gateways(): (URL)[] { } let v = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[0]; if (!(v instanceof URL) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/7aa9#featuredCollections\\"); @@ -122455,7 +135838,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -122805,7 +136189,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#streams\\"); @@ -122877,7 +136262,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -123362,7 +136748,8 @@ get gateways(): (URL)[] { } let v = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0]; if (!(v instanceof URL) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#movedTo\\"); @@ -123430,7 +136817,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -123843,7 +137231,8 @@ get gateways(): (URL)[] { } let v = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"); @@ -123911,7 +137300,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -124002,7 +137392,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"); @@ -124074,7 +137465,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -124428,7 +137820,8 @@ get gateways(): (URL)[] { } let v = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/did#service\\"); @@ -124496,7 +137889,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -124587,7 +137981,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/did#service\\"); @@ -124659,7 +138054,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -126058,7 +139454,7 @@ get gateways(): (URL)[] { instance.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; const _axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); let _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array = values[\\"https://w3id.org/security#publicKey\\"]; @@ -126099,7 +139495,7 @@ get gateways(): (URL)[] { instance.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = _axq166E2eZADq34V4MYUc8KMZdC_publicKey; const _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); let _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array = values[\\"https://w3id.org/security#assertionMethod\\"]; @@ -126198,7 +139594,7 @@ get gateways(): (URL)[] { instance.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers; const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); let _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array = values[\\"http://www.w3.org/ns/ldp#inbox\\"]; @@ -126245,7 +139641,7 @@ get gateways(): (URL)[] { instance.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; const _41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); let _41QwhqJouoLg3h8dRPKat21brynC_outbox__array = values[\\"https://www.w3.org/ns/activitystreams#outbox\\"]; @@ -126292,7 +139688,7 @@ get gateways(): (URL)[] { instance.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = _41QwhqJouoLg3h8dRPKat21brynC_outbox; const _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); let _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array = values[\\"https://www.w3.org/ns/activitystreams#following\\"]; @@ -126333,7 +139729,7 @@ get gateways(): (URL)[] { instance.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; const _BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); let _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array = values[\\"https://www.w3.org/ns/activitystreams#followers\\"]; @@ -126374,7 +139770,7 @@ get gateways(): (URL)[] { instance.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = _BBCTgfphhsFzpVfKTykGSpBNwoA_followers; const _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); let _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array = values[\\"https://www.w3.org/ns/activitystreams#liked\\"]; @@ -126415,7 +139811,7 @@ get gateways(): (URL)[] { instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; const _4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); let _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array = values[\\"http://joinmastodon.org/ns#featured\\"]; @@ -126456,7 +139852,7 @@ get gateways(): (URL)[] { instance.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = _4N1vBJzXDf8NbBumeECQMFvKetja_featured; const _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); let _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array = values[\\"http://joinmastodon.org/ns#featuredTags\\"]; @@ -126497,7 +139893,7 @@ get gateways(): (URL)[] { instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; const _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); let _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections__array = values[\\"https://w3id.org/fep/7aa9#featuredCollections\\"]; @@ -126538,7 +139934,7 @@ get gateways(): (URL)[] { instance.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); let _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array = values[\\"https://www.w3.org/ns/activitystreams#streams\\"]; @@ -126727,7 +140123,7 @@ get gateways(): (URL)[] { instance.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable; const _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); let _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array = values[\\"https://www.w3.org/ns/activitystreams#movedTo\\"]; @@ -126785,7 +140181,7 @@ get gateways(): (URL)[] { instance.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; const _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); let _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array = values[\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"]; @@ -126843,7 +140239,7 @@ get gateways(): (URL)[] { instance.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; const _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); let _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array = values[\\"https://www.w3.org/ns/did#service\\"]; @@ -127711,8 +141107,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Place.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -127764,7 +141160,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Place;clone.#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy = this.#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy.slice(); + const clone = super.clone(values, options) as unknown as Place;clone.#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy = this.#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy.length < vocabSparseArrayMinimumLength + ? this.#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy.slice() : vocabCopyPropertyArray(this.#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy); if (\\"accuracy\\" in values && values.accuracy != null) { if (typeof values.accuracy === \\"number\\" && !Number.isNaN(values.accuracy)) { // @ts-ignore: type is checked above. @@ -127777,7 +141174,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude = this.#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude.slice(); + clone.#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude = this.#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude.length < vocabSparseArrayMinimumLength + ? this.#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude.slice() : vocabCopyPropertyArray(this.#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude); if (\\"altitude\\" in values && values.altitude != null) { if (typeof values.altitude === \\"number\\" && !Number.isNaN(values.altitude)) { // @ts-ignore: type is checked above. @@ -127790,7 +141188,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude = this.#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude.slice(); + clone.#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude = this.#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude.length < vocabSparseArrayMinimumLength + ? this.#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude.slice() : vocabCopyPropertyArray(this.#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude); if (\\"latitude\\" in values && values.latitude != null) { if (typeof values.latitude === \\"number\\" && !Number.isNaN(values.latitude)) { // @ts-ignore: type is checked above. @@ -127803,7 +141202,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude = this.#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude.slice(); + clone.#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude = this.#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude.length < vocabSparseArrayMinimumLength + ? this.#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude.slice() : vocabCopyPropertyArray(this.#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude); if (\\"longitude\\" in values && values.longitude != null) { if (typeof values.longitude === \\"number\\" && !Number.isNaN(values.longitude)) { // @ts-ignore: type is checked above. @@ -127816,7 +141216,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius = this.#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius.slice(); + clone.#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius = this.#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius.length < vocabSparseArrayMinimumLength + ? this.#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius.slice() : vocabCopyPropertyArray(this.#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius); if (\\"radius\\" in values && values.radius != null) { if (typeof values.radius === \\"number\\" && !Number.isNaN(values.radius)) { // @ts-ignore: type is checked above. @@ -127829,7 +141230,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units = this.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units.slice(); + clone.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units = this.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units.length < vocabSparseArrayMinimumLength + ? this.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units.slice() : vocabCopyPropertyArray(this.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units); if (\\"units\\" in values && values.units != null) { if (values.units == \\"cm\\" || values.units == \\"feet\\" || values.units == \\"inches\\" || values.units == \\"km\\" || values.units == \\"m\\" || values.units == \\"miles\\" || values.units instanceof URL) { // @ts-ignore: type is checked above. @@ -127845,7 +141247,107 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];accuracy?: number | null;altitude?: number | null;latitude?: number | null;longitude?: number | null;radius?: number | null;units?: \\"cm\\" | \\"feet\\" | \\"inches\\" | \\"km\\" | \\"m\\" | \\"miles\\" | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Place { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Place; + + { + const array = node.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units.length; i++) { + const value = node.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units[i]; + if (value != null && typeof value === \\"object\\") { + node.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units[i] = context.value(value); + } + } + } + } +} }); } + /** Indicates the accuracy of position coordinates on a {@link Place} objects. * Expressed in properties of percentage. e.g. \\"94.0\\" means \\"94.0% accurate\\". * @@ -128811,7 +142313,7 @@ export class Profile extends Object { } #_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes: (Object | URL)[] = []; - #_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes: Set = new Set(); + #_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes: VocabTrustSet = new Set(); /** * Constructs a new instance of Profile with the given values. @@ -128873,8 +142375,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Profile.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -128926,12 +142428,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Profile;clone.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = this.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.slice();clone.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = new Set(this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes); + const clone = super.clone(values, options) as unknown as Profile;clone.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = this.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.length < vocabSparseArrayMinimumLength + ? this.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.slice() : vocabCopyPropertyArray(this.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes);clone.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = vocabCopyTrustSet( + this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes, clone.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes, + ); if (\\"describes\\" in values && values.describes != null) { if (values.describes instanceof Object || values.describes instanceof URL) { // @ts-ignore: type is checked above. clone.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = [values.describes]; - clone.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = new Set([0]); + clone.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = new Set(); + clone.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The describes must be of type \\" + @@ -128942,7 +142448,107 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];describes?: Object | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Profile { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Profile; + + { + const array = node.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.length; i++) { + const value = node.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes[i] = context.value(value); + } + } + } + } +} }); } + async #fetchDescribes( url: URL, options: { @@ -129270,7 +142876,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes[0]; if (!(v instanceof URL) && - !this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.has(0)) { + !(0 < (this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes[vocabTrustPrefix] ?? 0) || + this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#describes\\"); @@ -129338,7 +142945,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.has(0)) { + !(0 < (this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes[vocabTrustPrefix] ?? 0) || + this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -129675,7 +143283,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes: (Object | URL)[] = []; - const _trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes: Set = new Set(); + const _trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes: VocabTrustSet = new Set(); let _3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes__array = values[\\"https://www.w3.org/ns/activitystreams#describes\\"]; @@ -129813,19 +143421,19 @@ export class Question extends IntransitiveActivity { } #_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf: (Object | URL)[] = []; - #_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf: Set = new Set(); + #_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf: VocabTrustSet = new Set(); #_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf: (Object | URL)[] = []; - #_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf: Set = new Set(); + #_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf: VocabTrustSet = new Set(); #_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed: ((Temporal.Instant | boolean))[] = []; #_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount: (number)[] = []; #_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); #_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; #_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); /** * Constructs a new instance of Question with the given values. @@ -129870,14 +143478,36 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti super(values, options); if (\\"exclusiveOptions\\" in values && values.exclusiveOptions != null) { - if (Array.isArray(values.exclusiveOptions) && - values.exclusiveOptions.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.exclusiveOptions)) { + const array = values.exclusiveOptions; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.exclusiveOptions; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = values.exclusiveOptions.slice(); + this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = copied; - for (let i = 0; i < values.exclusiveOptions.length; i++) { - this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.add(i); - } + vocabSetTrustPrefix(this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf, this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.length); } else { throw new TypeError( @@ -129889,14 +143519,36 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti if (\\"inclusiveOptions\\" in values && values.inclusiveOptions != null) { - if (Array.isArray(values.inclusiveOptions) && - values.inclusiveOptions.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.inclusiveOptions)) { + const array = values.inclusiveOptions; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.inclusiveOptions; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = values.inclusiveOptions.slice(); + this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = copied; - for (let i = 0; i < values.inclusiveOptions.length; i++) { - this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.add(i); - } + vocabSetTrustPrefix(this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf, this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.length); } else { throw new TypeError( @@ -129983,8 +143635,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Question.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -130042,18 +143694,43 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Question;clone.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.slice();clone.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = new Set(this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf); + const clone = super.clone(values, options) as unknown as Question;clone.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.length < vocabSparseArrayMinimumLength + ? this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.slice() : vocabCopyPropertyArray(this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf);clone.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = vocabCopyTrustSet( + this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf, clone.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf, + ); if (\\"exclusiveOptions\\" in values && values.exclusiveOptions != null) { - if (Array.isArray(values.exclusiveOptions) && - values.exclusiveOptions.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.exclusiveOptions)) { + const array = values.exclusiveOptions; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.exclusiveOptions; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = values.exclusiveOptions.slice(); + clone.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = copied; clone.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = new Set(); - for (let i = 0; i < values.exclusiveOptions.length; i++) { - clone.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf, clone.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.length); } else { throw new TypeError( @@ -130062,18 +143739,43 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti ); } } - clone.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.slice();clone.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = new Set(this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf); + clone.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.length < vocabSparseArrayMinimumLength + ? this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.slice() : vocabCopyPropertyArray(this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf);clone.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = vocabCopyTrustSet( + this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf, clone.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf, + ); if (\\"inclusiveOptions\\" in values && values.inclusiveOptions != null) { - if (Array.isArray(values.inclusiveOptions) && - values.inclusiveOptions.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.inclusiveOptions)) { + const array = values.inclusiveOptions; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.inclusiveOptions; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = values.inclusiveOptions.slice(); + clone.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = copied; clone.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = new Set(); - for (let i = 0; i < values.inclusiveOptions.length; i++) { - clone.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf, clone.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.length); } else { throw new TypeError( @@ -130082,7 +143784,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti ); } } - clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed.slice(); + clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed.length < vocabSparseArrayMinimumLength + ? this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed.slice() : vocabCopyPropertyArray(this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed); if (\\"closed\\" in values && values.closed != null) { if (isTemporalInstant(values.closed) || typeof values.closed === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -130095,7 +143798,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti ); } } - clone.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount = this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount.slice(); + clone.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount = this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount.length < vocabSparseArrayMinimumLength + ? this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount.slice() : vocabCopyPropertyArray(this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount); if (\\"voters\\" in values && values.voters != null) { if (typeof values.voters === \\"number\\" && Number.isInteger(values.voters) && values.voters >= 0) { // @ts-ignore: type is checked above. @@ -130108,12 +143812,16 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti ); } } - clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice();clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote); + clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length < vocabSparseArrayMinimumLength + ? this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice() : vocabCopyPropertyArray(this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote);clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = vocabCopyTrustSet( + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, + ); if (\\"quote\\" in values && values.quote != null) { if (values.quote instanceof Object || values.quote instanceof URL) { // @ts-ignore: type is checked above. clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = [values.quote]; - clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set([0]); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The quote must be of type \\" + @@ -130121,7 +143829,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti ); } } - clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice(); + clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length < vocabSparseArrayMinimumLength + ? this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice() : vocabCopyPropertyArray(this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl); if (\\"quoteUrl\\" in values && values.quoteUrl != null) { if (values.quoteUrl instanceof URL) { // @ts-ignore: type is checked above. @@ -130134,12 +143843,16 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti ); } } - clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice();clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization); + clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice() : vocabCopyPropertyArray(this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization);clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = vocabCopyTrustSet( + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, + ); if (\\"quoteAuthorization\\" in values && values.quoteAuthorization != null) { if (values.quoteAuthorization instanceof QuoteAuthorization || values.quoteAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = [values.quoteAuthorization]; - clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set([0]); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The quoteAuthorization must be of type \\" + @@ -130150,7 +143863,201 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOptions?: (Object | URL)[];closed?: Temporal.Instant | boolean | null;voters?: number | null;quote?: Object | URL | null;quoteUrl?: URL | null;quoteAuthorization?: QuoteAuthorization | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Question { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Question; + + { + const array = node.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.length; i++) { + const value = node.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.length; i++) { + const value = node.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length; i++) { + const value = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i] = context.value(value); + } + } + } + } + + { + const array = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length; i++) { + const value = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i]; + if (value != null && typeof value === \\"object\\") { + node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i] = context.value(value); + } + } + } + } + + { + const array = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length; i++) { + const value = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i]; + if (value != null && typeof value === \\"object\\") { + node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i] = context.value(value); + } + } + } + } +} }); } + async #fetchExclusiveOption( url: URL, options: { @@ -130479,7 +144386,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.has(i)) { + !(i < (this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#oneOf\\"); @@ -130551,7 +144459,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.has(i)) { + !(i < (this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -130904,7 +144813,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.has(i)) { + !(i < (this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#anyOf\\"); @@ -130976,7 +144886,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.has(i)) { + !(i < (this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -131359,7 +145270,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti } let v = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[0]; if (!(v instanceof URL) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/044f#quote\\"); @@ -131427,7 +145339,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -131801,7 +145714,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti } let v = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/044f#quoteAuthorization\\"); @@ -131869,7 +145783,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -132297,7 +146212,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf: (Object | URL)[] = []; - const _trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf: Set = new Set(); + const _trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf: VocabTrustSet = new Set(); let _2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf__array = values[\\"https://www.w3.org/ns/activitystreams#oneOf\\"]; @@ -132338,7 +146253,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti instance.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = _2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf; const _2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf: (Object | URL)[] = []; - const _trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf: Set = new Set(); + const _trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf: VocabTrustSet = new Set(); let _2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf__array = values[\\"https://www.w3.org/ns/activitystreams#anyOf\\"]; @@ -132447,7 +146362,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti instance.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount = _3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount; const _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); let _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote__array = values[\\"https://w3id.org/fep/044f#quote\\"]; @@ -132527,7 +146442,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; const _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); let _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization__array = values[\\"https://w3id.org/fep/044f#quoteAuthorization\\"]; @@ -132834,8 +146749,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Read.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -132896,7 +146811,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Read; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Read { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -133274,8 +147265,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Reject.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -133317,26 +147308,102 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - verifyPortableObject?: PortableObjectVerifier, - } = {} - ): Reject { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - // @ts-ignore: $warning is not recognized as a property, but it is. - options = { ...options, $warning: this._warning }; - } - const clone = super.clone(values, options) as unknown as Reject; - return clone; + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {} + ): Reject { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as Reject; + return clone; + } + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Reject { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -133671,13 +147738,13 @@ export class Relationship extends Object { } #_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject: (Object | URL)[] = []; - #_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject: Set = new Set(); + #_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject: VocabTrustSet = new Set(); #_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; - #_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); + #_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: VocabTrustSet = new Set(); #_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship: (Object | URL)[] = []; - #_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship: Set = new Set(); + #_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship: VocabTrustSet = new Set(); /** * Constructs a new instance of Relationship with the given values. @@ -133752,14 +147819,36 @@ relationships?: (Object | URL)[];} ); } - if (Array.isArray(values.objects) && - values.objects.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.objects)) { + const array = values.objects; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.objects; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects.slice(); + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = copied; - for (let i = 0; i < values.objects.length; i++) { - this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); - } + vocabSetTrustPrefix(this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length); } else { throw new TypeError( @@ -133792,14 +147881,36 @@ relationships?: (Object | URL)[];} ); } - if (Array.isArray(values.relationships) && - values.relationships.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.relationships)) { + const array = values.relationships; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.relationships; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = values.relationships.slice(); + this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = copied; - for (let i = 0; i < values.relationships.length; i++) { - this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.add(i); - } + vocabSetTrustPrefix(this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship, this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.length); } else { throw new TypeError( @@ -133821,8 +147932,8 @@ relationships?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Relationship.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -133876,12 +147987,16 @@ relationships?: (Object | URL)[];} // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Relationship;clone.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.slice();clone.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = new Set(this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject); + const clone = super.clone(values, options) as unknown as Relationship;clone.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.length < vocabSparseArrayMinimumLength + ? this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.slice() : vocabCopyPropertyArray(this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject);clone.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = vocabCopyTrustSet( + this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject, clone.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject, + ); if (\\"subject\\" in values && values.subject != null) { if (values.subject instanceof Object || values.subject instanceof URL) { // @ts-ignore: type is checked above. clone.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = [values.subject]; - clone.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = new Set([0]); + clone.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = new Set(); + clone.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The subject must be of type \\" + @@ -133889,12 +148004,16 @@ relationships?: (Object | URL)[];} ); } } - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.slice();clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object); + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length < vocabSparseArrayMinimumLength + ? this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.slice() : vocabCopyPropertyArray(this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object);clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = vocabCopyTrustSet( + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, + ); if (\\"object\\" in values && values.object != null) { if (values.object instanceof Object || values.object instanceof URL) { // @ts-ignore: type is checked above. clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = [values.object]; - clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set([0]); + clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(); + clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The object must be of type \\" + @@ -133913,15 +148032,37 @@ relationships?: (Object | URL)[];} ); } - if (Array.isArray(values.objects) && - values.objects.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.objects)) { + const array = values.objects; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.objects; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects.slice(); + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = copied; clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(); - for (let i = 0; i < values.objects.length; i++) { - clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length); } else { throw new TypeError( @@ -133930,12 +148071,16 @@ relationships?: (Object | URL)[];} ); } } - clone.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.slice();clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = new Set(this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship); + clone.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.length < vocabSparseArrayMinimumLength + ? this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.slice() : vocabCopyPropertyArray(this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship);clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = vocabCopyTrustSet( + this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship, clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship, + ); if (\\"relationship\\" in values && values.relationship != null) { if (values.relationship instanceof Object || values.relationship instanceof URL) { // @ts-ignore: type is checked above. clone.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = [values.relationship]; - clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = new Set([0]); + clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = new Set(); + clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The relationship must be of type \\" + @@ -133954,15 +148099,37 @@ relationships?: (Object | URL)[];} ); } - if (Array.isArray(values.relationships) && - values.relationships.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.relationships)) { + const array = values.relationships; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.relationships; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = values.relationships.slice(); + clone.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = copied; clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = new Set(); - for (let i = 0; i < values.relationships.length; i++) { - clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship, clone.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.length); } else { throw new TypeError( @@ -133974,7 +148141,153 @@ relationships?: (Object | URL)[];} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];subject?: Object | URL | null;object?: Object | URL | null; +objects?: (Object | URL)[];relationship?: Object | URL | null; +relationships?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Relationship { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Relationship; + + { + const array = node.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.length; i++) { + const value = node.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length; i++) { + const value = node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.length; i++) { + const value = node.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[i] = context.value(value); + } + } + } + } +} }); } + async #fetchSubject( url: URL, options: { @@ -134304,7 +148617,8 @@ relationships?: (Object | URL)[];} } let v = this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject[0]; if (!(v instanceof URL) && - !this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.has(0)) { + !(0 < (this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject[vocabTrustPrefix] ?? 0) || + this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#subject\\"); @@ -134372,7 +148686,8 @@ relationships?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.has(0)) { + !(0 < (this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject[vocabTrustPrefix] ?? 0) || + this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -134722,7 +149037,8 @@ relationships?: (Object | URL)[];} } let v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; if (!(v instanceof URL) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { + !(0 < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#object\\"); @@ -134790,7 +149106,8 @@ relationships?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { + !(0 < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -134878,7 +149195,8 @@ relationships?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i)) { + !(i < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#object\\"); @@ -134950,7 +149268,8 @@ relationships?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i)) { + !(i < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -135303,7 +149622,8 @@ relationships?: (Object | URL)[];} } let v = this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[0]; if (!(v instanceof URL) && - !this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(0)) { + !(0 < (this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[vocabTrustPrefix] ?? 0) || + this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#relationship\\"); @@ -135371,7 +149691,8 @@ relationships?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(0)) { + !(0 < (this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[vocabTrustPrefix] ?? 0) || + this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -135461,7 +149782,8 @@ relationships?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(i)) { + !(i < (this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[vocabTrustPrefix] ?? 0) || + this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#relationship\\"); @@ -135533,7 +149855,8 @@ relationships?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(i)) { + !(i < (this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[vocabTrustPrefix] ?? 0) || + this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -135951,7 +150274,7 @@ relationships?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject: (Object | URL)[] = []; - const _trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject: Set = new Set(); + const _trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject: VocabTrustSet = new Set(); let _2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject__array = values[\\"https://www.w3.org/ns/activitystreams#subject\\"]; @@ -135992,7 +150315,7 @@ relationships?: (Object | URL)[];} instance.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = _2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject; const _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; - const _trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); + const _trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: VocabTrustSet = new Set(); let _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array = values[\\"https://www.w3.org/ns/activitystreams#object\\"]; @@ -136033,7 +150356,7 @@ relationships?: (Object | URL)[];} instance.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; const _4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship: (Object | URL)[] = []; - const _trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship: Set = new Set(); + const _trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship: VocabTrustSet = new Set(); let _4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship__array = values[\\"https://www.w3.org/ns/activitystreams#relationship\\"]; @@ -136269,8 +150592,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Remove.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -136331,7 +150654,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Remove; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Remove { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -136656,39 +151055,39 @@ export class Service extends Object { #_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername: ((string | LanguageString))[] = []; #_axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); #_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); #_hQiaHhZP8hqxckxTBrpsGNs57E3: (URL)[] = []; #_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers: (boolean)[] = []; #_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); #_41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); #_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); #_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); #_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); #_4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); #_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); #_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); #_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); #_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints: (Endpoints)[] = []; #_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable: (boolean)[] = []; #_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended: (boolean)[] = []; @@ -136696,13 +151095,13 @@ export class Service extends Object { #_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable: (boolean)[] = []; #_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); #_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); #_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); #_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage: (string)[] = []; #_2xEU4QtkC53RAun67T81Egqt9vmL_isCat: (boolean)[] = []; #_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense: (URL)[] = []; @@ -136771,10 +151170,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -136807,14 +151230,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; - for (let i = 0; i < values.publicKeys.length; i++) { - this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -136847,14 +151292,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; - for (let i = 0; i < values.assertionMethods.length; i++) { - this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -136887,10 +151354,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -137019,14 +151510,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | if (\\"streams\\" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; - for (let i = 0; i < values.streams.length; i++) { - this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -137137,14 +151650,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; - for (let i = 0; i < values.aliases.length; i++) { - this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -137177,14 +151712,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; - for (let i = 0; i < values.services.length; i++) { - this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -137245,8 +151802,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Service.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -137304,7 +151861,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Service;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice(); + const clone = super.clone(values, options) as unknown as Service;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < vocabSparseArrayMinimumLength + ? this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice() : vocabCopyPropertyArray(this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername); if (\\"preferredUsername\\" in values && values.preferredUsername != null) { if (typeof values.preferredUsername === \\"string\\" || values.preferredUsername instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -137328,10 +151886,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -137340,12 +151922,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice();clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length < vocabSparseArrayMinimumLength + ? this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice() : vocabCopyPropertyArray(this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey);clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = vocabCopyTrustSet( + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, + ); if (\\"publicKey\\" in values && values.publicKey != null) { if (values.publicKey instanceof CryptographicKey || values.publicKey instanceof URL) { // @ts-ignore: type is checked above. clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = [values.publicKey]; - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set([0]); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The publicKey must be of type \\" + @@ -137364,15 +151950,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); - for (let i = 0; i < values.publicKeys.length; i++) { - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -137381,12 +151989,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice();clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length < vocabSparseArrayMinimumLength + ? this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice() : vocabCopyPropertyArray(this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod);clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = vocabCopyTrustSet( + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, + ); if (\\"assertionMethod\\" in values && values.assertionMethod != null) { if (values.assertionMethod instanceof Multikey || values.assertionMethod instanceof URL) { // @ts-ignore: type is checked above. clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = [values.assertionMethod]; - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set([0]); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The assertionMethod must be of type \\" + @@ -137405,15 +152017,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); - for (let i = 0; i < values.assertionMethods.length; i++) { - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -137422,7 +152056,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length < vocabSparseArrayMinimumLength + ? this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice() : vocabCopyPropertyArray(this.#_hQiaHhZP8hqxckxTBrpsGNs57E3); if (\\"gateway\\" in values && values.gateway != null) { if (values.gateway instanceof URL && isGatewayUrl(values.gateway)) { // @ts-ignore: type is checked above. @@ -137446,10 +152081,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -137458,7 +152117,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice(); + clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.length < vocabSparseArrayMinimumLength + ? this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice() : vocabCopyPropertyArray(this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers); if (\\"manuallyApprovesFollowers\\" in values && values.manuallyApprovesFollowers != null) { if (typeof values.manuallyApprovesFollowers === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -137471,12 +152131,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice();clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox); + clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length < vocabSparseArrayMinimumLength + ? this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice() : vocabCopyPropertyArray(this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox);clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = vocabCopyTrustSet( + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, + ); if (\\"inbox\\" in values && values.inbox != null) { if (values.inbox instanceof OrderedCollection || values.inbox instanceof OrderedCollectionPage || values.inbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = [values.inbox]; - clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set([0]); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The inbox must be of type \\" + @@ -137484,12 +152148,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice();clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox); + clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length < vocabSparseArrayMinimumLength + ? this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice() : vocabCopyPropertyArray(this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox);clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = vocabCopyTrustSet( + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, + ); if (\\"outbox\\" in values && values.outbox != null) { if (values.outbox instanceof OrderedCollection || values.outbox instanceof OrderedCollectionPage || values.outbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = [values.outbox]; - clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set([0]); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The outbox must be of type \\" + @@ -137497,12 +152165,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice();clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following); + clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length < vocabSparseArrayMinimumLength + ? this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice() : vocabCopyPropertyArray(this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following);clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = vocabCopyTrustSet( + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, + ); if (\\"following\\" in values && values.following != null) { if (values.following instanceof Collection || values.following instanceof URL) { // @ts-ignore: type is checked above. clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = [values.following]; - clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set([0]); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The following must be of type \\" + @@ -137510,12 +152182,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice();clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers); + clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length < vocabSparseArrayMinimumLength + ? this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice() : vocabCopyPropertyArray(this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers);clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = vocabCopyTrustSet( + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, + ); if (\\"followers\\" in values && values.followers != null) { if (values.followers instanceof Collection || values.followers instanceof URL) { // @ts-ignore: type is checked above. clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = [values.followers]; - clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set([0]); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The followers must be of type \\" + @@ -137523,12 +152199,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice();clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked); + clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length < vocabSparseArrayMinimumLength + ? this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice() : vocabCopyPropertyArray(this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked);clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = vocabCopyTrustSet( + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, + ); if (\\"liked\\" in values && values.liked != null) { if (values.liked instanceof Collection || values.liked instanceof URL) { // @ts-ignore: type is checked above. clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = [values.liked]; - clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set([0]); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The liked must be of type \\" + @@ -137536,12 +152216,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice();clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured); + clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length < vocabSparseArrayMinimumLength + ? this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice() : vocabCopyPropertyArray(this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured);clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = vocabCopyTrustSet( + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, + ); if (\\"featured\\" in values && values.featured != null) { if (values.featured instanceof Collection || values.featured instanceof URL) { // @ts-ignore: type is checked above. clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = [values.featured]; - clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set([0]); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featured must be of type \\" + @@ -137549,12 +152233,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice();clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags); + clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length < vocabSparseArrayMinimumLength + ? this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice() : vocabCopyPropertyArray(this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags);clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = vocabCopyTrustSet( + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, + ); if (\\"featuredTags\\" in values && values.featuredTags != null) { if (values.featuredTags instanceof Collection || values.featuredTags instanceof URL) { // @ts-ignore: type is checked above. clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = [values.featuredTags]; - clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set([0]); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredTags must be of type \\" + @@ -137562,12 +152250,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice();clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections); + clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length < vocabSparseArrayMinimumLength + ? this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice() : vocabCopyPropertyArray(this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections);clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = vocabCopyTrustSet( + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, + ); if (\\"featuredCollections\\" in values && values.featuredCollections != null) { if (values.featuredCollections instanceof Collection || values.featuredCollections instanceof URL) { // @ts-ignore: type is checked above. clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = [values.featuredCollections]; - clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set([0]); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The featuredCollections must be of type \\" + @@ -137575,18 +152267,43 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice();clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length < vocabSparseArrayMinimumLength + ? this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice() : vocabCopyPropertyArray(this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams);clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = vocabCopyTrustSet( + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, + ); if (\\"streams\\" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(); - for (let i = 0; i < values.streams.length; i++) { - clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -137595,7 +152312,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice(); + clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length < vocabSparseArrayMinimumLength + ? this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice() : vocabCopyPropertyArray(this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints); if (\\"endpoints\\" in values && values.endpoints != null) { if (values.endpoints instanceof Endpoints) { // @ts-ignore: type is checked above. @@ -137608,7 +152326,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice(); + clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length < vocabSparseArrayMinimumLength + ? this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice() : vocabCopyPropertyArray(this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable); if (\\"discoverable\\" in values && values.discoverable != null) { if (typeof values.discoverable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -137621,7 +152340,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice(); + clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.length < vocabSparseArrayMinimumLength + ? this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice() : vocabCopyPropertyArray(this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended); if (\\"suspended\\" in values && values.suspended != null) { if (typeof values.suspended === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -137634,7 +152354,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice(); + clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.length < vocabSparseArrayMinimumLength + ? this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice() : vocabCopyPropertyArray(this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial); if (\\"memorial\\" in values && values.memorial != null) { if (typeof values.memorial === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -137647,7 +152368,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice(); + clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.length < vocabSparseArrayMinimumLength + ? this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice() : vocabCopyPropertyArray(this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable); if (\\"indexable\\" in values && values.indexable != null) { if (typeof values.indexable === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -137660,12 +152382,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice();clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo); + clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length < vocabSparseArrayMinimumLength + ? this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice() : vocabCopyPropertyArray(this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo);clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = vocabCopyTrustSet( + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, + ); if (\\"successor\\" in values && values.successor != null) { if (values.successor instanceof Application || values.successor instanceof Group || values.successor instanceof Organization || values.successor instanceof Person || values.successor instanceof Service || values.successor instanceof URL) { // @ts-ignore: type is checked above. clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = [values.successor]; - clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set([0]); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The successor must be of type \\" + @@ -137673,12 +152399,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice();clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length < vocabSparseArrayMinimumLength + ? this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice() : vocabCopyPropertyArray(this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs);clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = vocabCopyTrustSet( + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, + ); if (\\"alias\\" in values && values.alias != null) { if (values.alias instanceof Application || values.alias instanceof Group || values.alias instanceof Organization || values.alias instanceof Person || values.alias instanceof Service || values.alias instanceof URL) { // @ts-ignore: type is checked above. clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = [values.alias]; - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set([0]); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The alias must be of type \\" + @@ -137697,15 +152427,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); - for (let i = 0; i < values.aliases.length; i++) { - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -137714,12 +152466,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice();clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length < vocabSparseArrayMinimumLength + ? this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice() : vocabCopyPropertyArray(this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service);clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = vocabCopyTrustSet( + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, + ); if (\\"service\\" in values && values.service != null) { if (values.service instanceof DidService || values.service instanceof URL) { // @ts-ignore: type is checked above. clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = [values.service]; - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set([0]); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] = 1; } else { throw new TypeError( \\"The service must be of type \\" + @@ -137738,15 +152494,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); - for (let i = 0; i < values.services.length; i++) { - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -137755,7 +152533,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice(); + clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.length < vocabSparseArrayMinimumLength + ? this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice() : vocabCopyPropertyArray(this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage); if (\\"followedMessage\\" in values && values.followedMessage != null) { if (typeof values.followedMessage === \\"string\\") { // @ts-ignore: type is checked above. @@ -137768,7 +152547,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice(); + clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.length < vocabSparseArrayMinimumLength + ? this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice() : vocabCopyPropertyArray(this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat); if (\\"cat\\" in values && values.cat != null) { if (typeof values.cat === \\"boolean\\") { // @ts-ignore: type is checked above. @@ -137781,7 +152561,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice(); + clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length < vocabSparseArrayMinimumLength + ? this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice() : vocabCopyPropertyArray(this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense); if (\\"preferredLicense\\" in values && values.preferredLicense != null) { if (values.preferredLicense instanceof URL) { // @ts-ignore: type is checked above. @@ -137797,7 +152578,465 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];preferredUsername?: string | LanguageString | null; +preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; +publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; +assertionMethods?: (Multikey | URL)[];gateway?: URL | null; +gateways?: (URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;featuredCollections?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; +aliases?: (Application | Group | Organization | Person | Service | URL)[];service?: DidService | URL | null; +services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | null;preferredLicense?: URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Service { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Service; + + { + const array = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length; i++) { + const value = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i]; + if (value != null && typeof value === \\"object\\") { + node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length; i++) { + const value = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i] = context.value(value); + } + } + } + } + + { + const array = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length; i++) { + const value = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i]; + if (value != null && typeof value === \\"object\\") { + node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length; i++) { + const value = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length; i++) { + const value = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i]; + if (value != null && typeof value === \\"object\\") { + node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length; i++) { + const value = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i] = context.value(value); + } + } + } + } + + { + const array = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length; i++) { + const value = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i]; + if (value != null && typeof value === \\"object\\") { + node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length; i++) { + const value = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length; i++) { + const value = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length; i++) { + const value = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i] = context.value(value); + } + } + } + } + + { + const array = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length; i++) { + const value = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i]; + if (value != null && typeof value === \\"object\\") { + node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length; i++) { + const value = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i] = context.value(value); + } + } + } + } + + { + const array = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length; i++) { + const value = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i]; + if (value != null && typeof value === \\"object\\") { + node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length; i++) { + const value = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i]; + if (value != null && typeof value === \\"object\\") { + node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length; i++) { + const value = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i]; + if (value != null && typeof value === \\"object\\") { + node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length; i++) { + const value = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i]; + if (value != null && typeof value === \\"object\\") { + node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i] = context.value(value); + } + } + } + } + + { + const array = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === \\"object\\") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length; i++) { + const value = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i]; + if (value != null && typeof value === \\"object\\") { + node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i] = context.value(value); + } + } + } + } +} }); } + /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. * @@ -138146,7 +153385,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[0]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#publicKey\\"); @@ -138214,7 +153454,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -138301,7 +153542,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#publicKey\\"); @@ -138373,7 +153615,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -138727,7 +153970,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#assertionMethod\\"); @@ -138795,7 +154039,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -138886,7 +154131,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/security#assertionMethod\\"); @@ -138958,7 +154204,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -139382,7 +154629,8 @@ get gateways(): (URL)[] { } let v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0]; if (!(v instanceof URL) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://www.w3.org/ns/ldp#inbox\\"); @@ -139450,7 +154698,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -139824,7 +155073,8 @@ get gateways(): (URL)[] { } let v = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[0]; if (!(v instanceof URL) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#outbox\\"); @@ -139892,7 +155142,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -140246,7 +155497,8 @@ get gateways(): (URL)[] { } let v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0]; if (!(v instanceof URL) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#following\\"); @@ -140314,7 +155566,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -140671,7 +155924,8 @@ get gateways(): (URL)[] { } let v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0]; if (!(v instanceof URL) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#followers\\"); @@ -140739,7 +155993,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -141094,7 +156349,8 @@ get gateways(): (URL)[] { } let v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0]; if (!(v instanceof URL) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#liked\\"); @@ -141162,7 +156418,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -141515,7 +156772,8 @@ get gateways(): (URL)[] { } let v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[0]; if (!(v instanceof URL) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://joinmastodon.org/ns#featured\\"); @@ -141583,7 +156841,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -141936,7 +157195,8 @@ get gateways(): (URL)[] { } let v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0]; if (!(v instanceof URL) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"http://joinmastodon.org/ns#featuredTags\\"); @@ -142004,7 +157264,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -142354,7 +157615,8 @@ get gateways(): (URL)[] { } let v = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[0]; if (!(v instanceof URL) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://w3id.org/fep/7aa9#featuredCollections\\"); @@ -142422,7 +157684,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -142772,7 +158035,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#streams\\"); @@ -142844,7 +158108,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -143329,7 +158594,8 @@ get gateways(): (URL)[] { } let v = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0]; if (!(v instanceof URL) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#movedTo\\"); @@ -143397,7 +158663,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -143810,7 +159077,8 @@ get gateways(): (URL)[] { } let v = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"); @@ -143878,7 +159146,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -143969,7 +159238,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"); @@ -144041,7 +159311,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -144395,7 +159666,8 @@ get gateways(): (URL)[] { } let v = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/did#service\\"); @@ -144463,7 +159735,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -144554,7 +159827,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, \\"https://www.w3.org/ns/did#service\\"); @@ -144626,7 +159900,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (options.crossOrigin === \\"throw\\") { throw new Error( \\"The property object's @id (\\" + v.id.href + \\") has a different \\" + @@ -146025,7 +161300,7 @@ get gateways(): (URL)[] { instance.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; const _axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); let _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array = values[\\"https://w3id.org/security#publicKey\\"]; @@ -146066,7 +161341,7 @@ get gateways(): (URL)[] { instance.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = _axq166E2eZADq34V4MYUc8KMZdC_publicKey; const _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); let _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array = values[\\"https://w3id.org/security#assertionMethod\\"]; @@ -146165,7 +161440,7 @@ get gateways(): (URL)[] { instance.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers; const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); let _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array = values[\\"http://www.w3.org/ns/ldp#inbox\\"]; @@ -146212,7 +161487,7 @@ get gateways(): (URL)[] { instance.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; const _41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); let _41QwhqJouoLg3h8dRPKat21brynC_outbox__array = values[\\"https://www.w3.org/ns/activitystreams#outbox\\"]; @@ -146259,7 +161534,7 @@ get gateways(): (URL)[] { instance.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = _41QwhqJouoLg3h8dRPKat21brynC_outbox; const _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); let _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array = values[\\"https://www.w3.org/ns/activitystreams#following\\"]; @@ -146300,7 +161575,7 @@ get gateways(): (URL)[] { instance.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; const _BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); let _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array = values[\\"https://www.w3.org/ns/activitystreams#followers\\"]; @@ -146341,7 +161616,7 @@ get gateways(): (URL)[] { instance.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = _BBCTgfphhsFzpVfKTykGSpBNwoA_followers; const _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); let _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array = values[\\"https://www.w3.org/ns/activitystreams#liked\\"]; @@ -146382,7 +161657,7 @@ get gateways(): (URL)[] { instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; const _4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); let _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array = values[\\"http://joinmastodon.org/ns#featured\\"]; @@ -146423,7 +161698,7 @@ get gateways(): (URL)[] { instance.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = _4N1vBJzXDf8NbBumeECQMFvKetja_featured; const _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); let _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array = values[\\"http://joinmastodon.org/ns#featuredTags\\"]; @@ -146464,7 +161739,7 @@ get gateways(): (URL)[] { instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; const _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); let _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections__array = values[\\"https://w3id.org/fep/7aa9#featuredCollections\\"]; @@ -146505,7 +161780,7 @@ get gateways(): (URL)[] { instance.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); let _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array = values[\\"https://www.w3.org/ns/activitystreams#streams\\"]; @@ -146694,7 +161969,7 @@ get gateways(): (URL)[] { instance.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable; const _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); let _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array = values[\\"https://www.w3.org/ns/activitystreams#movedTo\\"]; @@ -146752,7 +162027,7 @@ get gateways(): (URL)[] { instance.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; const _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); let _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array = values[\\"https://www.w3.org/ns/activitystreams#alsoKnownAs\\"]; @@ -146810,7 +162085,7 @@ get gateways(): (URL)[] { instance.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; const _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); let _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array = values[\\"https://www.w3.org/ns/did#service\\"]; @@ -147677,10 +162952,34 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} ); } - if (Array.isArray(values.contents) && - values.contents.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.contents)) { + const array = values.contents; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.contents; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = values.contents.slice(); + this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = copied; } else { throw new TypeError( @@ -147715,8 +163014,8 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Source.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -147760,7 +163059,8 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} options ); copyPortableProvenance(this, clone); - clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.slice(); + clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length < vocabSparseArrayMinimumLength + ? this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.slice() : vocabCopyPropertyArray(this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content); if (\\"content\\" in values && values.content != null) { if (typeof values.content === \\"string\\" || values.content instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -147784,10 +163084,34 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} ); } - if (Array.isArray(values.contents) && - values.contents.every(v => typeof v === \\"string\\" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.contents)) { + const array = values.contents; + const test = (v: string | LanguageString): boolean => typeof v === \\"string\\" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.contents; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = values.contents.slice(); + clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = copied; } else { throw new TypeError( @@ -147796,7 +163120,8 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} ); } } - clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.slice(); + clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.length < vocabSparseArrayMinimumLength + ? this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.slice() : vocabCopyPropertyArray(this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType); if (\\"mediaType\\" in values && values.mediaType != null) { if (typeof values.mediaType === \\"string\\") { // @ts-ignore: type is checked above. @@ -147812,7 +163137,80 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];mediaType?: string | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Source { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Source; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Source; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); +} }); } + /** The source content. */ get content(): (string | LanguageString | null) { @@ -148416,8 +163814,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link TentativeAccept.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -148459,26 +163857,102 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - verifyPortableObject?: PortableObjectVerifier, - } = {} - ): TentativeAccept { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - // @ts-ignore: $warning is not recognized as a property, but it is. - options = { ...options, $warning: this._warning }; - } - const clone = super.clone(values, options) as unknown as TentativeAccept; - return clone; + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {} + ): TentativeAccept { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as TentativeAccept; + return clone; + } + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): TentativeAccept { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -148856,8 +164330,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link TentativeReject.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -148918,7 +164392,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as TentativeReject; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): TentativeReject { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -149305,10 +164855,34 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;} ); } - if (Array.isArray(values.formerTypes) && - values.formerTypes.every(v => isEntityType(v))) { + let copied!: ($EntityType)[]; + let valid = false; + if (Array.isArray(values.formerTypes)) { + const array = values.formerTypes; + const test = (v: $EntityType): boolean => isEntityType(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.formerTypes; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType = values.formerTypes.slice(); + this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType = copied; } else { throw new TypeError( @@ -149343,8 +164917,8 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Tombstone.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -149397,7 +164971,8 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;} // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Tombstone;clone.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType = this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType.slice(); + const clone = super.clone(values, options) as unknown as Tombstone;clone.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType = this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType.length < vocabSparseArrayMinimumLength + ? this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType.slice() : vocabCopyPropertyArray(this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType); if (\\"formerType\\" in values && values.formerType != null) { if (isEntityType(values.formerType)) { // @ts-ignore: type is checked above. @@ -149421,10 +164996,34 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;} ); } - if (Array.isArray(values.formerTypes) && - values.formerTypes.every(v => isEntityType(v))) { + let copied!: ($EntityType)[]; + let valid = false; + if (Array.isArray(values.formerTypes)) { + const array = values.formerTypes; + const test = (v: $EntityType): boolean => isEntityType(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.formerTypes; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType = values.formerTypes.slice(); + clone.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType = copied; } else { throw new TypeError( @@ -149433,7 +165032,8 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;} ); } } - clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted.slice(); + clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted.length < vocabSparseArrayMinimumLength + ? this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted.slice() : vocabCopyPropertyArray(this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted); if (\\"deleted\\" in values && values.deleted != null) { if (isTemporalInstant(values.deleted)) { // @ts-ignore: type is checked above. @@ -149449,7 +165049,78 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];formerType?: $EntityType | null; +formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Tombstone { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** On a \`Tombstone\` object, the \`formerType\` property identifies the type of * the object that was deleted. * @@ -150087,8 +165758,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Travel.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -150149,7 +165820,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Travel; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Travel { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -150532,8 +166279,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Undo.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -150594,7 +166341,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Undo; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Undo { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -150975,8 +166798,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Update.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -151037,7 +166860,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Update; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Update { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -151407,8 +167306,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Video.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -151463,7 +167362,77 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const clone = super.clone(values, options) as unknown as Video; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];width?: number | null;height?: number | null;digestMultibase?: string | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Video { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -151859,8 +167828,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link View.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -151921,7 +167890,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as View; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): View { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. diff --git a/packages/vocab-tools/src/__snapshots__/class.test.ts.snap b/packages/vocab-tools/src/__snapshots__/class.test.ts.snap index 8fd4e479d..29ba26d99 100644 --- a/packages/vocab-tools/src/__snapshots__/class.test.ts.snap +++ b/packages/vocab-tools/src/__snapshots__/class.test.ts.snap @@ -52,6 +52,7 @@ import { parseCompatibleEf61Reference, type PortableResponseClaim, recordPortableReferrer, + retargetPortableReferrer, rejectMalformedCompatibleReference, warnUnverifiableEmbeddedObject } from "@fedify/vocab-runtime/internal/portable-dereference"; @@ -81,6 +82,293 @@ function inspectIri(iri: URL): string { try { return formatIri(iri); } catch { return iri.href; } } +interface VocabSparseArraySnapshot { + length: number; + indices: number[]; +} + +interface VocabArrayValidation { + valid: boolean; + sparse: boolean; +} + +type VocabArrayCopy = { ok: true; array: T[] } | { ok: false }; + +// Most fields have no trusted prefix. Keep that metadata on the existing Set +// so empty fields need neither another object nor another instance slot. +const vocabTrustPrefix: unique symbol = Symbol("vocabulary trust prefix"); +type VocabTrustSet = Set & { [vocabTrustPrefix]?: number }; + +function vocabSetTrustPrefix(trust: VocabTrustSet, prefix: number): void { + if (prefix > 0) trust[vocabTrustPrefix] = prefix; +} + +function vocabCopyTrustSet( + trust: VocabTrustSet, + destination: VocabTrustSet, +): VocabTrustSet { + // clone() already constructed the destination. Reuse its empty Set only + // when constructor defaults cannot contribute trust to the copied field. + const copy: VocabTrustSet = trust !== destination && trust.size === 0 && + destination.size === 0 && destination[vocabTrustPrefix] == null + ? destination : new Set(trust); + const prefix = trust[vocabTrustPrefix]; + if (prefix != null && prefix > 0) copy[vocabTrustPrefix] = prefix; + return copy; +} + +// These thresholds select an optimization, not a limit on property arrays. +const vocabSparseArrayMinimumLength = 4096; +const vocabSparseArrayProbeCount = 8; +const vocabSparseArrayPresentProbeLimit = 4; +const vocabArrayPrototype = Array.prototype; +const vocabObjectPrototype = globalThis.Object.prototype; +const vocabArrayDescriptors = ["constructor", "every", "slice"].map( + key => globalThis.Object.getOwnPropertyDescriptor(vocabArrayPrototype, key), +); +const vocabArraySpeciesDescriptor = globalThis.Object.getOwnPropertyDescriptor( + Array, Symbol.species, +); + +function vocabSameArrayDescriptor( + actual: PropertyDescriptor | undefined, + expected: PropertyDescriptor | undefined, +): boolean { + return actual?.value === expected?.value && actual?.get === expected?.get && + actual?.set === expected?.set && actual?.writable === expected?.writable && + actual?.enumerable === expected?.enumerable && + actual?.configurable === expected?.configurable; +} + +function vocabArrayIndex(key: string): number | undefined { + const index = Number(key); + return Number.isInteger(index) && index >= 0 && index < 0xffffffff && + String(index) === key + ? index + : undefined; +} + +function vocabSparseArraySnapshot( + array: unknown[], +): VocabSparseArraySnapshot | undefined { + if (!Array.isArray(array)) return undefined; + const length = array.length; + // Small dense fields take no prototype or key-enumeration overhead. + if (length < vocabSparseArrayMinimumLength) return undefined; + if (!Number.isInteger(length) || length > 0xffffffff || + globalThis.Object.getPrototypeOf(array) !== vocabArrayPrototype || + globalThis.Object.getPrototypeOf(vocabArrayPrototype) !== + vocabObjectPrototype || + globalThis.Object.getPrototypeOf(vocabObjectPrototype) !== null) { + return undefined; + } + const methods = ["constructor", "every", "slice"]; + for (let i = 0; i < methods.length; i++) { + const key = methods[i]; + if (globalThis.Object.hasOwn(array, key) || + !vocabSameArrayDescriptor( + globalThis.Object.getOwnPropertyDescriptor(vocabArrayPrototype, key), + vocabArrayDescriptors[i], + )) return undefined; + } + if (!vocabSameArrayDescriptor( + globalThis.Object.getOwnPropertyDescriptor(Array, Symbol.species), + vocabArraySpeciesDescriptor, + )) return undefined; + + // Descriptor probes do not invoke element getters. Plainly dense arrays + // keep native iteration without enumerating all their keys. + let present = 0; + for (let i = 0; i < vocabSparseArrayProbeCount; i++) { + const index = Math.floor(i * (length - 1) / (vocabSparseArrayProbeCount - 1)); + if (globalThis.Object.getOwnPropertyDescriptor(array, index) != null && + ++present >= vocabSparseArrayPresentProbeLimit) return undefined; + } + for (const prototype of [vocabArrayPrototype, vocabObjectPrototype]) { + for (const key of globalThis.Object.getOwnPropertyNames(prototype)) { + if (vocabArrayIndex(key) != null) return undefined; + } + } + const indices: number[] = []; + for (const key of globalThis.Object.getOwnPropertyNames(array)) { + const index = vocabArrayIndex(key); + if (index != null && index < length) indices.push(index); + } + if (indices.length >= length / 2) return undefined; + for (const index of indices) { + const descriptor = globalThis.Object.getOwnPropertyDescriptor(array, index); + if (descriptor == null || !("value" in descriptor)) return undefined; + } + // Ordinary array keys already have canonical index order. This guard is + // not a Proxy detector; reflection traps and errors remain observable. + return { length, indices }; +} + +function vocabValidatePropertyArray( + array: T[], + test: (value: T) => boolean, +): VocabArrayValidation { + const snapshot = vocabSparseArraySnapshot(array); + if (snapshot == null) return { valid: array.every(test), sparse: false }; + for (const index of snapshot.indices) { + if (globalThis.Object.hasOwn(array, index) && !test(array[index])) { + return { valid: false, sparse: true }; + } + } + return { valid: true, sparse: true }; +} + +function vocabDefineArrayEntry(array: T[], index: number, value: T): void { + globalThis.Object.defineProperty(array, index, { + value, writable: true, enumerable: true, configurable: true, + }); +} + +function vocabCopySparsePropertyArray( + array: T[], + snapshot: VocabSparseArraySnapshot, + test?: (value: T) => boolean, +): VocabArrayCopy { + const copy: T[] = []; + // Seed dictionary storage before low indices or the final length can + // allocate storage for every hole. The temporary entry stays private. + if (snapshot.indices[snapshot.indices.length - 1] !== snapshot.length - 1) { + globalThis.Object.defineProperty(copy, snapshot.length - 1, { + value: undefined, writable: true, enumerable: true, configurable: true, + }); + delete copy[snapshot.length - 1]; + } + for (const index of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, index)) continue; + const value = array[index]; + if (test != null && !test(value)) return { ok: false }; + vocabDefineArrayEntry(copy, index, value); + } + // A validation callback may have deleted the last snapshot entry. + if (copy.length < snapshot.length) { + globalThis.Object.defineProperty(copy, snapshot.length - 1, { + value: undefined, writable: true, enumerable: true, configurable: true, + }); + delete copy[snapshot.length - 1]; + } + copy.length = snapshot.length; + return { ok: true, array: copy }; +} + +function vocabCopyPropertyArray(array: T[]): T[] { + const snapshot = vocabSparseArraySnapshot(array); + if (snapshot == null) return array.slice(); + const copied = vocabCopySparsePropertyArray(array, snapshot); + // Without a predicate the private copy cannot fail validation. + return (copied as { ok: true; array: T[] }).array; +} + +function vocabCopyValidatedPropertyArray( + array: T[], + test: (value: T) => boolean, + previous: VocabArrayValidation, +): VocabArrayCopy { + const snapshot = vocabSparseArraySnapshot(array); + if (snapshot != null) return vocabCopySparsePropertyArray(array, snapshot, test); + // Sparse validation may have changed the next input's density, descriptors + // or prototype. Validate that native-copy input before falling back. + if (previous.sparse && !array.every(test)) return { ok: false }; + return { ok: true, array: array.slice() }; +} + +interface DeepCloneContext { + value(value: T): T; +} + +interface DeepCloneDescriptor { + create(source: object): object; + copy(destination: object, context: DeepCloneContext): void; +} + +const deepCloneDescriptors = new Map(); + +function getDeepCloneDescriptor(value: object): DeepCloneDescriptor | undefined { + let prototype: object | null = globalThis.Object.getPrototypeOf(value); + while (prototype != null) { + const descriptor = deepCloneDescriptors.get(prototype); + if (descriptor != null) return descriptor; + prototype = globalThis.Object.getPrototypeOf(prototype); + } + return undefined; +} + +function deepCloneGraph(source: object, root: T): T { + const memo = new Map(); + const destinations = new Set(); + const shells: object[] = []; + let next = 0; + + function enqueue(original: object, destination: object): void { + if (destination == null || typeof destination !== "object" || + original === destination || destinations.has(destination) || + !globalThis.Object.prototype.isPrototypeOf.call( + globalThis.Object.getPrototypeOf(original), destination + ) || getDeepCloneDescriptor(destination) == null) { + throw new TypeError("clone() must return a fresh, compatible instance."); + } + destinations.add(destination); + shells.push(destination); + } + + const context: DeepCloneContext = { + value(value: V): V { + if (value == null || typeof value !== "object") return value; + const existing = memo.get(value); + if (existing != null) return existing as V; + if (value instanceof URL) { + const copy = new URL(value.href); + memo.set(value, copy); + return copy as V; + } + if (value instanceof Uint8Array) { + const copy = new Uint8Array(value); + memo.set(value, copy); + return copy as V; + } + const descriptor = getDeepCloneDescriptor(value); + // Other supported scalars (Temporal, LanguageString, Intl.Locale, + // CryptoKey and class constructors) are shared as immutable values. + if (descriptor == null) return value; + const copy = descriptor.create(value); + enqueue(value, copy); + memo.set(value, copy); + return copy as V; + }, + }; + + function drain(): void { + while (next < shells.length) { + const shell = shells[next++]; + getDeepCloneDescriptor(shell)!.copy(shell, context); + } + } + + // The effective root includes replacements. References to the source root + // instead receive a separate copy of its pre-update values. + enqueue(source, root); + drain(); + + // Discover historical root ancestry without substituting replacement values + // into it. The resolver deliberately returns undefined in this first pass. + const count = shells.length; + for (let i = 0; i < count; i++) { + retargetPortableReferrer(shells[i], (original) => { + if (original === source) context.value(source); + return undefined; + }); + } + drain(); + for (const shell of shells) { + retargetPortableReferrer(shell, (original) => memo.get(original)); + } + return root; +} + function isValidLanguageTag(language: string): boolean { try { new Intl.Locale(normalizeLanguageTag(language)); @@ -242,87 +530,87 @@ export class Object { } #_49BipA5dq9eoH8LX8xdsVumveTca_attachment: (Object | Link | PropertyValue | URL)[] = []; - #_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment: Set = new Set(); + #_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment: VocabTrustSet = new Set(); #_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: Set = new Set(); + #_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: VocabTrustSet = new Set(); #_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience: (Object | URL)[] = []; - #_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience: Set = new Set(); + #_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience: VocabTrustSet = new Set(); #_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content: ((string | LanguageString))[] = []; #_3mhZzGXSpQ431mBSz2kvych22v4e_context: (Object | Link | URL)[] = []; - #_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context: Set = new Set(); + #_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context: VocabTrustSet = new Set(); #_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name: ((string | LanguageString))[] = []; #_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime: (Temporal.Instant)[] = []; #_86xFhmgBapoMvYqjbjRuDPayTrS_generator: (Object | Link | URL)[] = []; - #_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator: Set = new Set(); + #_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator: VocabTrustSet = new Set(); #_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon: (Image | URL)[] = []; - #_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon: Set = new Set(); + #_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon: VocabTrustSet = new Set(); #_3dXrUdkARxwyJLtJcYi1AJ92H41U_image: (Image | URL)[] = []; - #_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image: Set = new Set(); + #_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image: VocabTrustSet = new Set(); #_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo: (Object | Link | URL)[] = []; - #_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo: Set = new Set(); + #_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo: VocabTrustSet = new Set(); #_31k5MUZJsnsPNg8dQQJieWaXTFnR_location: (Object | Link | URL)[] = []; - #_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location: Set = new Set(); + #_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location: VocabTrustSet = new Set(); #_gCVTegXxWWCw6wWRxa1QF65zusg_preview: (Link | Object | URL)[] = []; - #_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: Set = new Set(); + #_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: VocabTrustSet = new Set(); #_5e258TDXtuhaFRPZiGoDfEpjdMr_published: (Temporal.Instant)[] = []; #_7UpwM3JWcXhADcscukEehBorf6k_replies: (Collection | URL)[] = []; - #_trust_7UpwM3JWcXhADcscukEehBorf6k_replies: Set = new Set(); + #_trust_7UpwM3JWcXhADcscukEehBorf6k_replies: VocabTrustSet = new Set(); #_3kAfck9PcEYt2L7xug5y99YPbANs_shares: (Collection | URL)[] = []; - #_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares: Set = new Set(); + #_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares: VocabTrustSet = new Set(); #_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes: (Collection | URL)[] = []; - #_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes: Set = new Set(); + #_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes: VocabTrustSet = new Set(); #_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: (Collection | URL)[] = []; - #_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: Set = new Set(); + #_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: VocabTrustSet = new Set(); #_2w3Jmue4up8iVDUA51WZqomEF438_startTime: (Temporal.Instant)[] = []; #_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary: ((string | LanguageString))[] = []; #_5chuqj6s95p5gg2sk1HntGfarRf_tag: (Object | Link | URL)[] = []; - #_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag: Set = new Set(); + #_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag: VocabTrustSet = new Set(); #_385aB7ySixcf5Un6z3VsWmThgCzQ_updated: (Temporal.Instant)[] = []; #_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url: ((URL | Link))[] = []; #_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to: (Object | URL)[] = []; - #_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to: Set = new Set(); + #_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to: VocabTrustSet = new Set(); #_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto: (Object | URL)[] = []; - #_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto: Set = new Set(); + #_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto: VocabTrustSet = new Set(); #_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc: (Object | URL)[] = []; - #_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc: Set = new Set(); + #_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc: VocabTrustSet = new Set(); #_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc: (Object | URL)[] = []; - #_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc: Set = new Set(); + #_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc: VocabTrustSet = new Set(); #_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType: (string)[] = []; #_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration: (Temporal.Duration)[] = []; #_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive: (boolean)[] = []; #_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source: (Source)[] = []; #_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: (DataIntegrityProof | URL)[] = []; - #_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: Set = new Set(); + #_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: VocabTrustSet = new Set(); #_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy: (InteractionPolicy)[] = []; #_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy: (URL)[] = []; #_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: (LikeAuthorization | URL)[] = []; - #_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: Set = new Set(); + #_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: VocabTrustSet = new Set(); #_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: (ReplyAuthorization | URL)[] = []; - #_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: Set = new Set(); + #_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: VocabTrustSet = new Set(); #_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: (AnnounceAuthorization | URL)[] = []; - #_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: Set = new Set(); + #_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: VocabTrustSet = new Set(); #_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations: (Translation)[] = []; #_2rzkBRS4gNPrkJk9DohHAMUAxA2d: (URL)[] = []; @@ -382,14 +670,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu if ("attachments" in values && values.attachments != null) { - if (Array.isArray(values.attachments) && - values.attachments.every(v => v instanceof Object || v instanceof Link || v instanceof PropertyValue || v instanceof URL)) { + let copied!: (Object | Link | PropertyValue | URL)[]; + let valid = false; + if (Array.isArray(values.attachments)) { + const array = values.attachments; + const test = (v: Object | Link | PropertyValue | URL): boolean => v instanceof Object || v instanceof Link || v instanceof PropertyValue || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.attachments; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = values.attachments.slice(); + this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = copied; - for (let i = 0; i < values.attachments.length; i++) { - this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.add(i); - } + vocabSetTrustPrefix(this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment, this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.length); } else { throw new TypeError( @@ -422,14 +732,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.attributions) && - values.attributions.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.attributions)) { + const array = values.attributions; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.attributions; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = values.attributions.slice(); + this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = copied; - for (let i = 0; i < values.attributions.length; i++) { - this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.add(i); - } + vocabSetTrustPrefix(this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo, this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length); } else { throw new TypeError( @@ -462,14 +794,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.audiences) && - values.audiences.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.audiences)) { + const array = values.audiences; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.audiences; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = values.audiences.slice(); + this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = copied; - for (let i = 0; i < values.audiences.length; i++) { - this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.add(i); - } + vocabSetTrustPrefix(this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience, this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length); } else { throw new TypeError( @@ -502,10 +856,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.contents) && - values.contents.every(v => typeof v === "string" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.contents)) { + const array = values.contents; + const test = (v: string | LanguageString): boolean => typeof v === "string" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.contents; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = values.contents.slice(); + this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = copied; } else { throw new TypeError( @@ -517,14 +895,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu if ("contexts" in values && values.contexts != null) { - if (Array.isArray(values.contexts) && - values.contexts.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.contexts)) { + const array = values.contexts; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.contexts; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = values.contexts.slice(); + this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = copied; - for (let i = 0; i < values.contexts.length; i++) { - this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context.add(i); - } + vocabSetTrustPrefix(this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context, this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context.length); } else { throw new TypeError( @@ -557,10 +957,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.names) && - values.names.every(v => typeof v === "string" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.names)) { + const array = values.names; + const test = (v: string | LanguageString): boolean => typeof v === "string" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.names; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = values.names.slice(); + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = copied; } else { throw new TypeError( @@ -585,14 +1009,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu if ("generators" in values && values.generators != null) { - if (Array.isArray(values.generators) && - values.generators.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.generators)) { + const array = values.generators; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.generators; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = values.generators.slice(); + this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = copied; - for (let i = 0; i < values.generators.length; i++) { - this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator.add(i); - } + vocabSetTrustPrefix(this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator, this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator.length); } else { throw new TypeError( @@ -625,14 +1071,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.icons) && - values.icons.every(v => v instanceof Image || v instanceof URL)) { + let copied!: (Image | URL)[]; + let valid = false; + if (Array.isArray(values.icons)) { + const array = values.icons; + const test = (v: Image | URL): boolean => v instanceof Image || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.icons; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = values.icons.slice(); + this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = copied; - for (let i = 0; i < values.icons.length; i++) { - this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.add(i); - } + vocabSetTrustPrefix(this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon, this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length); } else { throw new TypeError( @@ -665,14 +1133,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.images) && - values.images.every(v => v instanceof Image || v instanceof URL)) { + let copied!: (Image | URL)[]; + let valid = false; + if (Array.isArray(values.images)) { + const array = values.images; + const test = (v: Image | URL): boolean => v instanceof Image || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.images; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = values.images.slice(); + this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = copied; - for (let i = 0; i < values.images.length; i++) { - this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.add(i); - } + vocabSetTrustPrefix(this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image, this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length); } else { throw new TypeError( @@ -705,14 +1195,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.replyTargets) && - values.replyTargets.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.replyTargets)) { + const array = values.replyTargets; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.replyTargets; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = values.replyTargets.slice(); + this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = copied; - for (let i = 0; i < values.replyTargets.length; i++) { - this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.add(i); - } + vocabSetTrustPrefix(this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo, this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length); } else { throw new TypeError( @@ -745,14 +1257,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.locations) && - values.locations.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.locations)) { + const array = values.locations; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.locations; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = values.locations.slice(); + this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = copied; - for (let i = 0; i < values.locations.length; i++) { - this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.add(i); - } + vocabSetTrustPrefix(this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location, this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length); } else { throw new TypeError( @@ -785,14 +1319,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.previews) && - values.previews.every(v => v instanceof Link || v instanceof Object || v instanceof URL)) { + let copied!: (Link | Object | URL)[]; + let valid = false; + if (Array.isArray(values.previews)) { + const array = values.previews; + const test = (v: Link | Object | URL): boolean => v instanceof Link || v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.previews; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = values.previews.slice(); + this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = copied; - for (let i = 0; i < values.previews.length; i++) { - this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.add(i); - } + vocabSetTrustPrefix(this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length); } else { throw new TypeError( @@ -903,10 +1459,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.summaries) && - values.summaries.every(v => typeof v === "string" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.summaries)) { + const array = values.summaries; + const test = (v: string | LanguageString): boolean => typeof v === "string" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.summaries; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = values.summaries.slice(); + this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = copied; } else { throw new TypeError( @@ -918,14 +1498,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu if ("tags" in values && values.tags != null) { - if (Array.isArray(values.tags) && - values.tags.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.tags)) { + const array = values.tags; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.tags; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = values.tags.slice(); + this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = copied; - for (let i = 0; i < values.tags.length; i++) { - this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.add(i); - } + vocabSetTrustPrefix(this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag, this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag.length); } else { throw new TypeError( @@ -971,10 +1573,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.urls) && - values.urls.every(v => v instanceof URL || v instanceof Link)) { + let copied!: (URL | Link)[]; + let valid = false; + if (Array.isArray(values.urls)) { + const array = values.urls; + const test = (v: URL | Link): boolean => v instanceof URL || v instanceof Link; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.urls; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls.slice(); + this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = copied; } else { throw new TypeError( @@ -1007,14 +1633,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.tos) && - values.tos.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.tos)) { + const array = values.tos; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.tos; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = values.tos.slice(); + this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = copied; - for (let i = 0; i < values.tos.length; i++) { - this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.add(i); - } + vocabSetTrustPrefix(this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to, this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length); } else { throw new TypeError( @@ -1047,14 +1695,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.btos) && - values.btos.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.btos)) { + const array = values.btos; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.btos; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = values.btos.slice(); + this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = copied; - for (let i = 0; i < values.btos.length; i++) { - this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.add(i); - } + vocabSetTrustPrefix(this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto, this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length); } else { throw new TypeError( @@ -1087,14 +1757,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.ccs) && - values.ccs.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.ccs)) { + const array = values.ccs; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.ccs; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = values.ccs.slice(); + this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = copied; - for (let i = 0; i < values.ccs.length; i++) { - this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.add(i); - } + vocabSetTrustPrefix(this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc, this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length); } else { throw new TypeError( @@ -1127,14 +1819,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.bccs) && - values.bccs.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.bccs)) { + const array = values.bccs; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.bccs; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = values.bccs.slice(); + this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = copied; - for (let i = 0; i < values.bccs.length; i++) { - this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.add(i); - } + vocabSetTrustPrefix(this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc, this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length); } else { throw new TypeError( @@ -1219,14 +1933,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.proofs) && - values.proofs.every(v => v instanceof DataIntegrityProof || v instanceof URL)) { + let copied!: (DataIntegrityProof | URL)[]; + let valid = false; + if (Array.isArray(values.proofs)) { + const array = values.proofs; + const test = (v: DataIntegrityProof | URL): boolean => v instanceof DataIntegrityProof || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.proofs; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = values.proofs.slice(); + this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = copied; - for (let i = 0; i < values.proofs.length; i++) { - this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.add(i); - } + vocabSetTrustPrefix(this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof, this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length); } else { throw new TypeError( @@ -1303,10 +2039,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu if ("translations" in values && values.translations != null) { - if (Array.isArray(values.translations) && - values.translations.every(v => v instanceof Translation)) { + let copied!: (Translation)[]; + let valid = false; + if (Array.isArray(values.translations)) { + const array = values.translations; + const test = (v: Translation): boolean => v instanceof Translation; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.translations; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = values.translations.slice(); + this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = copied; } else { throw new TypeError( @@ -1318,10 +2078,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu if ("licenses" in values && values.licenses != null) { - if (Array.isArray(values.licenses) && - values.licenses.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.licenses)) { + const array = values.licenses; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.licenses; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = values.licenses.slice(); + this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = copied; } else { throw new TypeError( @@ -1343,8 +2127,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Object.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -1403,18 +2187,43 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu options ); copyPortableProvenance(this, clone); - clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.slice();clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment = new Set(this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment); + clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.length < vocabSparseArrayMinimumLength + ? this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.slice() : vocabCopyPropertyArray(this.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment);clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment = vocabCopyTrustSet( + this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment, clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment, + ); if ("attachments" in values && values.attachments != null) { - if (Array.isArray(values.attachments) && - values.attachments.every(v => v instanceof Object || v instanceof Link || v instanceof PropertyValue || v instanceof URL)) { + let copied!: (Object | Link | PropertyValue | URL)[]; + let valid = false; + if (Array.isArray(values.attachments)) { + const array = values.attachments; + const test = (v: Object | Link | PropertyValue | URL): boolean => v instanceof Object || v instanceof Link || v instanceof PropertyValue || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.attachments; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = values.attachments.slice(); + clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = copied; clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment = new Set(); - for (let i = 0; i < values.attachments.length; i++) { - clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.add(i); - } + vocabSetTrustPrefix(clone.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment, clone.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.length); } else { throw new TypeError( @@ -1423,12 +2232,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.slice();clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = new Set(this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo); + clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length < vocabSparseArrayMinimumLength + ? this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.slice() : vocabCopyPropertyArray(this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo);clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = vocabCopyTrustSet( + this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo, clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo, + ); if ("attribution" in values && values.attribution != null) { if (values.attribution instanceof Application || values.attribution instanceof Group || values.attribution instanceof Organization || values.attribution instanceof Person || values.attribution instanceof Service || values.attribution instanceof URL) { // @ts-ignore: type is checked above. clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = [values.attribution]; - clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = new Set([0]); + clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = new Set(); + clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[vocabTrustPrefix] = 1; } else { throw new TypeError( "The attribution must be of type " + @@ -1447,15 +2260,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.attributions) && - values.attributions.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.attributions)) { + const array = values.attributions; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.attributions; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = values.attributions.slice(); + clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = copied; clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = new Set(); - for (let i = 0; i < values.attributions.length; i++) { - clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.add(i); - } + vocabSetTrustPrefix(clone.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo, clone.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length); } else { throw new TypeError( @@ -1464,12 +2299,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.slice();clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = new Set(this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience); + clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length < vocabSparseArrayMinimumLength + ? this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.slice() : vocabCopyPropertyArray(this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience);clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = vocabCopyTrustSet( + this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience, clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience, + ); if ("audience" in values && values.audience != null) { if (values.audience instanceof Object || values.audience instanceof URL) { // @ts-ignore: type is checked above. clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = [values.audience]; - clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = new Set([0]); + clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = new Set(); + clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[vocabTrustPrefix] = 1; } else { throw new TypeError( "The audience must be of type " + @@ -1488,15 +2327,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.audiences) && - values.audiences.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.audiences)) { + const array = values.audiences; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.audiences; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = values.audiences.slice(); + clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = copied; clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience = new Set(); - for (let i = 0; i < values.audiences.length; i++) { - clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience, clone.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length); } else { throw new TypeError( @@ -1505,7 +2366,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.slice(); + clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length < vocabSparseArrayMinimumLength + ? this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.slice() : vocabCopyPropertyArray(this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content); if ("content" in values && values.content != null) { if (typeof values.content === "string" || values.content instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -1529,10 +2391,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.contents) && - values.contents.every(v => typeof v === "string" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.contents)) { + const array = values.contents; + const test = (v: string | LanguageString): boolean => typeof v === "string" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.contents; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = values.contents.slice(); + clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = copied; } else { throw new TypeError( @@ -1541,18 +2427,43 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context.slice();clone.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context = new Set(this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context); + clone.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context.length < vocabSparseArrayMinimumLength + ? this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context.slice() : vocabCopyPropertyArray(this.#_3mhZzGXSpQ431mBSz2kvych22v4e_context);clone.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context = vocabCopyTrustSet( + this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context, clone.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context, + ); if ("contexts" in values && values.contexts != null) { - if (Array.isArray(values.contexts) && - values.contexts.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.contexts)) { + const array = values.contexts; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.contexts; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = values.contexts.slice(); + clone.#_3mhZzGXSpQ431mBSz2kvych22v4e_context = copied; clone.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context = new Set(); - for (let i = 0; i < values.contexts.length; i++) { - clone.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context, clone.#_3mhZzGXSpQ431mBSz2kvych22v4e_context.length); } else { throw new TypeError( @@ -1561,7 +2472,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.slice(); + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length < vocabSparseArrayMinimumLength + ? this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.slice() : vocabCopyPropertyArray(this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name); if ("name" in values && values.name != null) { if (typeof values.name === "string" || values.name instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -1585,10 +2497,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.names) && - values.names.every(v => typeof v === "string" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.names)) { + const array = values.names; + const test = (v: string | LanguageString): boolean => typeof v === "string" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.names; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = values.names.slice(); + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = copied; } else { throw new TypeError( @@ -1597,7 +2533,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime.slice(); + clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime.length < vocabSparseArrayMinimumLength + ? this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime.slice() : vocabCopyPropertyArray(this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime); if ("endTime" in values && values.endTime != null) { if (isTemporalInstant(values.endTime)) { // @ts-ignore: type is checked above. @@ -1610,18 +2547,43 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator.slice();clone.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator = new Set(this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator); + clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator.length < vocabSparseArrayMinimumLength + ? this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator.slice() : vocabCopyPropertyArray(this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator);clone.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator = vocabCopyTrustSet( + this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator, clone.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator, + ); if ("generators" in values && values.generators != null) { - if (Array.isArray(values.generators) && - values.generators.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.generators)) { + const array = values.generators; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.generators; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = values.generators.slice(); + clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = copied; clone.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator = new Set(); - for (let i = 0; i < values.generators.length; i++) { - clone.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator.add(i); - } + vocabSetTrustPrefix(clone.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator, clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator.length); } else { throw new TypeError( @@ -1630,12 +2592,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.slice();clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = new Set(this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon); + clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length < vocabSparseArrayMinimumLength + ? this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.slice() : vocabCopyPropertyArray(this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon);clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = vocabCopyTrustSet( + this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon, clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon, + ); if ("icon" in values && values.icon != null) { if (values.icon instanceof Image || values.icon instanceof URL) { // @ts-ignore: type is checked above. clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = [values.icon]; - clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = new Set([0]); + clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = new Set(); + clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[vocabTrustPrefix] = 1; } else { throw new TypeError( "The icon must be of type " + @@ -1654,15 +2620,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.icons) && - values.icons.every(v => v instanceof Image || v instanceof URL)) { + let copied!: (Image | URL)[]; + let valid = false; + if (Array.isArray(values.icons)) { + const array = values.icons; + const test = (v: Image | URL): boolean => v instanceof Image || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.icons; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = values.icons.slice(); + clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = copied; clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = new Set(); - for (let i = 0; i < values.icons.length; i++) { - clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.add(i); - } + vocabSetTrustPrefix(clone.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon, clone.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length); } else { throw new TypeError( @@ -1671,12 +2659,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.slice();clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = new Set(this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image); + clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length < vocabSparseArrayMinimumLength + ? this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.slice() : vocabCopyPropertyArray(this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image);clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = vocabCopyTrustSet( + this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image, clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image, + ); if ("image" in values && values.image != null) { if (values.image instanceof Image || values.image instanceof URL) { // @ts-ignore: type is checked above. clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = [values.image]; - clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = new Set([0]); + clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = new Set(); + clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[vocabTrustPrefix] = 1; } else { throw new TypeError( "The image must be of type " + @@ -1695,15 +2687,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.images) && - values.images.every(v => v instanceof Image || v instanceof URL)) { + let copied!: (Image | URL)[]; + let valid = false; + if (Array.isArray(values.images)) { + const array = values.images; + const test = (v: Image | URL): boolean => v instanceof Image || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.images; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = values.images.slice(); + clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = copied; clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = new Set(); - for (let i = 0; i < values.images.length; i++) { - clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image, clone.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length); } else { throw new TypeError( @@ -1712,12 +2726,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.slice();clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = new Set(this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo); + clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length < vocabSparseArrayMinimumLength + ? this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.slice() : vocabCopyPropertyArray(this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo);clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = vocabCopyTrustSet( + this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo, clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo, + ); if ("replyTarget" in values && values.replyTarget != null) { if (values.replyTarget instanceof Object || values.replyTarget instanceof Link || values.replyTarget instanceof URL) { // @ts-ignore: type is checked above. clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = [values.replyTarget]; - clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = new Set([0]); + clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = new Set(); + clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[vocabTrustPrefix] = 1; } else { throw new TypeError( "The replyTarget must be of type " + @@ -1736,15 +2754,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.replyTargets) && - values.replyTargets.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.replyTargets)) { + const array = values.replyTargets; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.replyTargets; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = values.replyTargets.slice(); + clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = copied; clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = new Set(); - for (let i = 0; i < values.replyTargets.length; i++) { - clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo, clone.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length); } else { throw new TypeError( @@ -1753,12 +2793,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.slice();clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = new Set(this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location); + clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length < vocabSparseArrayMinimumLength + ? this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.slice() : vocabCopyPropertyArray(this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location);clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = vocabCopyTrustSet( + this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location, clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location, + ); if ("location" in values && values.location != null) { if (values.location instanceof Object || values.location instanceof Link || values.location instanceof URL) { // @ts-ignore: type is checked above. clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = [values.location]; - clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = new Set([0]); + clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = new Set(); + clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[vocabTrustPrefix] = 1; } else { throw new TypeError( "The location must be of type " + @@ -1777,15 +2821,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.locations) && - values.locations.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.locations)) { + const array = values.locations; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.locations; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = values.locations.slice(); + clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = copied; clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = new Set(); - for (let i = 0; i < values.locations.length; i++) { - clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.add(i); - } + vocabSetTrustPrefix(clone.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location, clone.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length); } else { throw new TypeError( @@ -1794,12 +2860,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.slice();clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = new Set(this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview); + clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length < vocabSparseArrayMinimumLength + ? this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.slice() : vocabCopyPropertyArray(this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview);clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = vocabCopyTrustSet( + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, + ); if ("preview" in values && values.preview != null) { if (values.preview instanceof Link || values.preview instanceof Object || values.preview instanceof URL) { // @ts-ignore: type is checked above. clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = [values.preview]; - clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = new Set([0]); + clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = new Set(); + clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview[vocabTrustPrefix] = 1; } else { throw new TypeError( "The preview must be of type " + @@ -1818,15 +2888,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.previews) && - values.previews.every(v => v instanceof Link || v instanceof Object || v instanceof URL)) { + let copied!: (Link | Object | URL)[]; + let valid = false; + if (Array.isArray(values.previews)) { + const array = values.previews; + const test = (v: Link | Object | URL): boolean => v instanceof Link || v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.previews; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = values.previews.slice(); + clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = copied; clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = new Set(); - for (let i = 0; i < values.previews.length; i++) { - clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.add(i); - } + vocabSetTrustPrefix(clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length); } else { throw new TypeError( @@ -1835,7 +2927,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published.slice(); + clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published.length < vocabSparseArrayMinimumLength + ? this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published.slice() : vocabCopyPropertyArray(this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published); if ("published" in values && values.published != null) { if (isTemporalInstant(values.published)) { // @ts-ignore: type is checked above. @@ -1848,12 +2941,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_7UpwM3JWcXhADcscukEehBorf6k_replies = this.#_7UpwM3JWcXhADcscukEehBorf6k_replies.slice();clone.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies = new Set(this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies); + clone.#_7UpwM3JWcXhADcscukEehBorf6k_replies = this.#_7UpwM3JWcXhADcscukEehBorf6k_replies.length < vocabSparseArrayMinimumLength + ? this.#_7UpwM3JWcXhADcscukEehBorf6k_replies.slice() : vocabCopyPropertyArray(this.#_7UpwM3JWcXhADcscukEehBorf6k_replies);clone.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies = vocabCopyTrustSet( + this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies, clone.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies, + ); if ("replies" in values && values.replies != null) { if (values.replies instanceof Collection || values.replies instanceof URL) { // @ts-ignore: type is checked above. clone.#_7UpwM3JWcXhADcscukEehBorf6k_replies = [values.replies]; - clone.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies = new Set([0]); + clone.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies = new Set(); + clone.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies[vocabTrustPrefix] = 1; } else { throw new TypeError( "The replies must be of type " + @@ -1861,12 +2958,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares = this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares.slice();clone.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares = new Set(this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares); + clone.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares = this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares.length < vocabSparseArrayMinimumLength + ? this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares.slice() : vocabCopyPropertyArray(this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares);clone.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares = vocabCopyTrustSet( + this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares, clone.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares, + ); if ("shares" in values && values.shares != null) { if (values.shares instanceof Collection || values.shares instanceof URL) { // @ts-ignore: type is checked above. clone.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares = [values.shares]; - clone.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares = new Set([0]); + clone.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares = new Set(); + clone.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares[vocabTrustPrefix] = 1; } else { throw new TypeError( "The shares must be of type " + @@ -1874,12 +2975,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.slice();clone.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = new Set(this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes); + clone.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.length < vocabSparseArrayMinimumLength + ? this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.slice() : vocabCopyPropertyArray(this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes);clone.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = vocabCopyTrustSet( + this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes, clone.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes, + ); if ("likes" in values && values.likes != null) { if (values.likes instanceof Collection || values.likes instanceof URL) { // @ts-ignore: type is checked above. clone.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = [values.likes]; - clone.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = new Set([0]); + clone.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = new Set(); + clone.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[vocabTrustPrefix] = 1; } else { throw new TypeError( "The likes must be of type " + @@ -1887,12 +2992,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.slice();clone.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = new Set(this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions); + clone.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.length < vocabSparseArrayMinimumLength + ? this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.slice() : vocabCopyPropertyArray(this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions);clone.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = vocabCopyTrustSet( + this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions, clone.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions, + ); if ("emojiReactions" in values && values.emojiReactions != null) { if (values.emojiReactions instanceof Collection || values.emojiReactions instanceof URL) { // @ts-ignore: type is checked above. clone.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = [values.emojiReactions]; - clone.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = new Set([0]); + clone.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = new Set(); + clone.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[vocabTrustPrefix] = 1; } else { throw new TypeError( "The emojiReactions must be of type " + @@ -1900,7 +3009,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime.slice(); + clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime.length < vocabSparseArrayMinimumLength + ? this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime.slice() : vocabCopyPropertyArray(this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime); if ("startTime" in values && values.startTime != null) { if (isTemporalInstant(values.startTime)) { // @ts-ignore: type is checked above. @@ -1913,7 +3023,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.slice(); + clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.length < vocabSparseArrayMinimumLength + ? this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary.slice() : vocabCopyPropertyArray(this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary); if ("summary" in values && values.summary != null) { if (typeof values.summary === "string" || values.summary instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -1937,10 +3048,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.summaries) && - values.summaries.every(v => typeof v === "string" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.summaries)) { + const array = values.summaries; + const test = (v: string | LanguageString): boolean => typeof v === "string" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.summaries; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = values.summaries.slice(); + clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = copied; } else { throw new TypeError( @@ -1949,18 +3084,43 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag.slice();clone.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag = new Set(this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag); + clone.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag.length < vocabSparseArrayMinimumLength + ? this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag.slice() : vocabCopyPropertyArray(this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag);clone.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag = vocabCopyTrustSet( + this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag, clone.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag, + ); if ("tags" in values && values.tags != null) { - if (Array.isArray(values.tags) && - values.tags.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.tags)) { + const array = values.tags; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.tags; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = values.tags.slice(); + clone.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = copied; clone.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag = new Set(); - for (let i = 0; i < values.tags.length; i++) { - clone.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.add(i); - } + vocabSetTrustPrefix(clone.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag, clone.#_5chuqj6s95p5gg2sk1HntGfarRf_tag.length); } else { throw new TypeError( @@ -1969,7 +3129,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated.slice(); + clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated.length < vocabSparseArrayMinimumLength + ? this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated.slice() : vocabCopyPropertyArray(this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated); if ("updated" in values && values.updated != null) { if (isTemporalInstant(values.updated)) { // @ts-ignore: type is checked above. @@ -1982,7 +3143,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.slice(); + clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length < vocabSparseArrayMinimumLength + ? this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.slice() : vocabCopyPropertyArray(this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url); if ("url" in values && values.url != null) { if (values.url instanceof URL || values.url instanceof Link) { // @ts-ignore: type is checked above. @@ -2006,10 +3168,34 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.urls) && - values.urls.every(v => v instanceof URL || v instanceof Link)) { + let copied!: (URL | Link)[]; + let valid = false; + if (Array.isArray(values.urls)) { + const array = values.urls; + const test = (v: URL | Link): boolean => v instanceof URL || v instanceof Link; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.urls; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls.slice(); + clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = copied; } else { throw new TypeError( @@ -2018,12 +3204,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.slice();clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = new Set(this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to); + clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length < vocabSparseArrayMinimumLength + ? this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.slice() : vocabCopyPropertyArray(this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to);clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = vocabCopyTrustSet( + this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to, clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to, + ); if ("to" in values && values.to != null) { if (values.to instanceof Object || values.to instanceof URL) { // @ts-ignore: type is checked above. clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = [values.to]; - clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = new Set([0]); + clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = new Set(); + clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[vocabTrustPrefix] = 1; } else { throw new TypeError( "The to must be of type " + @@ -2042,15 +3232,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.tos) && - values.tos.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.tos)) { + const array = values.tos; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.tos; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = values.tos.slice(); + clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = copied; clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = new Set(); - for (let i = 0; i < values.tos.length; i++) { - clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to, clone.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length); } else { throw new TypeError( @@ -2059,12 +3271,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.slice();clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = new Set(this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto); + clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length < vocabSparseArrayMinimumLength + ? this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.slice() : vocabCopyPropertyArray(this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto);clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = vocabCopyTrustSet( + this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto, clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto, + ); if ("bto" in values && values.bto != null) { if (values.bto instanceof Object || values.bto instanceof URL) { // @ts-ignore: type is checked above. clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = [values.bto]; - clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = new Set([0]); + clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = new Set(); + clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[vocabTrustPrefix] = 1; } else { throw new TypeError( "The bto must be of type " + @@ -2083,15 +3299,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.btos) && - values.btos.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.btos)) { + const array = values.btos; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.btos; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = values.btos.slice(); + clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = copied; clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = new Set(); - for (let i = 0; i < values.btos.length; i++) { - clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.add(i); - } + vocabSetTrustPrefix(clone.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto, clone.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length); } else { throw new TypeError( @@ -2100,12 +3338,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.slice();clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = new Set(this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc); + clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length < vocabSparseArrayMinimumLength + ? this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.slice() : vocabCopyPropertyArray(this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc);clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = vocabCopyTrustSet( + this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc, clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc, + ); if ("cc" in values && values.cc != null) { if (values.cc instanceof Object || values.cc instanceof URL) { // @ts-ignore: type is checked above. clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = [values.cc]; - clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = new Set([0]); + clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = new Set(); + clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[vocabTrustPrefix] = 1; } else { throw new TypeError( "The cc must be of type " + @@ -2124,15 +3366,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.ccs) && - values.ccs.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.ccs)) { + const array = values.ccs; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.ccs; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = values.ccs.slice(); + clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = copied; clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = new Set(); - for (let i = 0; i < values.ccs.length; i++) { - clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.add(i); - } + vocabSetTrustPrefix(clone.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc, clone.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length); } else { throw new TypeError( @@ -2141,12 +3405,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.slice();clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = new Set(this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc); + clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length < vocabSparseArrayMinimumLength + ? this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.slice() : vocabCopyPropertyArray(this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc);clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = vocabCopyTrustSet( + this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc, clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc, + ); if ("bcc" in values && values.bcc != null) { if (values.bcc instanceof Object || values.bcc instanceof URL) { // @ts-ignore: type is checked above. clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = [values.bcc]; - clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = new Set([0]); + clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = new Set(); + clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[vocabTrustPrefix] = 1; } else { throw new TypeError( "The bcc must be of type " + @@ -2165,15 +3433,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.bccs) && - values.bccs.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.bccs)) { + const array = values.bccs; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.bccs; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = values.bccs.slice(); + clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = copied; clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc = new Set(); - for (let i = 0; i < values.bccs.length; i++) { - clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc, clone.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length); } else { throw new TypeError( @@ -2182,7 +3472,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.slice(); + clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.length < vocabSparseArrayMinimumLength + ? this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.slice() : vocabCopyPropertyArray(this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType); if ("mediaType" in values && values.mediaType != null) { if (typeof values.mediaType === "string") { // @ts-ignore: type is checked above. @@ -2195,7 +3486,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration.slice(); + clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration.length < vocabSparseArrayMinimumLength + ? this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration.slice() : vocabCopyPropertyArray(this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration); if ("duration" in values && values.duration != null) { if (isTemporalDuration(values.duration)) { // @ts-ignore: type is checked above. @@ -2208,7 +3500,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive.slice(); + clone.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive.length < vocabSparseArrayMinimumLength + ? this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive.slice() : vocabCopyPropertyArray(this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive); if ("sensitive" in values && values.sensitive != null) { if (typeof values.sensitive === "boolean") { // @ts-ignore: type is checked above. @@ -2221,7 +3514,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.slice(); + clone.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.length < vocabSparseArrayMinimumLength + ? this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.slice() : vocabCopyPropertyArray(this.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source); if ("source" in values && values.source != null) { if (values.source instanceof Source) { // @ts-ignore: type is checked above. @@ -2234,12 +3528,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.slice();clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = new Set(this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof); + clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length < vocabSparseArrayMinimumLength + ? this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.slice() : vocabCopyPropertyArray(this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof);clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = vocabCopyTrustSet( + this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof, clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof, + ); if ("proof" in values && values.proof != null) { if (values.proof instanceof DataIntegrityProof || values.proof instanceof URL) { // @ts-ignore: type is checked above. clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = [values.proof]; - clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = new Set([0]); + clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = new Set(); + clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[vocabTrustPrefix] = 1; } else { throw new TypeError( "The proof must be of type " + @@ -2258,15 +3556,37 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } - if (Array.isArray(values.proofs) && - values.proofs.every(v => v instanceof DataIntegrityProof || v instanceof URL)) { + let copied!: (DataIntegrityProof | URL)[]; + let valid = false; + if (Array.isArray(values.proofs)) { + const array = values.proofs; + const test = (v: DataIntegrityProof | URL): boolean => v instanceof DataIntegrityProof || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.proofs; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = values.proofs.slice(); + clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = copied; clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof = new Set(); - for (let i = 0; i < values.proofs.length; i++) { - clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.add(i); - } + vocabSetTrustPrefix(clone.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof, clone.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length); } else { throw new TypeError( @@ -2275,7 +3595,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy = this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.slice(); + clone.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy = this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.length < vocabSparseArrayMinimumLength + ? this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.slice() : vocabCopyPropertyArray(this.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy); if ("interactionPolicy" in values && values.interactionPolicy != null) { if (values.interactionPolicy instanceof InteractionPolicy) { // @ts-ignore: type is checked above. @@ -2288,7 +3609,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.slice(); + clone.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.length < vocabSparseArrayMinimumLength + ? this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.slice() : vocabCopyPropertyArray(this.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy); if ("approvedBy" in values && values.approvedBy != null) { if (values.approvedBy instanceof URL) { // @ts-ignore: type is checked above. @@ -2301,12 +3623,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.slice();clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = new Set(this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization); + clone.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.slice() : vocabCopyPropertyArray(this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization);clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = vocabCopyTrustSet( + this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization, clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization, + ); if ("likeAuthorization" in values && values.likeAuthorization != null) { if (values.likeAuthorization instanceof LikeAuthorization || values.likeAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = [values.likeAuthorization]; - clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = new Set([0]); + clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = new Set(); + clone.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( "The likeAuthorization must be of type " + @@ -2314,12 +3640,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.slice();clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = new Set(this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization); + clone.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.slice() : vocabCopyPropertyArray(this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization);clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = vocabCopyTrustSet( + this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization, clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization, + ); if ("replyAuthorization" in values && values.replyAuthorization != null) { if (values.replyAuthorization instanceof ReplyAuthorization || values.replyAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = [values.replyAuthorization]; - clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = new Set([0]); + clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = new Set(); + clone.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( "The replyAuthorization must be of type " + @@ -2327,12 +3657,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.slice();clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = new Set(this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization); + clone.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.slice() : vocabCopyPropertyArray(this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization);clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = vocabCopyTrustSet( + this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization, clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization, + ); if ("announceAuthorization" in values && values.announceAuthorization != null) { if (values.announceAuthorization instanceof AnnounceAuthorization || values.announceAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = [values.announceAuthorization]; - clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = new Set([0]); + clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization = new Set(); + clone.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( "The announceAuthorization must be of type " + @@ -2340,13 +3674,38 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.slice(); + clone.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.length < vocabSparseArrayMinimumLength + ? this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.slice() : vocabCopyPropertyArray(this.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations); if ("translations" in values && values.translations != null) { - if (Array.isArray(values.translations) && - values.translations.every(v => v instanceof Translation)) { + let copied!: (Translation)[]; + let valid = false; + if (Array.isArray(values.translations)) { + const array = values.translations; + const test = (v: Translation): boolean => v instanceof Translation; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.translations; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = values.translations.slice(); + clone.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations = copied; } else { throw new TypeError( @@ -2355,13 +3714,38 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.slice(); + clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.length < vocabSparseArrayMinimumLength + ? this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.slice() : vocabCopyPropertyArray(this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d); if ("licenses" in values && values.licenses != null) { - if (Array.isArray(values.licenses) && - values.licenses.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.licenses)) { + const array = values.licenses; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.licenses; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = values.licenses.slice(); + clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = copied; } else { throw new TypeError( @@ -2373,7 +3757,733 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Object { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Object; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Object; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment.length; i++) { + const value = node.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment[i]; + if (value != null && typeof value === "object") { + node.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment[i] = context.value(value); + } + } + } + } + + { + const array = node.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.length; i++) { + const value = node.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[i]; + if (value != null && typeof value === "object") { + node.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.length; i++) { + const value = node.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[i]; + if (value != null && typeof value === "object") { + node.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3mhZzGXSpQ431mBSz2kvych22v4e_context; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3mhZzGXSpQ431mBSz2kvych22v4e_context.length; i++) { + const value = node.#_3mhZzGXSpQ431mBSz2kvych22v4e_context[i]; + if (value != null && typeof value === "object") { + node.#_3mhZzGXSpQ431mBSz2kvych22v4e_context[i] = context.value(value); + } + } + } + } + + { + const array = node.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator.length; i++) { + const value = node.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator[i]; + if (value != null && typeof value === "object") { + node.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator[i] = context.value(value); + } + } + } + } + + { + const array = node.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.length; i++) { + const value = node.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[i]; + if (value != null && typeof value === "object") { + node.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.length; i++) { + const value = node.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[i]; + if (value != null && typeof value === "object") { + node.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.length; i++) { + const value = node.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[i]; + if (value != null && typeof value === "object") { + node.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.length; i++) { + const value = node.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[i]; + if (value != null && typeof value === "object") { + node.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[i] = context.value(value); + } + } + } + } + + { + const array = node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length; i++) { + const value = node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview[i]; + if (value != null && typeof value === "object") { + node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview[i] = context.value(value); + } + } + } + } + + { + const array = node.#_7UpwM3JWcXhADcscukEehBorf6k_replies; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_7UpwM3JWcXhADcscukEehBorf6k_replies.length; i++) { + const value = node.#_7UpwM3JWcXhADcscukEehBorf6k_replies[i]; + if (value != null && typeof value === "object") { + node.#_7UpwM3JWcXhADcscukEehBorf6k_replies[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares.length; i++) { + const value = node.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares[i]; + if (value != null && typeof value === "object") { + node.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares[i] = context.value(value); + } + } + } + } + + { + const array = node.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.length; i++) { + const value = node.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[i]; + if (value != null && typeof value === "object") { + node.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[i] = context.value(value); + } + } + } + } + + { + const array = node.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.length; i++) { + const value = node.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[i]; + if (value != null && typeof value === "object") { + node.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[i] = context.value(value); + } + } + } + } + + { + const array = node.#_5chuqj6s95p5gg2sk1HntGfarRf_tag; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_5chuqj6s95p5gg2sk1HntGfarRf_tag.length; i++) { + const value = node.#_5chuqj6s95p5gg2sk1HntGfarRf_tag[i]; + if (value != null && typeof value === "object") { + node.#_5chuqj6s95p5gg2sk1HntGfarRf_tag[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length; i++) { + const value = node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[i]; + if (value != null && typeof value === "object") { + node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.length; i++) { + const value = node.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[i]; + if (value != null && typeof value === "object") { + node.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[i] = context.value(value); + } + } + } + } + + { + const array = node.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.length; i++) { + const value = node.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[i]; + if (value != null && typeof value === "object") { + node.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[i] = context.value(value); + } + } + } + } + + { + const array = node.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.length; i++) { + const value = node.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[i]; + if (value != null && typeof value === "object") { + node.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.length; i++) { + const value = node.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[i]; + if (value != null && typeof value === "object") { + node.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source.length; i++) { + const value = node.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source[i]; + if (value != null && typeof value === "object") { + node.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source[i] = context.value(value); + } + } + } + } + + { + const array = node.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.length; i++) { + const value = node.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[i]; + if (value != null && typeof value === "object") { + node.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy.length; i++) { + const value = node.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy[i]; + if (value != null && typeof value === "object") { + node.#_2MHQfh2N74MMmDLDqYWFo7TxYQK2_interactionPolicy[i] = context.value(value); + } + } + } + } + + { + const array = node.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy.length; i++) { + const value = node.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy[i]; + if (value != null && typeof value === "object") { + node.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.length; i++) { + const value = node.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[i]; + if (value != null && typeof value === "object") { + node.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[i] = context.value(value); + } + } + } + } + + { + const array = node.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.length; i++) { + const value = node.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[i]; + if (value != null && typeof value === "object") { + node.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[i] = context.value(value); + } + } + } + } + + { + const array = node.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.length; i++) { + const value = node.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[i]; + if (value != null && typeof value === "object") { + node.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[i] = context.value(value); + } + } + } + } + + { + const array = node.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations.length; i++) { + const value = node.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations[i]; + if (value != null && typeof value === "object") { + node.#_a1jKLXa1P1ZoKTfTM2CzmhHK3cP_translations[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.length; i++) { + const value = node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d[i]; + if (value != null && typeof value === "object") { + node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d[i] = context.value(value); + } + } + } + } +} }); } + async #fetchAttachment( url: URL, options: { @@ -2732,7 +4842,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(i)) { + !(i < (this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment[vocabTrustPrefix] ?? 0) || + this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#attachment"); @@ -2804,7 +4915,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(i)) { + !(i < (this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment[vocabTrustPrefix] ?? 0) || + this.#_trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -3217,7 +5329,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[0]; if (!(v instanceof URL) && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { + !(0 < (this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#attributedTo"); @@ -3285,7 +5398,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0)) { + !(0 < (this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -3375,7 +5489,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(i)) { + !(i < (this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#attributedTo"); @@ -3447,7 +5562,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(i)) { + !(i < (this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -3799,7 +5915,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[0]; if (!(v instanceof URL) && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + !(0 < (this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[vocabTrustPrefix] ?? 0) || + this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#audience"); @@ -3867,7 +5984,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0)) { + !(0 < (this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[vocabTrustPrefix] ?? 0) || + this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -3956,7 +6074,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(i)) { + !(i < (this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[vocabTrustPrefix] ?? 0) || + this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#audience"); @@ -4028,7 +6147,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(i)) { + !(i < (this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience[vocabTrustPrefix] ?? 0) || + this.#_trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -4429,7 +6549,8 @@ get contents(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context.has(i)) { + !(i < (this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context[vocabTrustPrefix] ?? 0) || + this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#context"); @@ -4501,7 +6622,8 @@ get contents(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context.has(i)) { + !(i < (this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context[vocabTrustPrefix] ?? 0) || + this.#_trust_3mhZzGXSpQ431mBSz2kvych22v4e_context.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -4909,7 +7031,8 @@ get names(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator.has(i)) { + !(i < (this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator[vocabTrustPrefix] ?? 0) || + this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#generator"); @@ -4981,7 +7104,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator.has(i)) { + !(i < (this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator[vocabTrustPrefix] ?? 0) || + this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -5356,7 +7480,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[0]; if (!(v instanceof URL) && - !this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(0)) { + !(0 < (this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[vocabTrustPrefix] ?? 0) || + this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#icon"); @@ -5424,7 +7549,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(0)) { + !(0 < (this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[vocabTrustPrefix] ?? 0) || + this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -5514,7 +7640,8 @@ get names(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(i)) { + !(i < (this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[vocabTrustPrefix] ?? 0) || + this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#icon"); @@ -5586,7 +7713,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(i)) { + !(i < (this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon[vocabTrustPrefix] ?? 0) || + this.#_trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -5961,7 +8089,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[0]; if (!(v instanceof URL) && - !this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(0)) { + !(0 < (this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[vocabTrustPrefix] ?? 0) || + this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#image"); @@ -6029,7 +8158,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(0)) { + !(0 < (this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[vocabTrustPrefix] ?? 0) || + this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -6119,7 +8249,8 @@ get names(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(i)) { + !(i < (this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[vocabTrustPrefix] ?? 0) || + this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#image"); @@ -6191,7 +8322,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(i)) { + !(i < (this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image[vocabTrustPrefix] ?? 0) || + this.#_trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -6558,7 +8690,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[0]; if (!(v instanceof URL) && - !this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(0)) { + !(0 < (this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[vocabTrustPrefix] ?? 0) || + this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#inReplyTo"); @@ -6626,7 +8759,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(0)) { + !(0 < (this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[vocabTrustPrefix] ?? 0) || + this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -6715,7 +8849,8 @@ get names(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(i)) { + !(i < (this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[vocabTrustPrefix] ?? 0) || + this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#inReplyTo"); @@ -6787,7 +8922,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(i)) { + !(i < (this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo[vocabTrustPrefix] ?? 0) || + this.#_trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -7154,7 +9290,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[0]; if (!(v instanceof URL) && - !this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(0)) { + !(0 < (this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[vocabTrustPrefix] ?? 0) || + this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#location"); @@ -7222,7 +9359,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(0)) { + !(0 < (this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[vocabTrustPrefix] ?? 0) || + this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -7311,7 +9449,8 @@ get names(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(i)) { + !(i < (this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[vocabTrustPrefix] ?? 0) || + this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#location"); @@ -7383,7 +9522,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(i)) { + !(i < (this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location[vocabTrustPrefix] ?? 0) || + this.#_trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -7749,7 +9889,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview[0]; if (!(v instanceof URL) && - !this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(0)) { + !(0 < (this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview[vocabTrustPrefix] ?? 0) || + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#preview"); @@ -7817,7 +9958,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(0)) { + !(0 < (this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview[vocabTrustPrefix] ?? 0) || + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -7905,7 +10047,8 @@ get names(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i)) { + !(i < (this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview[vocabTrustPrefix] ?? 0) || + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#preview"); @@ -7977,7 +10120,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i)) { + !(i < (this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview[vocabTrustPrefix] ?? 0) || + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -8342,7 +10486,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_7UpwM3JWcXhADcscukEehBorf6k_replies[0]; if (!(v instanceof URL) && - !this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies.has(0)) { + !(0 < (this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies[vocabTrustPrefix] ?? 0) || + this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#replies"); @@ -8410,7 +10555,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies.has(0)) { + !(0 < (this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies[vocabTrustPrefix] ?? 0) || + this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -8767,7 +10913,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares[0]; if (!(v instanceof URL) && - !this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares.has(0)) { + !(0 < (this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares[vocabTrustPrefix] ?? 0) || + this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#shares"); @@ -8835,7 +10982,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares.has(0)) { + !(0 < (this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares[vocabTrustPrefix] ?? 0) || + this.#_trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -9192,7 +11340,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[0]; if (!(v instanceof URL) && - !this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.has(0)) { + !(0 < (this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[vocabTrustPrefix] ?? 0) || + this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#likes"); @@ -9260,7 +11409,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.has(0)) { + !(0 < (this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes[vocabTrustPrefix] ?? 0) || + this.#_trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -9611,7 +11761,8 @@ get names(): ((string | LanguageString))[] { } let v = this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[0]; if (!(v instanceof URL) && - !this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.has(0)) { + !(0 < (this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[vocabTrustPrefix] ?? 0) || + this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "http://fedibird.com/ns#emojiReactions"); @@ -9679,7 +11830,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.has(0)) { + !(0 < (this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions[vocabTrustPrefix] ?? 0) || + this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -10087,7 +12239,8 @@ get summaries(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.has(i)) { + !(i < (this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag[vocabTrustPrefix] ?? 0) || + this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#tag"); @@ -10159,7 +12312,8 @@ get summaries(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.has(i)) { + !(i < (this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag[vocabTrustPrefix] ?? 0) || + this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -10545,7 +12699,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[0]; if (!(v instanceof URL) && - !this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(0)) { + !(0 < (this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[vocabTrustPrefix] ?? 0) || + this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#to"); @@ -10613,7 +12768,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(0)) { + !(0 < (this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[vocabTrustPrefix] ?? 0) || + this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -10702,7 +12858,8 @@ get urls(): ((URL | Link))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(i)) { + !(i < (this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[vocabTrustPrefix] ?? 0) || + this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#to"); @@ -10774,7 +12931,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(i)) { + !(i < (this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to[vocabTrustPrefix] ?? 0) || + this.#_trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -11126,7 +13284,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[0]; if (!(v instanceof URL) && - !this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(0)) { + !(0 < (this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[vocabTrustPrefix] ?? 0) || + this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#bto"); @@ -11194,7 +13353,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(0)) { + !(0 < (this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[vocabTrustPrefix] ?? 0) || + this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -11283,7 +13443,8 @@ get urls(): ((URL | Link))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(i)) { + !(i < (this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[vocabTrustPrefix] ?? 0) || + this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#bto"); @@ -11355,7 +13516,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(i)) { + !(i < (this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto[vocabTrustPrefix] ?? 0) || + this.#_trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -11707,7 +13869,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[0]; if (!(v instanceof URL) && - !this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(0)) { + !(0 < (this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[vocabTrustPrefix] ?? 0) || + this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#cc"); @@ -11775,7 +13938,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(0)) { + !(0 < (this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[vocabTrustPrefix] ?? 0) || + this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -11864,7 +14028,8 @@ get urls(): ((URL | Link))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(i)) { + !(i < (this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[vocabTrustPrefix] ?? 0) || + this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#cc"); @@ -11936,7 +14101,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(i)) { + !(i < (this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc[vocabTrustPrefix] ?? 0) || + this.#_trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -12288,7 +14454,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[0]; if (!(v instanceof URL) && - !this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(0)) { + !(0 < (this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[vocabTrustPrefix] ?? 0) || + this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#bcc"); @@ -12356,7 +14523,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(0)) { + !(0 < (this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[vocabTrustPrefix] ?? 0) || + this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -12445,7 +14613,8 @@ get urls(): ((URL | Link))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(i)) { + !(i < (this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[vocabTrustPrefix] ?? 0) || + this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#bcc"); @@ -12517,7 +14686,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(i)) { + !(i < (this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc[vocabTrustPrefix] ?? 0) || + this.#_trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -12932,7 +15102,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[0]; if (!(v instanceof URL) && - !this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(0)) { + !(0 < (this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[vocabTrustPrefix] ?? 0) || + this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#proof"); @@ -13000,7 +15171,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(0)) { + !(0 < (this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[vocabTrustPrefix] ?? 0) || + this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -13088,7 +15260,8 @@ get urls(): ((URL | Link))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(i)) { + !(i < (this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[vocabTrustPrefix] ?? 0) || + this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#proof"); @@ -13160,7 +15333,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(i)) { + !(i < (this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof[vocabTrustPrefix] ?? 0) || + this.#_trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -13551,7 +15725,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.has(0)) { + !(0 < (this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://gotosocial.org/ns#likeAuthorization"); @@ -13619,7 +15794,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.has(0)) { + !(0 < (this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -13970,7 +16146,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.has(0)) { + !(0 < (this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://gotosocial.org/ns#replyAuthorization"); @@ -14038,7 +16215,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.has(0)) { + !(0 < (this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -14389,7 +16567,8 @@ get urls(): ((URL | Link))[] { } let v = this.#_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.has(0)) { + !(0 < (this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://gotosocial.org/ns#announceAuthorization"); @@ -14457,7 +16636,8 @@ get urls(): ((URL | Link))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.has(0)) { + !(0 < (this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -16669,7 +18849,7 @@ get licenses(): (URL)[] { let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _49BipA5dq9eoH8LX8xdsVumveTca_attachment: (Object | Link | PropertyValue | URL)[] = []; - const _trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment: Set = new Set(); + const _trust_49BipA5dq9eoH8LX8xdsVumveTca_attachment: VocabTrustSet = new Set(); let _49BipA5dq9eoH8LX8xdsVumveTca_attachment__array = values["https://www.w3.org/ns/activitystreams#attachment"]; @@ -16721,7 +18901,7 @@ get licenses(): (URL)[] { instance.#_49BipA5dq9eoH8LX8xdsVumveTca_attachment = _49BipA5dq9eoH8LX8xdsVumveTca_attachment; const _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: Set = new Set(); + const _trust_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo: VocabTrustSet = new Set(); let _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo__array = values["https://www.w3.org/ns/activitystreams#attributedTo"]; @@ -16779,7 +18959,7 @@ get licenses(): (URL)[] { instance.#_42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo = _42CGqJ94zgQ3ZBbfHwD8Hrr2L5Py_attributedTo; const _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience: (Object | URL)[] = []; - const _trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience: Set = new Set(); + const _trust_3ocC3VVi88cEd5sPWL8djkZsvTN6_audience: VocabTrustSet = new Set(); let _3ocC3VVi88cEd5sPWL8djkZsvTN6_audience__array = values["https://www.w3.org/ns/activitystreams#audience"]; @@ -16853,7 +19033,7 @@ get licenses(): (URL)[] { instance.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = _4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content; const _3mhZzGXSpQ431mBSz2kvych22v4e_context: (Object | Link | URL)[] = []; - const _trust_3mhZzGXSpQ431mBSz2kvych22v4e_context: Set = new Set(); + const _trust_3mhZzGXSpQ431mBSz2kvych22v4e_context: VocabTrustSet = new Set(); let _3mhZzGXSpQ431mBSz2kvych22v4e_context__array = values["https://www.w3.org/ns/activitystreams#context"]; @@ -16967,7 +19147,7 @@ get licenses(): (URL)[] { instance.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime; const _86xFhmgBapoMvYqjbjRuDPayTrS_generator: (Object | Link | URL)[] = []; - const _trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator: Set = new Set(); + const _trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator: VocabTrustSet = new Set(); let _86xFhmgBapoMvYqjbjRuDPayTrS_generator__array = values["https://www.w3.org/ns/activitystreams#generator"]; @@ -17015,7 +19195,7 @@ get licenses(): (URL)[] { instance.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = _86xFhmgBapoMvYqjbjRuDPayTrS_generator; const _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon: (Image | URL)[] = []; - const _trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon: Set = new Set(); + const _trust_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon: VocabTrustSet = new Set(); let _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon__array = values["https://www.w3.org/ns/activitystreams#icon"]; @@ -17079,7 +19259,7 @@ get licenses(): (URL)[] { instance.#_33CjRLy5ujtsUrwRSCrsggvGdKuR_icon = _33CjRLy5ujtsUrwRSCrsggvGdKuR_icon; const _3dXrUdkARxwyJLtJcYi1AJ92H41U_image: (Image | URL)[] = []; - const _trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image: Set = new Set(); + const _trust_3dXrUdkARxwyJLtJcYi1AJ92H41U_image: VocabTrustSet = new Set(); let _3dXrUdkARxwyJLtJcYi1AJ92H41U_image__array = values["https://www.w3.org/ns/activitystreams#image"]; @@ -17143,7 +19323,7 @@ get licenses(): (URL)[] { instance.#_3dXrUdkARxwyJLtJcYi1AJ92H41U_image = _3dXrUdkARxwyJLtJcYi1AJ92H41U_image; const _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo: (Object | Link | URL)[] = []; - const _trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo: Set = new Set(); + const _trust_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo: VocabTrustSet = new Set(); let _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo__array = values["https://www.w3.org/ns/activitystreams#inReplyTo"]; @@ -17191,7 +19371,7 @@ get licenses(): (URL)[] { instance.#_3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo = _3fpbDrvZgf3Kq1a5V9aByFn8kx3s_inReplyTo; const _31k5MUZJsnsPNg8dQQJieWaXTFnR_location: (Object | Link | URL)[] = []; - const _trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location: Set = new Set(); + const _trust_31k5MUZJsnsPNg8dQQJieWaXTFnR_location: VocabTrustSet = new Set(); let _31k5MUZJsnsPNg8dQQJieWaXTFnR_location__array = values["https://www.w3.org/ns/activitystreams#location"]; @@ -17239,7 +19419,7 @@ get licenses(): (URL)[] { instance.#_31k5MUZJsnsPNg8dQQJieWaXTFnR_location = _31k5MUZJsnsPNg8dQQJieWaXTFnR_location; const _gCVTegXxWWCw6wWRxa1QF65zusg_preview: (Link | Object | URL)[] = []; - const _trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: Set = new Set(); + const _trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: VocabTrustSet = new Set(); let _gCVTegXxWWCw6wWRxa1QF65zusg_preview__array = values["https://www.w3.org/ns/activitystreams#preview"]; @@ -17320,7 +19500,7 @@ get licenses(): (URL)[] { instance.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = _5e258TDXtuhaFRPZiGoDfEpjdMr_published; const _7UpwM3JWcXhADcscukEehBorf6k_replies: (Collection | URL)[] = []; - const _trust_7UpwM3JWcXhADcscukEehBorf6k_replies: Set = new Set(); + const _trust_7UpwM3JWcXhADcscukEehBorf6k_replies: VocabTrustSet = new Set(); let _7UpwM3JWcXhADcscukEehBorf6k_replies__array = values["https://www.w3.org/ns/activitystreams#replies"]; @@ -17361,7 +19541,7 @@ get licenses(): (URL)[] { instance.#_7UpwM3JWcXhADcscukEehBorf6k_replies = _7UpwM3JWcXhADcscukEehBorf6k_replies; const _3kAfck9PcEYt2L7xug5y99YPbANs_shares: (Collection | URL)[] = []; - const _trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares: Set = new Set(); + const _trust_3kAfck9PcEYt2L7xug5y99YPbANs_shares: VocabTrustSet = new Set(); let _3kAfck9PcEYt2L7xug5y99YPbANs_shares__array = values["https://www.w3.org/ns/activitystreams#shares"]; @@ -17402,7 +19582,7 @@ get licenses(): (URL)[] { instance.#_3kAfck9PcEYt2L7xug5y99YPbANs_shares = _3kAfck9PcEYt2L7xug5y99YPbANs_shares; const _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes: (Collection | URL)[] = []; - const _trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes: Set = new Set(); + const _trust_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes: VocabTrustSet = new Set(); let _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes__array = values["https://www.w3.org/ns/activitystreams#likes"]; @@ -17443,7 +19623,7 @@ get licenses(): (URL)[] { instance.#_S3ceDnpMdzoTRCccB9FkJWrEzYW_likes = _S3ceDnpMdzoTRCccB9FkJWrEzYW_likes; const _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: (Collection | URL)[] = []; - const _trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: Set = new Set(); + const _trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions: VocabTrustSet = new Set(); let _kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions__array = values["http://fedibird.com/ns#emojiReactions"]; @@ -17550,7 +19730,7 @@ get licenses(): (URL)[] { instance.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = _4LqirZspQbFWWQEbFcXAxm7tTDN1_summary; const _5chuqj6s95p5gg2sk1HntGfarRf_tag: (Object | Link | URL)[] = []; - const _trust_5chuqj6s95p5gg2sk1HntGfarRf_tag: Set = new Set(); + const _trust_5chuqj6s95p5gg2sk1HntGfarRf_tag: VocabTrustSet = new Set(); let _5chuqj6s95p5gg2sk1HntGfarRf_tag__array = values["https://www.w3.org/ns/activitystreams#tag"]; @@ -17667,7 +19847,7 @@ get licenses(): (URL)[] { instance.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = _2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; const _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to: (Object | URL)[] = []; - const _trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to: Set = new Set(); + const _trust_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to: VocabTrustSet = new Set(); let _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to__array = values["https://www.w3.org/ns/activitystreams#to"]; @@ -17708,7 +19888,7 @@ get licenses(): (URL)[] { instance.#_3hFbw7DTpHhq3cvVhkY8njhcsXbd_to = _3hFbw7DTpHhq3cvVhkY8njhcsXbd_to; const _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto: (Object | URL)[] = []; - const _trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto: Set = new Set(); + const _trust_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto: VocabTrustSet = new Set(); let _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto__array = values["https://www.w3.org/ns/activitystreams#bto"]; @@ -17749,7 +19929,7 @@ get licenses(): (URL)[] { instance.#_aLZupjwL8XB7tzdLgCMXdjZ6qej_bto = _aLZupjwL8XB7tzdLgCMXdjZ6qej_bto; const _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc: (Object | URL)[] = []; - const _trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc: Set = new Set(); + const _trust_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc: VocabTrustSet = new Set(); let _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc__array = values["https://www.w3.org/ns/activitystreams#cc"]; @@ -17790,7 +19970,7 @@ get licenses(): (URL)[] { instance.#_42a1SvBs24QSLzKcfjCyNTjW5a1g_cc = _42a1SvBs24QSLzKcfjCyNTjW5a1g_cc; const _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc: (Object | URL)[] = []; - const _trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc: Set = new Set(); + const _trust_3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc: VocabTrustSet = new Set(); let _3qvegKUB8YLgTXRpEf8E6JZSkz2H_bcc__array = values["https://www.w3.org/ns/activitystreams#bcc"]; @@ -17950,7 +20130,7 @@ get licenses(): (URL)[] { instance.#_2ZwCFoS787v8y8bXKjMoE6MAbrEB_source = _2ZwCFoS787v8y8bXKjMoE6MAbrEB_source; const _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: (DataIntegrityProof | URL)[] = []; - const _trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: Set = new Set(); + const _trust_42rPnotok1ivQ2RNCKNbeFJgx8b8_proof: VocabTrustSet = new Set(); let _42rPnotok1ivQ2RNCKNbeFJgx8b8_proof__array = values["https://w3id.org/security#proof"]; @@ -18057,7 +20237,7 @@ get licenses(): (URL)[] { instance.#_23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy = _23YiVs2miQcEiUdn4u8SvjQKWYim_approvedBy; const _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: (LikeAuthorization | URL)[] = []; - const _trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: Set = new Set(); + const _trust_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization: VocabTrustSet = new Set(); let _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization__array = values["https://gotosocial.org/ns#likeAuthorization"]; @@ -18098,7 +20278,7 @@ get licenses(): (URL)[] { instance.#_3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization = _3fCeb5aXaDDd4fvkQ96BLWifBUBa_likeAuthorization; const _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: (ReplyAuthorization | URL)[] = []; - const _trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: Set = new Set(); + const _trust_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization: VocabTrustSet = new Set(); let _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization__array = values["https://gotosocial.org/ns#replyAuthorization"]; @@ -18139,7 +20319,7 @@ get licenses(): (URL)[] { instance.#_YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization = _YA4wdUW7rYztAQ6SjhMnJCmcmtP_replyAuthorization; const _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: (AnnounceAuthorization | URL)[] = []; - const _trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: Set = new Set(); + const _trust_446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization: VocabTrustSet = new Set(); let _446xEaDBs3Fz6MyzP3PSBaLupkbJ_announceAuthorization__array = values["https://gotosocial.org/ns#announceAuthorization"]; @@ -19267,8 +21447,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Emoji.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -19323,7 +21503,77 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const clone = super.clone(values, options) as unknown as Emoji; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Emoji { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -19671,11 +21921,11 @@ export class ChatMessage extends Object { } #_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); #_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; #_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); /** * Constructs a new instance of ChatMessage with the given values. @@ -19763,8 +22013,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link ChatMessage.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -19816,12 +22066,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as ChatMessage;clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice();clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote); + const clone = super.clone(values, options) as unknown as ChatMessage;clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length < vocabSparseArrayMinimumLength + ? this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice() : vocabCopyPropertyArray(this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote);clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = vocabCopyTrustSet( + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, + ); if ("quote" in values && values.quote != null) { if (values.quote instanceof Object || values.quote instanceof URL) { // @ts-ignore: type is checked above. clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = [values.quote]; - clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set([0]); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] = 1; } else { throw new TypeError( "The quote must be of type " + @@ -19829,7 +22083,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice(); + clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length < vocabSparseArrayMinimumLength + ? this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice() : vocabCopyPropertyArray(this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl); if ("quoteUrl" in values && values.quoteUrl != null) { if (values.quoteUrl instanceof URL) { // @ts-ignore: type is checked above. @@ -19842,12 +22097,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice();clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization); + clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice() : vocabCopyPropertyArray(this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization);clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = vocabCopyTrustSet( + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, + ); if ("quoteAuthorization" in values && values.quoteAuthorization != null) { if (values.quoteAuthorization instanceof QuoteAuthorization || values.quoteAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = [values.quoteAuthorization]; - clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set([0]); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( "The quoteAuthorization must be of type " + @@ -19858,7 +22117,151 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];quote?: Object | URL | null;quoteUrl?: URL | null;quoteAuthorization?: QuoteAuthorization | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): ChatMessage { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as ChatMessage; + + { + const array = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length; i++) { + const value = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i]; + if (value != null && typeof value === "object") { + node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i] = context.value(value); + } + } + } + } + + { + const array = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length; i++) { + const value = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i]; + if (value != null && typeof value === "object") { + node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i] = context.value(value); + } + } + } + } + + { + const array = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length; i++) { + const value = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i]; + if (value != null && typeof value === "object") { + node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i] = context.value(value); + } + } + } + } +} }); } + async #fetchQuote( url: URL, options: { @@ -20187,7 +22590,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[0]; if (!(v instanceof URL) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/044f#quote"); @@ -20255,7 +22659,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -20629,7 +23034,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/044f#quoteAuthorization"); @@ -20697,7 +23103,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -21124,7 +23531,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); let _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote__array = values["https://w3id.org/fep/044f#quote"]; @@ -21204,7 +23611,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; const _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); let _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization__array = values["https://w3id.org/fep/044f#quoteAuthorization"]; @@ -21379,22 +23786,22 @@ export class Activity extends Object { } #_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: Set = new Set(); + #_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: VocabTrustSet = new Set(); #_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; - #_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); + #_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: VocabTrustSet = new Set(); #_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: (Object | URL)[] = []; - #_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: Set = new Set(); + #_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: VocabTrustSet = new Set(); #_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: (Object | URL)[] = []; - #_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: Set = new Set(); + #_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: VocabTrustSet = new Set(); #_25zu2s3VxVujgEKqrDycjE284XQR_origin: (Object | URL)[] = []; - #_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: Set = new Set(); + #_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: VocabTrustSet = new Set(); #_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: (Object | URL)[] = []; - #_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: Set = new Set(); + #_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: VocabTrustSet = new Set(); /** * Constructs a new instance of Activity with the given values. @@ -21460,14 +23867,36 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.actors) && - values.actors.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.actors)) { + const array = values.actors; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.actors; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = values.actors.slice(); + this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = copied; - for (let i = 0; i < values.actors.length; i++) { - this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); - } + vocabSetTrustPrefix(this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor, this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length); } else { throw new TypeError( @@ -21500,14 +23929,36 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.objects) && - values.objects.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.objects)) { + const array = values.objects; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.objects; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects.slice(); + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = copied; - for (let i = 0; i < values.objects.length; i++) { - this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); - } + vocabSetTrustPrefix(this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length); } else { throw new TypeError( @@ -21540,14 +23991,36 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.targets) && - values.targets.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.targets)) { + const array = values.targets; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.targets; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = values.targets.slice(); + this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = copied; - for (let i = 0; i < values.targets.length; i++) { - this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); - } + vocabSetTrustPrefix(this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target, this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length); } else { throw new TypeError( @@ -21580,14 +24053,36 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.results) && - values.results.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.results)) { + const array = values.results; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.results; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = values.results.slice(); + this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = copied; - for (let i = 0; i < values.results.length; i++) { - this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); - } + vocabSetTrustPrefix(this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result, this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length); } else { throw new TypeError( @@ -21620,14 +24115,36 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.origins) && - values.origins.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.origins)) { + const array = values.origins; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.origins; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = values.origins.slice(); + this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = copied; - for (let i = 0; i < values.origins.length; i++) { - this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); - } + vocabSetTrustPrefix(this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin, this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length); } else { throw new TypeError( @@ -21660,14 +24177,36 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.instruments) && - values.instruments.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.instruments)) { + const array = values.instruments; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.instruments; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = values.instruments.slice(); + this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = copied; - for (let i = 0; i < values.instruments.length; i++) { - this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); - } + vocabSetTrustPrefix(this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument, this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length); } else { throw new TypeError( @@ -21689,8 +24228,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Activity.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -21748,12 +24287,16 @@ instruments?: (Object | URL)[];} // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Activity;clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.slice();clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set(this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor); + const clone = super.clone(values, options) as unknown as Activity;clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length < vocabSparseArrayMinimumLength + ? this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.slice() : vocabCopyPropertyArray(this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor);clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = vocabCopyTrustSet( + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor, clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor, + ); if ("actor" in values && values.actor != null) { if (values.actor instanceof Application || values.actor instanceof Group || values.actor instanceof Organization || values.actor instanceof Person || values.actor instanceof Service || values.actor instanceof URL) { // @ts-ignore: type is checked above. clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = [values.actor]; - clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set([0]); + clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set(); + clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[vocabTrustPrefix] = 1; } else { throw new TypeError( "The actor must be of type " + @@ -21772,15 +24315,37 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.actors) && - values.actors.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.actors)) { + const array = values.actors; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.actors; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = values.actors.slice(); + clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = copied; clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = new Set(); - for (let i = 0; i < values.actors.length; i++) { - clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor, clone.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length); } else { throw new TypeError( @@ -21789,12 +24354,16 @@ instruments?: (Object | URL)[];} ); } } - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.slice();clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object); + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length < vocabSparseArrayMinimumLength + ? this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.slice() : vocabCopyPropertyArray(this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object);clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = vocabCopyTrustSet( + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, + ); if ("object" in values && values.object != null) { if (values.object instanceof Object || values.object instanceof URL) { // @ts-ignore: type is checked above. clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = [values.object]; - clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set([0]); + clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(); + clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] = 1; } else { throw new TypeError( "The object must be of type " + @@ -21813,15 +24382,37 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.objects) && - values.objects.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.objects)) { + const array = values.objects; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.objects; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects.slice(); + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = copied; clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(); - for (let i = 0; i < values.objects.length; i++) { - clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length); } else { throw new TypeError( @@ -21830,12 +24421,16 @@ instruments?: (Object | URL)[];} ); } } - clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.slice();clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set(this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target); + clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length < vocabSparseArrayMinimumLength + ? this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.slice() : vocabCopyPropertyArray(this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target);clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = vocabCopyTrustSet( + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target, clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target, + ); if ("target" in values && values.target != null) { if (values.target instanceof Object || values.target instanceof URL) { // @ts-ignore: type is checked above. clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = [values.target]; - clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set([0]); + clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set(); + clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[vocabTrustPrefix] = 1; } else { throw new TypeError( "The target must be of type " + @@ -21854,15 +24449,37 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.targets) && - values.targets.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.targets)) { + const array = values.targets; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.targets; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = values.targets.slice(); + clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = copied; clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = new Set(); - for (let i = 0; i < values.targets.length; i++) { - clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target, clone.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length); } else { throw new TypeError( @@ -21871,12 +24488,16 @@ instruments?: (Object | URL)[];} ); } } - clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.slice();clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set(this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result); + clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length < vocabSparseArrayMinimumLength + ? this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.slice() : vocabCopyPropertyArray(this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result);clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = vocabCopyTrustSet( + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result, clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result, + ); if ("result" in values && values.result != null) { if (values.result instanceof Object || values.result instanceof URL) { // @ts-ignore: type is checked above. clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = [values.result]; - clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set([0]); + clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set(); + clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[vocabTrustPrefix] = 1; } else { throw new TypeError( "The result must be of type " + @@ -21895,15 +24516,37 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.results) && - values.results.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.results)) { + const array = values.results; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.results; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = values.results.slice(); + clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = copied; clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = new Set(); - for (let i = 0; i < values.results.length; i++) { - clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.add(i); - } + vocabSetTrustPrefix(clone.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result, clone.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length); } else { throw new TypeError( @@ -21912,12 +24555,16 @@ instruments?: (Object | URL)[];} ); } } - clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.slice();clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set(this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin); + clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length < vocabSparseArrayMinimumLength + ? this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.slice() : vocabCopyPropertyArray(this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin);clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = vocabCopyTrustSet( + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin, clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin, + ); if ("origin" in values && values.origin != null) { if (values.origin instanceof Object || values.origin instanceof URL) { // @ts-ignore: type is checked above. clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = [values.origin]; - clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set([0]); + clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set(); + clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin[vocabTrustPrefix] = 1; } else { throw new TypeError( "The origin must be of type " + @@ -21936,15 +24583,37 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.origins) && - values.origins.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.origins)) { + const array = values.origins; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.origins; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = values.origins.slice(); + clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = copied; clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin = new Set(); - for (let i = 0; i < values.origins.length; i++) { - clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.add(i); - } + vocabSetTrustPrefix(clone.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin, clone.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length); } else { throw new TypeError( @@ -21953,12 +24622,16 @@ instruments?: (Object | URL)[];} ); } } - clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.slice();clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set(this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument); + clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length < vocabSparseArrayMinimumLength + ? this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.slice() : vocabCopyPropertyArray(this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument);clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = vocabCopyTrustSet( + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument, clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument, + ); if ("instrument" in values && values.instrument != null) { if (values.instrument instanceof Object || values.instrument instanceof URL) { // @ts-ignore: type is checked above. clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = [values.instrument]; - clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set([0]); + clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set(); + clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[vocabTrustPrefix] = 1; } else { throw new TypeError( "The instrument must be of type " + @@ -21977,15 +24650,37 @@ instruments?: (Object | URL)[];} ); } - if (Array.isArray(values.instruments) && - values.instruments.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.instruments)) { + const array = values.instruments; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.instruments; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = values.instruments.slice(); + clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = copied; clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument = new Set(); - for (let i = 0; i < values.instruments.length; i++) { - clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument, clone.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length); } else { throw new TypeError( @@ -21997,7 +24692,223 @@ instruments?: (Object | URL)[];} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Activity { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Activity; + + { + const array = node.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.length; i++) { + const value = node.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[i]; + if (value != null && typeof value === "object") { + node.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length; i++) { + const value = node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[i]; + if (value != null && typeof value === "object") { + node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.length; i++) { + const value = node.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[i]; + if (value != null && typeof value === "object") { + node.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[i] = context.value(value); + } + } + } + } + + { + const array = node.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.length; i++) { + const value = node.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[i]; + if (value != null && typeof value === "object") { + node.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[i] = context.value(value); + } + } + } + } + + { + const array = node.#_25zu2s3VxVujgEKqrDycjE284XQR_origin; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_25zu2s3VxVujgEKqrDycjE284XQR_origin.length; i++) { + const value = node.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[i]; + if (value != null && typeof value === "object") { + node.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.length; i++) { + const value = node.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[i]; + if (value != null && typeof value === "object") { + node.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[i] = context.value(value); + } + } + } + } +} }); } + async #fetchActor( url: URL, options: { @@ -22386,7 +25297,8 @@ instruments?: (Object | URL)[];} } let v = this.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[0]; if (!(v instanceof URL) && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { + !(0 < (this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[vocabTrustPrefix] ?? 0) || + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#actor"); @@ -22454,7 +25366,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0)) { + !(0 < (this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[vocabTrustPrefix] ?? 0) || + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -22544,7 +25457,8 @@ instruments?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(i)) { + !(i < (this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[vocabTrustPrefix] ?? 0) || + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#actor"); @@ -22616,7 +25530,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(i)) { + !(i < (this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor[vocabTrustPrefix] ?? 0) || + this.#_trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -22969,7 +25884,8 @@ instruments?: (Object | URL)[];} } let v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; if (!(v instanceof URL) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { + !(0 < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#object"); @@ -23037,7 +25953,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { + !(0 < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -23127,7 +26044,8 @@ instruments?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i)) { + !(i < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#object"); @@ -23199,7 +26117,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i)) { + !(i < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -23555,7 +26474,8 @@ instruments?: (Object | URL)[];} } let v = this.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[0]; if (!(v instanceof URL) && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { + !(0 < (this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[vocabTrustPrefix] ?? 0) || + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#target"); @@ -23623,7 +26543,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0)) { + !(0 < (this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[vocabTrustPrefix] ?? 0) || + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -23716,7 +26637,8 @@ instruments?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(i)) { + !(i < (this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[vocabTrustPrefix] ?? 0) || + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#target"); @@ -23788,7 +26710,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(i)) { + !(i < (this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target[vocabTrustPrefix] ?? 0) || + this.#_trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -24141,7 +27064,8 @@ instruments?: (Object | URL)[];} } let v = this.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[0]; if (!(v instanceof URL) && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { + !(0 < (this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[vocabTrustPrefix] ?? 0) || + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#result"); @@ -24209,7 +27133,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0)) { + !(0 < (this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[vocabTrustPrefix] ?? 0) || + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -24299,7 +27224,8 @@ instruments?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(i)) { + !(i < (this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[vocabTrustPrefix] ?? 0) || + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#result"); @@ -24371,7 +27297,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(i)) { + !(i < (this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result[vocabTrustPrefix] ?? 0) || + this.#_trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -24725,7 +27652,8 @@ instruments?: (Object | URL)[];} } let v = this.#_25zu2s3VxVujgEKqrDycjE284XQR_origin[0]; if (!(v instanceof URL) && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { + !(0 < (this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin[vocabTrustPrefix] ?? 0) || + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#origin"); @@ -24793,7 +27721,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0)) { + !(0 < (this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin[vocabTrustPrefix] ?? 0) || + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -24884,7 +27813,8 @@ instruments?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(i)) { + !(i < (this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin[vocabTrustPrefix] ?? 0) || + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#origin"); @@ -24956,7 +27886,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(i)) { + !(i < (this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin[vocabTrustPrefix] ?? 0) || + this.#_trust_25zu2s3VxVujgEKqrDycjE284XQR_origin.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -25308,7 +28239,8 @@ instruments?: (Object | URL)[];} } let v = this.#_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[0]; if (!(v instanceof URL) && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { + !(0 < (this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[vocabTrustPrefix] ?? 0) || + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#instrument"); @@ -25376,7 +28308,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0)) { + !(0 < (this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[vocabTrustPrefix] ?? 0) || + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -25465,7 +28398,8 @@ instruments?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(i)) { + !(i < (this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[vocabTrustPrefix] ?? 0) || + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#instrument"); @@ -25537,7 +28471,8 @@ instruments?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(i)) { + !(i < (this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument[vocabTrustPrefix] ?? 0) || + this.#_trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -26076,7 +29011,7 @@ instruments?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: Set = new Set(); + const _trust_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor: VocabTrustSet = new Set(); let _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor__array = values["https://www.w3.org/ns/activitystreams#actor"]; @@ -26134,7 +29069,7 @@ instruments?: (Object | URL)[];} instance.#_2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor = _2DjTTboo3CNHU2a2JQqUSE2dbv9D_actor; const _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; - const _trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); + const _trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: VocabTrustSet = new Set(); let _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array = values["https://www.w3.org/ns/activitystreams#object"]; @@ -26175,7 +29110,7 @@ instruments?: (Object | URL)[];} instance.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; const _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: (Object | URL)[] = []; - const _trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: Set = new Set(); + const _trust_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target: VocabTrustSet = new Set(); let _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target__array = values["https://www.w3.org/ns/activitystreams#target"]; @@ -26216,7 +29151,7 @@ instruments?: (Object | URL)[];} instance.#_3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target = _3JQCmF2Ww56Ag9EWRYoSZRDNCYtF_target; const _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: (Object | URL)[] = []; - const _trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: Set = new Set(); + const _trust_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result: VocabTrustSet = new Set(); let _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result__array = values["https://www.w3.org/ns/activitystreams#result"]; @@ -26257,7 +29192,7 @@ instruments?: (Object | URL)[];} instance.#_u4QGFbRFcYmPEKGbPv1hpBR9r5G_result = _u4QGFbRFcYmPEKGbPv1hpBR9r5G_result; const _25zu2s3VxVujgEKqrDycjE284XQR_origin: (Object | URL)[] = []; - const _trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: Set = new Set(); + const _trust_25zu2s3VxVujgEKqrDycjE284XQR_origin: VocabTrustSet = new Set(); let _25zu2s3VxVujgEKqrDycjE284XQR_origin__array = values["https://www.w3.org/ns/activitystreams#origin"]; @@ -26298,7 +29233,7 @@ instruments?: (Object | URL)[];} instance.#_25zu2s3VxVujgEKqrDycjE284XQR_origin = _25zu2s3VxVujgEKqrDycjE284XQR_origin; const _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: (Object | URL)[] = []; - const _trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: Set = new Set(); + const _trust_3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument: VocabTrustSet = new Set(); let _3c5t2x7DYRo2shwTxpkd4kYSS5WQ_instrument__array = values["https://www.w3.org/ns/activitystreams#instrument"]; @@ -26617,8 +29552,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link EmojiReact.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -26679,7 +29614,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as EmojiReact; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): EmojiReact { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -27149,8 +30160,8 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link PropertyValue.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -27193,7 +30204,8 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} options ); copyPortableProvenance(this, clone); - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.slice(); + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length < vocabSparseArrayMinimumLength + ? this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.slice() : vocabCopyPropertyArray(this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name); if ("name" in values && values.name != null) { if (typeof values.name === "string" || values.name instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -27206,7 +30218,8 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} ); } } - clone.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.slice(); + clone.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value = this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.length < vocabSparseArrayMinimumLength + ? this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value.slice() : vocabCopyPropertyArray(this.#_2cSy2magg4iZ7zLaG8U7DiJMoCkx_value); if ("value" in values && values.value != null) { if (typeof values.value === "string" || values.value instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -27222,7 +30235,79 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +name?: string | LanguageString | null;value?: string | LanguageString | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): PropertyValue { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as PropertyValue; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as PropertyValue; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); +} }); } + /** The name of a property. */ get name(): (string | LanguageString | null) { @@ -27921,8 +31006,8 @@ unit?: string | null;numericalValue?: Decimal | null;} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Measure.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -27965,7 +31050,8 @@ unit?: string | null;numericalValue?: Decimal | null;} options ); copyPortableProvenance(this, clone); - clone.#_27fgyFbosTtMAhuepJH8K3ZGURT6 = this.#_27fgyFbosTtMAhuepJH8K3ZGURT6.slice(); + clone.#_27fgyFbosTtMAhuepJH8K3ZGURT6 = this.#_27fgyFbosTtMAhuepJH8K3ZGURT6.length < vocabSparseArrayMinimumLength + ? this.#_27fgyFbosTtMAhuepJH8K3ZGURT6.slice() : vocabCopyPropertyArray(this.#_27fgyFbosTtMAhuepJH8K3ZGURT6); if ("unit" in values && values.unit != null) { if (typeof values.unit === "string") { // @ts-ignore: type is checked above. @@ -27978,7 +31064,8 @@ unit?: string | null;numericalValue?: Decimal | null;} ); } } - clone.#_1GQx8o2RgxRs4x9G5uT39XYBv7D = this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D.slice(); + clone.#_1GQx8o2RgxRs4x9G5uT39XYBv7D = this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D.length < vocabSparseArrayMinimumLength + ? this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D.slice() : vocabCopyPropertyArray(this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D); if ("numericalValue" in values && values.numericalValue != null) { if (typeof values.numericalValue === "string" && isDecimal(values.numericalValue)) { // @ts-ignore: type is checked above. @@ -27994,7 +31081,79 @@ unit?: string | null;numericalValue?: Decimal | null;} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +unit?: string | null;numericalValue?: Decimal | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Measure { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Measure; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Measure; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); +} }); } + /** The name of the unit, according to the Ontology of units of Measure * classification. The recommended unit for countable items is \`"one"\`. * @@ -28533,10 +31692,10 @@ export class AnnounceAuthorization extends Object { } #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); /** * Constructs a new instance of AnnounceAuthorization with the given values. @@ -28611,8 +31770,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link AnnounceAuthorization.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -28664,12 +31823,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as AnnounceAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice();clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + const clone = super.clone(values, options) as unknown as AnnounceAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < vocabSparseArrayMinimumLength + ? this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice() : vocabCopyPropertyArray(this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject);clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = vocabCopyTrustSet( + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, + ); if ("interactingObject" in values && values.interactingObject != null) { if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { // @ts-ignore: type is checked above. clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; - clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] = 1; } else { throw new TypeError( "The interactingObject must be of type " + @@ -28677,12 +31840,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice();clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < vocabSparseArrayMinimumLength + ? this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice() : vocabCopyPropertyArray(this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget);clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = vocabCopyTrustSet( + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, + ); if ("interactionTarget" in values && values.interactionTarget != null) { if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { // @ts-ignore: type is checked above. clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; - clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] = 1; } else { throw new TypeError( "The interactionTarget must be of type " + @@ -28693,7 +31860,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): AnnounceAuthorization { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as AnnounceAuthorization; + + { + const array = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length; i++) { + const value = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i]; + if (value != null && typeof value === "object") { + node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length; i++) { + const value = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i]; + if (value != null && typeof value === "object") { + node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i] = context.value(value); + } + } + } + } +} }); } + async #fetchInteractingObject( url: URL, options: { @@ -29021,7 +32310,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; if (!(v instanceof URL) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://gotosocial.org/ns#interactingObject"); @@ -29089,7 +32379,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -29439,7 +32730,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; if (!(v instanceof URL) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://gotosocial.org/ns#interactionTarget"); @@ -29507,7 +32799,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -29884,7 +33177,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values["https://gotosocial.org/ns#interactingObject"]; @@ -29925,7 +33218,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values["https://gotosocial.org/ns#interactionTarget"]; @@ -30138,8 +33431,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link AnnounceRequest.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -30200,7 +33493,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as AnnounceRequest; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): AnnounceRequest { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -30719,8 +34088,8 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link InteractionPolicy.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -30763,7 +34132,8 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: options ); copyPortableProvenance(this, clone); - clone.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature = this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature.slice(); + clone.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature = this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature.length < vocabSparseArrayMinimumLength + ? this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature.slice() : vocabCopyPropertyArray(this.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature); if ("canFeature" in values && values.canFeature != null) { if (values.canFeature instanceof InteractionRule) { // @ts-ignore: type is checked above. @@ -30776,7 +34146,8 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: ); } } - clone.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike = this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.slice(); + clone.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike = this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.length < vocabSparseArrayMinimumLength + ? this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.slice() : vocabCopyPropertyArray(this.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike); if ("canLike" in values && values.canLike != null) { if (values.canLike instanceof InteractionRule) { // @ts-ignore: type is checked above. @@ -30789,7 +34160,8 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: ); } } - clone.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply = this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.slice(); + clone.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply = this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.length < vocabSparseArrayMinimumLength + ? this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.slice() : vocabCopyPropertyArray(this.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply); if ("canReply" in values && values.canReply != null) { if (values.canReply instanceof InteractionRule) { // @ts-ignore: type is checked above. @@ -30802,7 +34174,8 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: ); } } - clone.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce = this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.slice(); + clone.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce = this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.length < vocabSparseArrayMinimumLength + ? this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.slice() : vocabCopyPropertyArray(this.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce); if ("canAnnounce" in values && values.canAnnounce != null) { if (values.canAnnounce instanceof InteractionRule) { // @ts-ignore: type is checked above. @@ -30815,7 +34188,8 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: ); } } - clone.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote = this.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote.slice(); + clone.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote = this.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote.length < vocabSparseArrayMinimumLength + ? this.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote.slice() : vocabCopyPropertyArray(this.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote); if ("canQuote" in values && values.canQuote != null) { if (values.canQuote instanceof InteractionRule) { // @ts-ignore: type is checked above. @@ -30831,7 +34205,189 @@ canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +canFeature?: InteractionRule | null;canLike?: InteractionRule | null;canReply?: InteractionRule | null;canAnnounce?: InteractionRule | null;canQuote?: InteractionRule | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): InteractionPolicy { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as InteractionPolicy; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as InteractionPolicy; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature.length; i++) { + const value = node.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature[i]; + if (value != null && typeof value === "object") { + node.#_2hdwkUHmthzVPdo1ttxKsP7AGKka_canFeature[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike.length; i++) { + const value = node.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike[i]; + if (value != null && typeof value === "object") { + node.#_3JkwVLb3BNCwCWdsb5RftGAg8vyT_canLike[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply.length; i++) { + const value = node.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply[i]; + if (value != null && typeof value === "object") { + node.#_2UBgLRi5p3DRGGvWyB227i4Qjhzd_canReply[i] = context.value(value); + } + } + } + } + + { + const array = node.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce.length; i++) { + const value = node.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce[i]; + if (value != null && typeof value === "object") { + node.#_fu5nmoAj528fBQfnxhY9Daok3Vi_canAnnounce[i] = context.value(value); + } + } + } + } + + { + const array = node.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote.length; i++) { + const value = node.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote[i]; + if (value != null && typeof value === "object") { + node.#_LE3zBTVacTZw2LSyLt4wVUkXeUy_canQuote[i] = context.value(value); + } + } + } + } +} }); } + /** The sub-policy specifying who can feature the actor in a * {@link FeaturedCollection}. * @@ -31766,10 +35322,34 @@ manualApprovals?: (URL)[];} ); } - if (Array.isArray(values.automaticApprovals) && - values.automaticApprovals.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.automaticApprovals)) { + const array = values.automaticApprovals; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.automaticApprovals; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = values.automaticApprovals.slice(); + this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = copied; } else { throw new TypeError( @@ -31802,10 +35382,34 @@ manualApprovals?: (URL)[];} ); } - if (Array.isArray(values.manualApprovals) && - values.manualApprovals.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.manualApprovals)) { + const array = values.manualApprovals; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.manualApprovals; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = values.manualApprovals.slice(); + this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = copied; } else { throw new TypeError( @@ -31827,8 +35431,8 @@ manualApprovals?: (URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link InteractionRule.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -31873,7 +35477,8 @@ manualApprovals?: (URL)[];} options ); copyPortableProvenance(this, clone); - clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.slice(); + clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.length < vocabSparseArrayMinimumLength + ? this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.slice() : vocabCopyPropertyArray(this.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval); if ("automaticApproval" in values && values.automaticApproval != null) { if (values.automaticApproval instanceof URL) { // @ts-ignore: type is checked above. @@ -31897,10 +35502,34 @@ manualApprovals?: (URL)[];} ); } - if (Array.isArray(values.automaticApprovals) && - values.automaticApprovals.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.automaticApprovals)) { + const array = values.automaticApprovals; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.automaticApprovals; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = values.automaticApprovals.slice(); + clone.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval = copied; } else { throw new TypeError( @@ -31909,7 +35538,8 @@ manualApprovals?: (URL)[];} ); } } - clone.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.slice(); + clone.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.length < vocabSparseArrayMinimumLength + ? this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.slice() : vocabCopyPropertyArray(this.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval); if ("manualApproval" in values && values.manualApproval != null) { if (values.manualApproval instanceof URL) { // @ts-ignore: type is checked above. @@ -31933,10 +35563,34 @@ manualApprovals?: (URL)[];} ); } - if (Array.isArray(values.manualApprovals) && - values.manualApprovals.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.manualApprovals)) { + const array = values.manualApprovals; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.manualApprovals; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = values.manualApprovals.slice(); + clone.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval = copied; } else { throw new TypeError( @@ -31948,7 +35602,125 @@ manualApprovals?: (URL)[];} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +automaticApproval?: URL | null; +automaticApprovals?: (URL)[];manualApproval?: URL | null; +manualApprovals?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): InteractionRule { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as InteractionRule; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as InteractionRule; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval.length; i++) { + const value = node.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval[i]; + if (value != null && typeof value === "object") { + node.#_2rFyCF14HoyNjitj9PmCzek5iSsg_automaticApproval[i] = context.value(value); + } + } + } + } + + { + const array = node.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval.length; i++) { + const value = node.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval[i]; + if (value != null && typeof value === "object") { + node.#_sxj8y5XMMMBWUnRYFw85MKedCMj_manualApproval[i] = context.value(value); + } + } + } + } +} }); } + /** URIs of actors or collections whose interactions are automatically * approved without requiring manual review by the post author. * @@ -32468,10 +36240,10 @@ export class LikeAuthorization extends Object { } #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); /** * Constructs a new instance of LikeAuthorization with the given values. @@ -32546,8 +36318,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link LikeAuthorization.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -32599,12 +36371,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as LikeAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice();clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + const clone = super.clone(values, options) as unknown as LikeAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < vocabSparseArrayMinimumLength + ? this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice() : vocabCopyPropertyArray(this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject);clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = vocabCopyTrustSet( + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, + ); if ("interactingObject" in values && values.interactingObject != null) { if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { // @ts-ignore: type is checked above. clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; - clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] = 1; } else { throw new TypeError( "The interactingObject must be of type " + @@ -32612,12 +36388,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice();clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < vocabSparseArrayMinimumLength + ? this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice() : vocabCopyPropertyArray(this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget);clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = vocabCopyTrustSet( + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, + ); if ("interactionTarget" in values && values.interactionTarget != null) { if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { // @ts-ignore: type is checked above. clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; - clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] = 1; } else { throw new TypeError( "The interactionTarget must be of type " + @@ -32628,7 +36408,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): LikeAuthorization { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as LikeAuthorization; + + { + const array = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length; i++) { + const value = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i]; + if (value != null && typeof value === "object") { + node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length; i++) { + const value = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i]; + if (value != null && typeof value === "object") { + node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i] = context.value(value); + } + } + } + } +} }); } + async #fetchInteractingObject( url: URL, options: { @@ -32956,7 +36858,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; if (!(v instanceof URL) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://gotosocial.org/ns#interactingObject"); @@ -33024,7 +36927,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -33374,7 +37278,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; if (!(v instanceof URL) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://gotosocial.org/ns#interactionTarget"); @@ -33442,7 +37347,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -33819,7 +37725,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values["https://gotosocial.org/ns#interactingObject"]; @@ -33860,7 +37766,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values["https://gotosocial.org/ns#interactionTarget"]; @@ -34072,8 +37978,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link LikeRequest.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -34134,7 +38040,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as LikeRequest; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): LikeRequest { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -34466,10 +38448,10 @@ export class ReplyAuthorization extends Object { } #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); /** * Constructs a new instance of ReplyAuthorization with the given values. @@ -34544,8 +38526,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link ReplyAuthorization.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -34597,12 +38579,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as ReplyAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice();clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + const clone = super.clone(values, options) as unknown as ReplyAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < vocabSparseArrayMinimumLength + ? this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice() : vocabCopyPropertyArray(this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject);clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = vocabCopyTrustSet( + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, + ); if ("interactingObject" in values && values.interactingObject != null) { if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { // @ts-ignore: type is checked above. clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; - clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] = 1; } else { throw new TypeError( "The interactingObject must be of type " + @@ -34610,12 +38596,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice();clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < vocabSparseArrayMinimumLength + ? this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice() : vocabCopyPropertyArray(this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget);clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = vocabCopyTrustSet( + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, + ); if ("interactionTarget" in values && values.interactionTarget != null) { if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { // @ts-ignore: type is checked above. clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; - clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] = 1; } else { throw new TypeError( "The interactionTarget must be of type " + @@ -34626,7 +38616,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): ReplyAuthorization { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as ReplyAuthorization; + + { + const array = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length; i++) { + const value = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i]; + if (value != null && typeof value === "object") { + node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length; i++) { + const value = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i]; + if (value != null && typeof value === "object") { + node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i] = context.value(value); + } + } + } + } +} }); } + async #fetchInteractingObject( url: URL, options: { @@ -34954,7 +39066,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; if (!(v instanceof URL) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://gotosocial.org/ns#interactingObject"); @@ -35022,7 +39135,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -35372,7 +39486,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; if (!(v instanceof URL) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://gotosocial.org/ns#interactionTarget"); @@ -35440,7 +39555,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -35817,7 +39933,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values["https://gotosocial.org/ns#interactingObject"]; @@ -35858,7 +39974,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values["https://gotosocial.org/ns#interactionTarget"]; @@ -36070,8 +40186,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link ReplyRequest.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -36132,7 +40248,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as ReplyRequest; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): ReplyRequest { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -36464,10 +40656,10 @@ export class QuoteAuthorization extends Object { } #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); /** * Constructs a new instance of QuoteAuthorization with the given values. @@ -36542,8 +40734,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link QuoteAuthorization.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -36595,12 +40787,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as QuoteAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice();clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + const clone = super.clone(values, options) as unknown as QuoteAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < vocabSparseArrayMinimumLength + ? this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice() : vocabCopyPropertyArray(this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject);clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = vocabCopyTrustSet( + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, + ); if ("interactingObject" in values && values.interactingObject != null) { if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { // @ts-ignore: type is checked above. clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; - clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] = 1; } else { throw new TypeError( "The interactingObject must be of type " + @@ -36608,12 +40804,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice();clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < vocabSparseArrayMinimumLength + ? this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice() : vocabCopyPropertyArray(this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget);clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = vocabCopyTrustSet( + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, + ); if ("interactionTarget" in values && values.interactionTarget != null) { if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { // @ts-ignore: type is checked above. clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; - clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] = 1; } else { throw new TypeError( "The interactionTarget must be of type " + @@ -36624,7 +40824,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): QuoteAuthorization { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as QuoteAuthorization; + + { + const array = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length; i++) { + const value = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i]; + if (value != null && typeof value === "object") { + node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length; i++) { + const value = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i]; + if (value != null && typeof value === "object") { + node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i] = context.value(value); + } + } + } + } +} }); } + async #fetchInteractingObject( url: URL, options: { @@ -36951,7 +41273,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; if (!(v instanceof URL) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://gotosocial.org/ns#interactingObject"); @@ -37019,7 +41342,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -37369,7 +41693,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; if (!(v instanceof URL) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://gotosocial.org/ns#interactionTarget"); @@ -37437,7 +41762,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -37814,7 +42140,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values["https://gotosocial.org/ns#interactingObject"]; @@ -37855,7 +42181,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values["https://gotosocial.org/ns#interactionTarget"]; @@ -38067,8 +42393,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link QuoteRequest.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -38129,7 +42455,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as QuoteRequest; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): QuoteRequest { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -38530,7 +42932,7 @@ export class Translation { #_diXuPmFWiEqfLPhhrxg6Xc7ixZG: (Intl.Locale)[] = []; #_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR: Set = new Set(); + #_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR: VocabTrustSet = new Set(); #_Msz9PwRg7cWkiXPL4ixyQLtuuH7: (URL)[] = []; #_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated: (Temporal.Instant)[] = []; #_4KvkQNz1JjGs8S7iJDcGrUYETbUW: (URL)[] = []; @@ -38612,14 +43014,36 @@ urls?: ((URL | Link))[];} ); } - if (Array.isArray(values.translators) && - values.translators.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.translators)) { + const array = values.translators; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.translators; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = values.translators.slice(); + this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = copied; - for (let i = 0; i < values.translators.length; i++) { - this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.add(i); - } + vocabSetTrustPrefix(this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR, this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length); } else { throw new TypeError( @@ -38691,10 +43115,34 @@ urls?: ((URL | Link))[];} ); } - if (Array.isArray(values.urls) && - values.urls.every(v => v instanceof URL || v instanceof Link)) { + let copied!: (URL | Link)[]; + let valid = false; + if (Array.isArray(values.urls)) { + const array = values.urls; + const test = (v: URL | Link): boolean => v instanceof URL || v instanceof Link; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.urls; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls.slice(); + this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = copied; } else { throw new TypeError( @@ -38716,8 +43164,8 @@ urls?: ((URL | Link))[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Translation.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -38762,7 +43210,8 @@ urls?: ((URL | Link))[];} options ); copyPortableProvenance(this, clone); - clone.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG.slice(); + clone.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG.length < vocabSparseArrayMinimumLength + ? this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG.slice() : vocabCopyPropertyArray(this.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG); if ("language" in values && values.language != null) { if (values.language instanceof Intl.Locale) { // @ts-ignore: type is checked above. @@ -38775,12 +43224,16 @@ urls?: ((URL | Link))[];} ); } } - clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.slice();clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = new Set(this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR); + clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length < vocabSparseArrayMinimumLength + ? this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.slice() : vocabCopyPropertyArray(this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR);clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = vocabCopyTrustSet( + this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR, clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR, + ); if ("translator" in values && values.translator != null) { if (values.translator instanceof Application || values.translator instanceof Group || values.translator instanceof Organization || values.translator instanceof Person || values.translator instanceof Service || values.translator instanceof URL) { // @ts-ignore: type is checked above. clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = [values.translator]; - clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = new Set([0]); + clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = new Set(); + clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[vocabTrustPrefix] = 1; } else { throw new TypeError( "The translator must be of type " + @@ -38799,15 +43252,37 @@ urls?: ((URL | Link))[];} ); } - if (Array.isArray(values.translators) && - values.translators.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.translators)) { + const array = values.translators; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.translators; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = values.translators.slice(); + clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = copied; clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR = new Set(); - for (let i = 0; i < values.translators.length; i++) { - clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.add(i); - } + vocabSetTrustPrefix(clone.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR, clone.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length); } else { throw new TypeError( @@ -38816,7 +43291,8 @@ urls?: ((URL | Link))[];} ); } } - clone.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7 = this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7.slice(); + clone.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7 = this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7.length < vocabSparseArrayMinimumLength + ? this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7.slice() : vocabCopyPropertyArray(this.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7); if ("original" in values && values.original != null) { if (values.original instanceof URL) { // @ts-ignore: type is checked above. @@ -38829,7 +43305,8 @@ urls?: ((URL | Link))[];} ); } } - clone.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated.slice(); + clone.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated = this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated.length < vocabSparseArrayMinimumLength + ? this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated.slice() : vocabCopyPropertyArray(this.#_yTNTBtDbKTVj9kzyXpuk3rzbcGv_sourceUpdated); if ("sourceUpdated" in values && values.sourceUpdated != null) { if (isTemporalInstant(values.sourceUpdated)) { // @ts-ignore: type is checked above. @@ -38842,7 +43319,8 @@ urls?: ((URL | Link))[];} ); } } - clone.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW = this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW.slice(); + clone.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW = this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW.length < vocabSparseArrayMinimumLength + ? this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW.slice() : vocabCopyPropertyArray(this.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW); if ("basis" in values && values.basis != null) { if (values.basis instanceof URL) { // @ts-ignore: type is checked above. @@ -38855,7 +43333,8 @@ urls?: ((URL | Link))[];} ); } } - clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.slice(); + clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length < vocabSparseArrayMinimumLength + ? this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.slice() : vocabCopyPropertyArray(this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url); if ("url" in values && values.url != null) { if (values.url instanceof URL || values.url instanceof Link) { // @ts-ignore: type is checked above. @@ -38879,10 +43358,34 @@ urls?: ((URL | Link))[];} ); } - if (Array.isArray(values.urls) && - values.urls.every(v => v instanceof URL || v instanceof Link)) { + let copied!: (URL | Link)[]; + let valid = false; + if (Array.isArray(values.urls)) { + const array = values.urls; + const test = (v: URL | Link): boolean => v instanceof URL || v instanceof Link; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.urls; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = values.urls.slice(); + clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = copied; } else { throw new TypeError( @@ -38894,7 +43397,169 @@ urls?: ((URL | Link))[];} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +language?: Intl.Locale | null;translator?: Application | Group | Organization | Person | Service | URL | null; +translators?: (Application | Group | Organization | Person | Service | URL)[];original?: URL | null;sourceUpdated?: Temporal.Instant | null;basis?: URL | null;url?: URL | Link | null; +urls?: ((URL | Link))[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Translation { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Translation; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Translation; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.length; i++) { + const value = node.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[i]; + if (value != null && typeof value === "object") { + node.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[i] = context.value(value); + } + } + } + } + + { + const array = node.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7.length; i++) { + const value = node.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7[i]; + if (value != null && typeof value === "object") { + node.#_Msz9PwRg7cWkiXPL4ixyQLtuuH7[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW.length; i++) { + const value = node.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW[i]; + if (value != null && typeof value === "object") { + node.#_4KvkQNz1JjGs8S7iJDcGrUYETbUW[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url.length; i++) { + const value = node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[i]; + if (value != null && typeof value === "object") { + node.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url[i] = context.value(value); + } + } + } + } +} }); } + /** The translated language. Publishers must match a language in the * containing object's content, name, or summary map. * @@ -39301,7 +43966,8 @@ urls?: ((URL | Link))[];} } let v = this.#_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[0]; if (!(v instanceof URL) && - !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(0)) { + !(0 < (this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[vocabTrustPrefix] ?? 0) || + this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://schema.org/translator"); @@ -39369,7 +44035,8 @@ urls?: ((URL | Link))[];} mustDereferencePortableObject( this, null, v.id, options, )) && - !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(0)) { + !(0 < (this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[vocabTrustPrefix] ?? 0) || + this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -39462,7 +44129,8 @@ urls?: ((URL | Link))[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(i)) { + !(i < (this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[vocabTrustPrefix] ?? 0) || + this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://schema.org/translator"); @@ -39534,7 +44202,8 @@ urls?: ((URL | Link))[];} mustDereferencePortableObject( this, null, v.id, options, )) && - !this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(i)) { + !(i < (this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR[vocabTrustPrefix] ?? 0) || + this.#_trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -40146,7 +44815,7 @@ get urls(): ((URL | Link))[] { instance.#_diXuPmFWiEqfLPhhrxg6Xc7ixZG = _diXuPmFWiEqfLPhhrxg6Xc7ixZG; const _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR: Set = new Set(); + const _trust_hQqsdZa1zG8Ra1bQ3MBVsnmGnBR: VocabTrustSet = new Set(); let _hQqsdZa1zG8Ra1bQ3MBVsnmGnBR__array = values["https://schema.org/translator"]; @@ -40551,10 +45220,10 @@ export class FeatureAuthorization extends Object { } #_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + #_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); #_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + #_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); /** * Constructs a new instance of FeatureAuthorization with the given values. @@ -40629,8 +45298,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link FeatureAuthorization.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -40682,12 +45351,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as FeatureAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice();clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject); + const clone = super.clone(values, options) as unknown as FeatureAuthorization;clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length < vocabSparseArrayMinimumLength + ? this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.slice() : vocabCopyPropertyArray(this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject);clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = vocabCopyTrustSet( + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject, + ); if ("interactingObject" in values && values.interactingObject != null) { if (values.interactingObject instanceof Object || values.interactingObject instanceof URL) { // @ts-ignore: type is checked above. clone.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = [values.interactingObject]; - clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set([0]); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = new Set(); + clone.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] = 1; } else { throw new TypeError( "The interactingObject must be of type " + @@ -40695,12 +45368,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice();clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget); + clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length < vocabSparseArrayMinimumLength + ? this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.slice() : vocabCopyPropertyArray(this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget);clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = vocabCopyTrustSet( + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget, + ); if ("interactionTarget" in values && values.interactionTarget != null) { if (values.interactionTarget instanceof Object || values.interactionTarget instanceof URL) { // @ts-ignore: type is checked above. clone.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = [values.interactionTarget]; - clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set([0]); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget = new Set(); + clone.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] = 1; } else { throw new TypeError( "The interactionTarget must be of type " + @@ -40711,7 +45388,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];interactingObject?: Object | URL | null;interactionTarget?: Object | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): FeatureAuthorization { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as FeatureAuthorization; + + { + const array = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.length; i++) { + const value = node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i]; + if (value != null && typeof value === "object") { + node.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.length; i++) { + const value = node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i]; + if (value != null && typeof value === "object") { + node.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[i] = context.value(value); + } + } + } + } +} }); } + async #fetchInteractingObject( url: URL, options: { @@ -41037,7 +45836,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[0]; if (!(v instanceof URL) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://gotosocial.org/ns#interactingObject"); @@ -41105,7 +45905,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0)) { + !(0 < (this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject[vocabTrustPrefix] ?? 0) || + this.#_trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -41454,7 +46255,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[0]; if (!(v instanceof URL) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://gotosocial.org/ns#interactionTarget"); @@ -41522,7 +46324,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0)) { + !(0 < (this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget[vocabTrustPrefix] ?? 0) || + this.#_trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -41899,7 +46702,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: (Object | URL)[] = []; - const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: Set = new Set(); + const _trust_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject: VocabTrustSet = new Set(); let _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject__array = values["https://gotosocial.org/ns#interactingObject"]; @@ -41940,7 +46743,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject = _2114kRKbujWhxEUghdkRYYKbXTGi_interactingObject; const _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: (Object | URL)[] = []; - const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: Set = new Set(); + const _trust_2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget: VocabTrustSet = new Set(); let _2wHyG75YnN15CDMaFk3VNjByu4aL_interactionTarget__array = values["https://gotosocial.org/ns#interactionTarget"]; @@ -42149,8 +46952,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link FeatureRequest.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -42211,7 +47014,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as FeatureRequest; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): FeatureRequest { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -42541,40 +47420,40 @@ export class Collection extends Object { #_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems: (number)[] = []; #_3UyUdxnyn6cDn53QKrh4MBiearma_current: (CollectionPage | URL)[] = []; - #_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current: Set = new Set(); + #_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current: VocabTrustSet = new Set(); #_J52RqweMe6hhv7RnLJMC8BExTE5_first: (CollectionPage | URL)[] = []; - #_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first: Set = new Set(); + #_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first: VocabTrustSet = new Set(); #_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last: (CollectionPage | URL)[] = []; - #_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last: Set = new Set(); + #_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last: VocabTrustSet = new Set(); #_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: (Object | Link | URL)[] = []; - #_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: Set = new Set(); + #_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: VocabTrustSet = new Set(); #_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf: (Object | URL)[] = []; - #_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf: Set = new Set(); + #_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf: VocabTrustSet = new Set(); #_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf: (Object | URL)[] = []; - #_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf: Set = new Set(); + #_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf: VocabTrustSet = new Set(); #_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf: (Object | URL)[] = []; - #_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf: Set = new Set(); + #_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf: VocabTrustSet = new Set(); #_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf: (Object | URL)[] = []; - #_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf: Set = new Set(); + #_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf: VocabTrustSet = new Set(); #_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf: (Object | URL)[] = []; - #_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf: Set = new Set(); + #_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf: VocabTrustSet = new Set(); #_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf: (Object | URL)[] = []; - #_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf: Set = new Set(); + #_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf: VocabTrustSet = new Set(); #_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf: (Object | URL)[] = []; - #_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf: Set = new Set(); + #_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf: VocabTrustSet = new Set(); #_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf: (Object | URL)[] = []; - #_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf: Set = new Set(); + #_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf: VocabTrustSet = new Set(); /** * Constructs a new instance of Collection with the given values. @@ -42665,14 +47544,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu if ("items" in values && values.items != null) { - if (Array.isArray(values.items) && - values.items.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.items)) { + const array = values.items; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.items; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = values.items.slice(); + this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = copied; - for (let i = 0; i < values.items.length; i++) { - this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.add(i); - } + vocabSetTrustPrefix(this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length); } else { throw new TypeError( @@ -42798,8 +47699,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Collection.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -42851,7 +47752,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Collection;clone.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems = this.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems.slice(); + const clone = super.clone(values, options) as unknown as Collection;clone.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems = this.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems.length < vocabSparseArrayMinimumLength + ? this.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems.slice() : vocabCopyPropertyArray(this.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems); if ("totalItems" in values && values.totalItems != null) { if (typeof values.totalItems === "number" && Number.isInteger(values.totalItems) && values.totalItems >= 0) { // @ts-ignore: type is checked above. @@ -42864,12 +47766,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3UyUdxnyn6cDn53QKrh4MBiearma_current = this.#_3UyUdxnyn6cDn53QKrh4MBiearma_current.slice();clone.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current = new Set(this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current); + clone.#_3UyUdxnyn6cDn53QKrh4MBiearma_current = this.#_3UyUdxnyn6cDn53QKrh4MBiearma_current.length < vocabSparseArrayMinimumLength + ? this.#_3UyUdxnyn6cDn53QKrh4MBiearma_current.slice() : vocabCopyPropertyArray(this.#_3UyUdxnyn6cDn53QKrh4MBiearma_current);clone.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current = vocabCopyTrustSet( + this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current, clone.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current, + ); if ("current" in values && values.current != null) { if (values.current instanceof CollectionPage || values.current instanceof URL) { // @ts-ignore: type is checked above. clone.#_3UyUdxnyn6cDn53QKrh4MBiearma_current = [values.current]; - clone.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current = new Set([0]); + clone.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current = new Set(); + clone.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current[vocabTrustPrefix] = 1; } else { throw new TypeError( "The current must be of type " + @@ -42877,12 +47783,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_J52RqweMe6hhv7RnLJMC8BExTE5_first = this.#_J52RqweMe6hhv7RnLJMC8BExTE5_first.slice();clone.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first = new Set(this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first); + clone.#_J52RqweMe6hhv7RnLJMC8BExTE5_first = this.#_J52RqweMe6hhv7RnLJMC8BExTE5_first.length < vocabSparseArrayMinimumLength + ? this.#_J52RqweMe6hhv7RnLJMC8BExTE5_first.slice() : vocabCopyPropertyArray(this.#_J52RqweMe6hhv7RnLJMC8BExTE5_first);clone.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first = vocabCopyTrustSet( + this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first, clone.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first, + ); if ("first" in values && values.first != null) { if (values.first instanceof CollectionPage || values.first instanceof URL) { // @ts-ignore: type is checked above. clone.#_J52RqweMe6hhv7RnLJMC8BExTE5_first = [values.first]; - clone.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first = new Set([0]); + clone.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first = new Set(); + clone.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first[vocabTrustPrefix] = 1; } else { throw new TypeError( "The first must be of type " + @@ -42890,12 +47800,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.slice();clone.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = new Set(this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last); + clone.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.length < vocabSparseArrayMinimumLength + ? this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.slice() : vocabCopyPropertyArray(this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last);clone.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = vocabCopyTrustSet( + this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last, clone.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last, + ); if ("last" in values && values.last != null) { if (values.last instanceof CollectionPage || values.last instanceof URL) { // @ts-ignore: type is checked above. clone.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = [values.last]; - clone.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = new Set([0]); + clone.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = new Set(); + clone.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last[vocabTrustPrefix] = 1; } else { throw new TypeError( "The last must be of type " + @@ -42903,18 +47817,43 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.slice();clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = new Set(this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items); + clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length < vocabSparseArrayMinimumLength + ? this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.slice() : vocabCopyPropertyArray(this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items);clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = vocabCopyTrustSet( + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, + ); if ("items" in values && values.items != null) { - if (Array.isArray(values.items) && - values.items.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.items)) { + const array = values.items; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.items; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = values.items.slice(); + clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = copied; clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = new Set(); - for (let i = 0; i < values.items.length; i++) { - clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length); } else { throw new TypeError( @@ -42923,12 +47862,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = this.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.slice();clone.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = new Set(this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf); + clone.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = this.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.length < vocabSparseArrayMinimumLength + ? this.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.slice() : vocabCopyPropertyArray(this.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf);clone.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = vocabCopyTrustSet( + this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf, clone.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf, + ); if ("likesOf" in values && values.likesOf != null) { if (values.likesOf instanceof Object || values.likesOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = [values.likesOf]; - clone.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = new Set([0]); + clone.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = new Set(); + clone.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf[vocabTrustPrefix] = 1; } else { throw new TypeError( "The likesOf must be of type " + @@ -42936,12 +47879,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = this.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.slice();clone.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = new Set(this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf); + clone.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = this.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.length < vocabSparseArrayMinimumLength + ? this.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.slice() : vocabCopyPropertyArray(this.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf);clone.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = vocabCopyTrustSet( + this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf, clone.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf, + ); if ("sharesOf" in values && values.sharesOf != null) { if (values.sharesOf instanceof Object || values.sharesOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = [values.sharesOf]; - clone.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = new Set([0]); + clone.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = new Set(); + clone.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf[vocabTrustPrefix] = 1; } else { throw new TypeError( "The sharesOf must be of type " + @@ -42949,12 +47896,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = this.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.slice();clone.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = new Set(this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf); + clone.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = this.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.length < vocabSparseArrayMinimumLength + ? this.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.slice() : vocabCopyPropertyArray(this.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf);clone.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = vocabCopyTrustSet( + this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf, clone.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf, + ); if ("repliesOf" in values && values.repliesOf != null) { if (values.repliesOf instanceof Object || values.repliesOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = [values.repliesOf]; - clone.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = new Set([0]); + clone.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = new Set(); + clone.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf[vocabTrustPrefix] = 1; } else { throw new TypeError( "The repliesOf must be of type " + @@ -42962,12 +47913,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = this.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.slice();clone.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = new Set(this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf); + clone.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = this.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.length < vocabSparseArrayMinimumLength + ? this.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.slice() : vocabCopyPropertyArray(this.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf);clone.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = vocabCopyTrustSet( + this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf, clone.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf, + ); if ("inboxOf" in values && values.inboxOf != null) { if (values.inboxOf instanceof Object || values.inboxOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = [values.inboxOf]; - clone.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = new Set([0]); + clone.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = new Set(); + clone.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf[vocabTrustPrefix] = 1; } else { throw new TypeError( "The inboxOf must be of type " + @@ -42975,12 +47930,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = this.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.slice();clone.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = new Set(this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf); + clone.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = this.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.length < vocabSparseArrayMinimumLength + ? this.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.slice() : vocabCopyPropertyArray(this.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf);clone.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = vocabCopyTrustSet( + this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf, clone.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf, + ); if ("outboxOf" in values && values.outboxOf != null) { if (values.outboxOf instanceof Object || values.outboxOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = [values.outboxOf]; - clone.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = new Set([0]); + clone.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = new Set(); + clone.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf[vocabTrustPrefix] = 1; } else { throw new TypeError( "The outboxOf must be of type " + @@ -42988,12 +47947,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = this.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.slice();clone.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = new Set(this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf); + clone.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = this.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.length < vocabSparseArrayMinimumLength + ? this.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.slice() : vocabCopyPropertyArray(this.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf);clone.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = vocabCopyTrustSet( + this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf, clone.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf, + ); if ("followersOf" in values && values.followersOf != null) { if (values.followersOf instanceof Object || values.followersOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = [values.followersOf]; - clone.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = new Set([0]); + clone.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = new Set(); + clone.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf[vocabTrustPrefix] = 1; } else { throw new TypeError( "The followersOf must be of type " + @@ -43001,12 +47964,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = this.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.slice();clone.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = new Set(this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf); + clone.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = this.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.length < vocabSparseArrayMinimumLength + ? this.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.slice() : vocabCopyPropertyArray(this.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf);clone.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = vocabCopyTrustSet( + this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf, clone.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf, + ); if ("followingOf" in values && values.followingOf != null) { if (values.followingOf instanceof Object || values.followingOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = [values.followingOf]; - clone.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = new Set([0]); + clone.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = new Set(); + clone.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf[vocabTrustPrefix] = 1; } else { throw new TypeError( "The followingOf must be of type " + @@ -43014,12 +47981,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = this.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.slice();clone.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = new Set(this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf); + clone.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = this.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.length < vocabSparseArrayMinimumLength + ? this.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.slice() : vocabCopyPropertyArray(this.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf);clone.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = vocabCopyTrustSet( + this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf, clone.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf, + ); if ("likedOf" in values && values.likedOf != null) { if (values.likedOf instanceof Object || values.likedOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = [values.likedOf]; - clone.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = new Set([0]); + clone.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf = new Set(); + clone.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf[vocabTrustPrefix] = 1; } else { throw new TypeError( "The likedOf must be of type " + @@ -43030,7 +48001,349 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Collection { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Collection; + + { + const array = node.#_3UyUdxnyn6cDn53QKrh4MBiearma_current; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3UyUdxnyn6cDn53QKrh4MBiearma_current.length; i++) { + const value = node.#_3UyUdxnyn6cDn53QKrh4MBiearma_current[i]; + if (value != null && typeof value === "object") { + node.#_3UyUdxnyn6cDn53QKrh4MBiearma_current[i] = context.value(value); + } + } + } + } + + { + const array = node.#_J52RqweMe6hhv7RnLJMC8BExTE5_first; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_J52RqweMe6hhv7RnLJMC8BExTE5_first.length; i++) { + const value = node.#_J52RqweMe6hhv7RnLJMC8BExTE5_first[i]; + if (value != null && typeof value === "object") { + node.#_J52RqweMe6hhv7RnLJMC8BExTE5_first[i] = context.value(value); + } + } + } + } + + { + const array = node.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.length; i++) { + const value = node.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last[i]; + if (value != null && typeof value === "object") { + node.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length; i++) { + const value = node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[i]; + if (value != null && typeof value === "object") { + node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.length; i++) { + const value = node.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf[i]; + if (value != null && typeof value === "object") { + node.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.length; i++) { + const value = node.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf[i]; + if (value != null && typeof value === "object") { + node.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.length; i++) { + const value = node.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf[i]; + if (value != null && typeof value === "object") { + node.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.length; i++) { + const value = node.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf[i]; + if (value != null && typeof value === "object") { + node.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.length; i++) { + const value = node.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf[i]; + if (value != null && typeof value === "object") { + node.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.length; i++) { + const value = node.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf[i]; + if (value != null && typeof value === "object") { + node.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.length; i++) { + const value = node.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf[i]; + if (value != null && typeof value === "object") { + node.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.length; i++) { + const value = node.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf[i]; + if (value != null && typeof value === "object") { + node.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf[i] = context.value(value); + } + } + } + } +} }); } + /** A non-negative integer specifying the total number of objects contained by * the logical view of the collection. This number might not reflect the actual * number of items serialized within the {@link Collection} object instance. @@ -43374,7 +48687,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3UyUdxnyn6cDn53QKrh4MBiearma_current[0]; if (!(v instanceof URL) && - !this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current.has(0)) { + !(0 < (this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current[vocabTrustPrefix] ?? 0) || + this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#current"); @@ -43442,7 +48756,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current.has(0)) { + !(0 < (this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current[vocabTrustPrefix] ?? 0) || + this.#_trust_3UyUdxnyn6cDn53QKrh4MBiearma_current.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -43793,7 +49108,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_J52RqweMe6hhv7RnLJMC8BExTE5_first[0]; if (!(v instanceof URL) && - !this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first.has(0)) { + !(0 < (this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first[vocabTrustPrefix] ?? 0) || + this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#first"); @@ -43861,7 +49177,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first.has(0)) { + !(0 < (this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first[vocabTrustPrefix] ?? 0) || + this.#_trust_J52RqweMe6hhv7RnLJMC8BExTE5_first.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -44212,7 +49529,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last[0]; if (!(v instanceof URL) && - !this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.has(0)) { + !(0 < (this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last[vocabTrustPrefix] ?? 0) || + this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#last"); @@ -44280,7 +49598,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.has(0)) { + !(0 < (this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last[vocabTrustPrefix] ?? 0) || + this.#_trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -44646,7 +49965,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i)) { + !(i < (this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[vocabTrustPrefix] ?? 0) || + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#items"); @@ -44718,7 +50038,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i)) { + !(i < (this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[vocabTrustPrefix] ?? 0) || + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -45069,7 +50390,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf[0]; if (!(v instanceof URL) && - !this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.has(0)) { + !(0 < (this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf[vocabTrustPrefix] ?? 0) || + this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/5711#likesOf"); @@ -45137,7 +50459,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.has(0)) { + !(0 < (this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf[vocabTrustPrefix] ?? 0) || + this.#_trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -45487,7 +50810,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf[0]; if (!(v instanceof URL) && - !this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.has(0)) { + !(0 < (this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf[vocabTrustPrefix] ?? 0) || + this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/5711#sharesOf"); @@ -45555,7 +50879,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.has(0)) { + !(0 < (this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf[vocabTrustPrefix] ?? 0) || + this.#_trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -45905,7 +51230,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf[0]; if (!(v instanceof URL) && - !this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.has(0)) { + !(0 < (this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf[vocabTrustPrefix] ?? 0) || + this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/5711#repliesOf"); @@ -45973,7 +51299,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.has(0)) { + !(0 < (this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf[vocabTrustPrefix] ?? 0) || + this.#_trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -46323,7 +51650,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf[0]; if (!(v instanceof URL) && - !this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.has(0)) { + !(0 < (this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/5711#inboxOf"); @@ -46391,7 +51719,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.has(0)) { + !(0 < (this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -46741,7 +52070,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf[0]; if (!(v instanceof URL) && - !this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.has(0)) { + !(0 < (this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf[vocabTrustPrefix] ?? 0) || + this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/5711#outboxOf"); @@ -46809,7 +52139,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.has(0)) { + !(0 < (this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf[vocabTrustPrefix] ?? 0) || + this.#_trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -47159,7 +52490,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf[0]; if (!(v instanceof URL) && - !this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.has(0)) { + !(0 < (this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf[vocabTrustPrefix] ?? 0) || + this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/5711#followersOf"); @@ -47227,7 +52559,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.has(0)) { + !(0 < (this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf[vocabTrustPrefix] ?? 0) || + this.#_trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -47577,7 +52910,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf[0]; if (!(v instanceof URL) && - !this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.has(0)) { + !(0 < (this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/5711#followingOf"); @@ -47645,7 +52979,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.has(0)) { + !(0 < (this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -47995,7 +53330,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf[0]; if (!(v instanceof URL) && - !this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.has(0)) { + !(0 < (this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/5711#likedOf"); @@ -48063,7 +53399,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.has(0)) { + !(0 < (this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -48928,7 +54265,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_XDbmNDuWHmrhqH712zqtecdbv1V_totalItems = _XDbmNDuWHmrhqH712zqtecdbv1V_totalItems; const _3UyUdxnyn6cDn53QKrh4MBiearma_current: (CollectionPage | URL)[] = []; - const _trust_3UyUdxnyn6cDn53QKrh4MBiearma_current: Set = new Set(); + const _trust_3UyUdxnyn6cDn53QKrh4MBiearma_current: VocabTrustSet = new Set(); let _3UyUdxnyn6cDn53QKrh4MBiearma_current__array = values["https://www.w3.org/ns/activitystreams#current"]; @@ -48969,7 +54306,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_3UyUdxnyn6cDn53QKrh4MBiearma_current = _3UyUdxnyn6cDn53QKrh4MBiearma_current; const _J52RqweMe6hhv7RnLJMC8BExTE5_first: (CollectionPage | URL)[] = []; - const _trust_J52RqweMe6hhv7RnLJMC8BExTE5_first: Set = new Set(); + const _trust_J52RqweMe6hhv7RnLJMC8BExTE5_first: VocabTrustSet = new Set(); let _J52RqweMe6hhv7RnLJMC8BExTE5_first__array = values["https://www.w3.org/ns/activitystreams#first"]; @@ -49010,7 +54347,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_J52RqweMe6hhv7RnLJMC8BExTE5_first = _J52RqweMe6hhv7RnLJMC8BExTE5_first; const _gyJJnyEFnuNVi1HFZKfAn3Hfn26_last: (CollectionPage | URL)[] = []; - const _trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last: Set = new Set(); + const _trust_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last: VocabTrustSet = new Set(); let _gyJJnyEFnuNVi1HFZKfAn3Hfn26_last__array = values["https://www.w3.org/ns/activitystreams#last"]; @@ -49051,7 +54388,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_gyJJnyEFnuNVi1HFZKfAn3Hfn26_last = _gyJJnyEFnuNVi1HFZKfAn3Hfn26_last; const _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: (Object | Link | URL)[] = []; - const _trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: Set = new Set(); + const _trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: VocabTrustSet = new Set(); let _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items__array = values["https://www.w3.org/ns/activitystreams#items"]; @@ -49099,7 +54436,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items; const _4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf: (Object | URL)[] = []; - const _trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf: Set = new Set(); + const _trust_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf: VocabTrustSet = new Set(); let _4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf__array = values["https://w3id.org/fep/5711#likesOf"]; @@ -49140,7 +54477,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf = _4TB9Qd9ddtcZEpMfzbHhzafE6jaJ_likesOf; const _3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf: (Object | URL)[] = []; - const _trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf: Set = new Set(); + const _trust_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf: VocabTrustSet = new Set(); let _3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf__array = values["https://w3id.org/fep/5711#sharesOf"]; @@ -49181,7 +54518,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf = _3manzgeKiPsugpztKGiaUUwJ3ito_sharesOf; const _3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf: (Object | URL)[] = []; - const _trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf: Set = new Set(); + const _trust_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf: VocabTrustSet = new Set(); let _3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf__array = values["https://w3id.org/fep/5711#repliesOf"]; @@ -49222,7 +54559,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf = _3T3oGm3twpcQUcrnMisXQtmDZ32X_repliesOf; const _2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf: (Object | URL)[] = []; - const _trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf: Set = new Set(); + const _trust_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf: VocabTrustSet = new Set(); let _2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf__array = values["https://w3id.org/fep/5711#inboxOf"]; @@ -49263,7 +54600,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf = _2bvRkAFZjMfVD8jiUWZJr5YokSeN_inboxOf; const _4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf: (Object | URL)[] = []; - const _trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf: Set = new Set(); + const _trust_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf: VocabTrustSet = new Set(); let _4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf__array = values["https://w3id.org/fep/5711#outboxOf"]; @@ -49304,7 +54641,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf = _4AHzVZDxHjK6uEWa9UiKHGK34yYm_outboxOf; const _41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf: (Object | URL)[] = []; - const _trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf: Set = new Set(); + const _trust_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf: VocabTrustSet = new Set(); let _41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf__array = values["https://w3id.org/fep/5711#followersOf"]; @@ -49345,7 +54682,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf = _41aoZ5M6yRUHy3Zx8q6iuZQxtopb_followersOf; const _2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf: (Object | URL)[] = []; - const _trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf: Set = new Set(); + const _trust_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf: VocabTrustSet = new Set(); let _2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf__array = values["https://w3id.org/fep/5711#followingOf"]; @@ -49386,7 +54723,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf = _2nXT2Ah42UjEEQF5oJQ39CbKB1xj_followingOf; const _2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf: (Object | URL)[] = []; - const _trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf: Set = new Set(); + const _trust_2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf: VocabTrustSet = new Set(); let _2bsySzmT3qEZcrnoe3tZ5xBjXSju_likedOf__array = values["https://w3id.org/fep/5711#likedOf"]; @@ -49760,7 +55097,7 @@ export class OrderedCollection extends Collection { } #_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: (Object | Link | URL)[] = []; - #_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: Set = new Set(); + #_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: VocabTrustSet = new Set(); /** * Constructs a new instance of OrderedCollection with the given values. @@ -49799,14 +55136,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu super(values, options); if ("items" in values && values.items != null) { - if (Array.isArray(values.items) && - values.items.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.items)) { + const array = values.items; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.items; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = values.items.slice(); + this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = copied; - for (let i = 0; i < values.items.length; i++) { - this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.add(i); - } + vocabSetTrustPrefix(this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length); } else { throw new TypeError( @@ -49828,8 +55187,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link OrderedCollection.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -49881,18 +55240,43 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as OrderedCollection;clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.slice();clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = new Set(this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items); + const clone = super.clone(values, options) as unknown as OrderedCollection;clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length < vocabSparseArrayMinimumLength + ? this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.slice() : vocabCopyPropertyArray(this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items);clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = vocabCopyTrustSet( + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, + ); if ("items" in values && values.items != null) { - if (Array.isArray(values.items) && - values.items.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.items)) { + const array = values.items; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.items; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = values.items.slice(); + clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = copied; clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = new Set(); - for (let i = 0; i < values.items.length; i++) { - clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length); } else { throw new TypeError( @@ -49904,7 +55288,107 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;items?: (Object | Link | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): OrderedCollection { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as OrderedCollection; + + { + const array = node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length; i++) { + const value = node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[i]; + if (value != null && typeof value === "object") { + node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[i] = context.value(value); + } + } + } + } +} }); } + async #fetchItem( url: URL, options: { @@ -50247,7 +55731,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i)) { + !(i < (this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[vocabTrustPrefix] ?? 0) || + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#items"); @@ -50319,7 +55804,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i)) { + !(i < (this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[vocabTrustPrefix] ?? 0) || + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -50662,7 +56148,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: (Object | Link | URL)[] = []; - const _trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: Set = new Set(); + const _trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: VocabTrustSet = new Set(); let _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items__array = values["https://www.w3.org/ns/activitystreams#items"]; @@ -50878,8 +56364,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link FeaturedCollection.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -50931,7 +56417,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as FeaturedCollection;clone.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic = this.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic.slice(); + const clone = super.clone(values, options) as unknown as FeaturedCollection;clone.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic = this.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic.length < vocabSparseArrayMinimumLength + ? this.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic.slice() : vocabCopyPropertyArray(this.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic); if ("topic" in values && values.topic != null) { if (values.topic instanceof Hashtag) { // @ts-ignore: type is checked above. @@ -50944,7 +56431,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice(); + clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length < vocabSparseArrayMinimumLength + ? this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice() : vocabCopyPropertyArray(this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable); if ("discoverable" in values && values.discoverable != null) { if (typeof values.discoverable === "boolean") { // @ts-ignore: type is checked above. @@ -50960,7 +56448,107 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;items?: (Object | Link | URL)[];topic?: Hashtag | null;discoverable?: boolean | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): FeaturedCollection { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as FeaturedCollection; + + { + const array = node.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic.length; i++) { + const value = node.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic[i]; + if (value != null && typeof value === "object") { + node.#_pc4UXYHNrYa2zyQ8Bh7zvdZRKnZ_topic[i] = context.value(value); + } + } + } + } +} }); } + /** A single {@link Hashtag} object that represents the main topic or category * of this featured collection. * @@ -51514,10 +57102,10 @@ export class FeaturedItem extends Object { } #_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject: (Object | URL)[] = []; - #_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject: Set = new Set(); + #_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject: VocabTrustSet = new Set(); #_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization: (FeatureAuthorization | URL)[] = []; - #_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization: Set = new Set(); + #_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization: VocabTrustSet = new Set(); /** * Constructs a new instance of FeaturedItem with the given values. @@ -51592,8 +57180,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link FeaturedItem.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -51645,12 +57233,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as FeaturedItem;clone.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = this.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.slice();clone.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = new Set(this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject); + const clone = super.clone(values, options) as unknown as FeaturedItem;clone.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = this.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.length < vocabSparseArrayMinimumLength + ? this.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.slice() : vocabCopyPropertyArray(this.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject);clone.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = vocabCopyTrustSet( + this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject, clone.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject, + ); if ("featuredObject" in values && values.featuredObject != null) { if (values.featuredObject instanceof Object || values.featuredObject instanceof URL) { // @ts-ignore: type is checked above. clone.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = [values.featuredObject]; - clone.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = new Set([0]); + clone.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = new Set(); + clone.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject[vocabTrustPrefix] = 1; } else { throw new TypeError( "The featuredObject must be of type " + @@ -51658,12 +57250,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = this.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.slice();clone.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = new Set(this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization); + clone.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = this.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.slice() : vocabCopyPropertyArray(this.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization);clone.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = vocabCopyTrustSet( + this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization, clone.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization, + ); if ("featureAuthorization" in values && values.featureAuthorization != null) { if (values.featureAuthorization instanceof FeatureAuthorization || values.featureAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = [values.featureAuthorization]; - clone.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = new Set([0]); + clone.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization = new Set(); + clone.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( "The featureAuthorization must be of type " + @@ -51674,7 +57270,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];featuredObject?: Object | URL | null;featureAuthorization?: FeatureAuthorization | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): FeaturedItem { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as FeaturedItem; + + { + const array = node.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.length; i++) { + const value = node.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject[i]; + if (value != null && typeof value === "object") { + node.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.length; i++) { + const value = node.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization[i]; + if (value != null && typeof value === "object") { + node.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization[i] = context.value(value); + } + } + } + } +} }); } + async #fetchFeaturedObject( url: URL, options: { @@ -52000,7 +57718,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject[0]; if (!(v instanceof URL) && - !this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.has(0)) { + !(0 < (this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject[vocabTrustPrefix] ?? 0) || + this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/7aa9#featuredObject"); @@ -52068,7 +57787,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.has(0)) { + !(0 < (this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject[vocabTrustPrefix] ?? 0) || + this.#_trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -52419,7 +58139,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.has(0)) { + !(0 < (this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/7aa9#featureAuthorization"); @@ -52487,7 +58208,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.has(0)) { + !(0 < (this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -52864,7 +58586,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject: (Object | URL)[] = []; - const _trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject: Set = new Set(); + const _trust_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject: VocabTrustSet = new Set(); let _Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject__array = values["https://w3id.org/fep/7aa9#featuredObject"]; @@ -52905,7 +58627,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject = _Ht5F1pFtcuyJkybWck37rPhwyQv_featuredObject; const _2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization: (FeatureAuthorization | URL)[] = []; - const _trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization: Set = new Set(); + const _trust_2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization: VocabTrustSet = new Set(); let _2gG5sxnwav2sb69C22RbERtJ8rba_featureAuthorization__array = values["https://w3id.org/fep/7aa9#featureAuthorization"]; @@ -53190,10 +58912,34 @@ endpoints?: (URL)[];} ); } - if (Array.isArray(values.endpoints) && - values.endpoints.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.endpoints)) { + const array = values.endpoints; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.endpoints; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = values.endpoints.slice(); + this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = copied; } else { throw new TypeError( @@ -53215,8 +58961,8 @@ endpoints?: (URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link DidService.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -53260,7 +59006,8 @@ endpoints?: (URL)[];} options ); copyPortableProvenance(this, clone); - clone.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.slice(); + clone.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.length < vocabSparseArrayMinimumLength + ? this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.slice() : vocabCopyPropertyArray(this.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint); if ("endpoint" in values && values.endpoint != null) { if (values.endpoint instanceof URL) { // @ts-ignore: type is checked above. @@ -53284,10 +59031,34 @@ endpoints?: (URL)[];} ); } - if (Array.isArray(values.endpoints) && - values.endpoints.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.endpoints)) { + const array = values.endpoints; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.endpoints; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = values.endpoints.slice(); + clone.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint = copied; } else { throw new TypeError( @@ -53299,7 +59070,102 @@ endpoints?: (URL)[];} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +endpoint?: URL | null; +endpoints?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): DidService { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as DidService; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as DidService; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint.length; i++) { + const value = node.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint[i]; + if (value != null && typeof value === "object") { + node.#_2KM4fetG6FTJ1cphj76rzJ8Dyv7p_serviceEndpoint[i] = context.value(value); + } + } + } + } +} }); } + /** A network address, such as an HTTP URL, at which services operate on behalf * of a DID subject. * @@ -53747,8 +59613,8 @@ endpoints?: (URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Export.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -53788,7 +59654,62 @@ endpoints?: (URL)[];} const clone = super.clone(values, options) as unknown as Export; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +endpoint?: URL | null; +endpoints?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Export { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -54173,7 +60094,7 @@ export class DataIntegrityProof { #_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite: ("eddsa-jcs-2022")[] = []; #_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: (Multikey | URL)[] = []; - #_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: Set = new Set(); + #_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: VocabTrustSet = new Set(); #_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose: ("assertionMethod" | "authentication" | "capabilityInvocation" | "capabilityDelegation" | "keyAgreement")[] = []; #_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue: (Uint8Array)[] = []; #_3qzP3ukEZoUziK5FEiA1RhU4aqac: (Temporal.Instant)[] = []; @@ -54295,8 +60216,8 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link DataIntegrityProof.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -54339,7 +60260,8 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null options ); copyPortableProvenance(this, clone); - clone.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite.slice(); + clone.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite.length < vocabSparseArrayMinimumLength + ? this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite.slice() : vocabCopyPropertyArray(this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite); if ("cryptosuite" in values && values.cryptosuite != null) { if (values.cryptosuite == "eddsa-jcs-2022") { // @ts-ignore: type is checked above. @@ -54352,12 +60274,16 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null ); } } - clone.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.slice();clone.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = new Set(this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod); + clone.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.length < vocabSparseArrayMinimumLength + ? this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.slice() : vocabCopyPropertyArray(this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod);clone.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = vocabCopyTrustSet( + this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod, clone.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod, + ); if ("verificationMethod" in values && values.verificationMethod != null) { if (values.verificationMethod instanceof Multikey || values.verificationMethod instanceof URL) { // @ts-ignore: type is checked above. clone.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = [values.verificationMethod]; - clone.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = new Set([0]); + clone.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod = new Set(); + clone.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[vocabTrustPrefix] = 1; } else { throw new TypeError( "The verificationMethod must be of type " + @@ -54365,7 +60291,8 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null ); } } - clone.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose = this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose.slice(); + clone.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose = this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose.length < vocabSparseArrayMinimumLength + ? this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose.slice() : vocabCopyPropertyArray(this.#_2AeEnPcAvVrPEuKbpmn9ZKNmWHKb_proofPurpose); if ("proofPurpose" in values && values.proofPurpose != null) { if (values.proofPurpose === "assertionMethod" || values.proofPurpose === "authentication" || values.proofPurpose === "capabilityInvocation" || values.proofPurpose === "capabilityDelegation" || @@ -54380,7 +60307,8 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null ); } } - clone.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue.slice(); + clone.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue.length < vocabSparseArrayMinimumLength + ? this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue.slice() : vocabCopyPropertyArray(this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue); if ("proofValue" in values && values.proofValue != null) { if (values.proofValue instanceof Uint8Array) { // @ts-ignore: type is checked above. @@ -54393,7 +60321,8 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null ); } } - clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac.slice(); + clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac.length < vocabSparseArrayMinimumLength + ? this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac.slice() : vocabCopyPropertyArray(this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac); if ("created" in values && values.created != null) { if (isTemporalInstant(values.created)) { // @ts-ignore: type is checked above. @@ -54409,7 +60338,123 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null;proofPurpose?: "assertionMethod" | "authentication" | "capabilityInvocation" | "capabilityDelegation" | "keyAgreement" | null;proofValue?: Uint8Array | null;created?: Temporal.Instant | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): DataIntegrityProof { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as DataIntegrityProof; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as DataIntegrityProof; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.length; i++) { + const value = node.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[i]; + if (value != null && typeof value === "object") { + node.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue.length; i++) { + const value = node.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue[i]; + if (value != null && typeof value === "object") { + node.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue[i] = context.value(value); + } + } + } + } +} }); } + /** The cryptographic suite used to create the proof. * */ @@ -54753,7 +60798,8 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null } let v = this.#_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[0]; if (!(v instanceof URL) && - !this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.has(0)) { + !(0 < (this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#verificationMethod"); @@ -54787,7 +60833,8 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.has(0)) { + !(0 < (this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -55223,7 +61270,7 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null instance.#_3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite = _3RurJsa7tnptyqMFR5hDGcP9pMs5_cryptosuite; const _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: (Multikey | URL)[] = []; - const _trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: Set = new Set(); + const _trust_2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod: VocabTrustSet = new Set(); let _2mHVKxqA7zncjveJrDEo3pWpMZqg_verificationMethod__array = values["https://w3id.org/security#verificationMethod"]; @@ -55608,7 +61655,7 @@ export class CryptographicKey { } #_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: Set = new Set(); + #_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: VocabTrustSet = new Set(); #_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem: (CryptoKey)[] = []; /** @@ -55690,8 +61737,8 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link CryptographicKey.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -55734,12 +61781,16 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi options ); copyPortableProvenance(this, clone); - clone.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.slice();clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = new Set(this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner); + clone.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.length < vocabSparseArrayMinimumLength + ? this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.slice() : vocabCopyPropertyArray(this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner);clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = vocabCopyTrustSet( + this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner, clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner, + ); if ("owner" in values && values.owner != null) { if (values.owner instanceof Application || values.owner instanceof Group || values.owner instanceof Organization || values.owner instanceof Person || values.owner instanceof Service || values.owner instanceof URL) { // @ts-ignore: type is checked above. clone.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = [values.owner]; - clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = new Set([0]); + clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner = new Set(); + clone.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[vocabTrustPrefix] = 1; } else { throw new TypeError( "The owner must be of type " + @@ -55747,7 +61798,8 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi ); } } - clone.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem = this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem.slice(); + clone.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem = this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem.length < vocabSparseArrayMinimumLength + ? this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem.slice() : vocabCopyPropertyArray(this.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem); if ("publicKey" in values && values.publicKey != null) { if ( // @ts-ignore: CryptoKey exists in the global scope. @@ -55766,7 +61818,101 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +owner?: Application | Group | Organization | Person | Service | URL | null;publicKey?: CryptoKey | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): CryptographicKey { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as CryptographicKey; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as CryptographicKey; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.length; i++) { + const value = node.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[i]; + if (value != null && typeof value === "object") { + node.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[i] = context.value(value); + } + } + } + } +} }); } + async #fetchOwner( url: URL, options: { @@ -56152,7 +62298,8 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi } let v = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[0]; if (!(v instanceof URL) && - !this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.has(0)) { + !(0 < (this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[vocabTrustPrefix] ?? 0) || + this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#owner"); @@ -56220,7 +62367,8 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.has(0)) { + !(0 < (this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner[vocabTrustPrefix] ?? 0) || + this.#_trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -56591,7 +62739,7 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: Set = new Set(); + const _trust_5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner: VocabTrustSet = new Set(); let _5UJq9NDh3ZHgswFwwdVxQvJxdx2_owner__array = values["https://w3id.org/security#owner"]; @@ -56875,7 +63023,7 @@ export class Multikey { } #_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: Set = new Set(); + #_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: VocabTrustSet = new Set(); #_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase: (CryptoKey)[] = []; /** @@ -56957,8 +63105,8 @@ controller?: Application | Group | Organization | Person | Service | URL | null; * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Multikey.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -57001,12 +63149,16 @@ controller?: Application | Group | Organization | Person | Service | URL | null; options ); copyPortableProvenance(this, clone); - clone.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.slice();clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = new Set(this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller); + clone.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.length < vocabSparseArrayMinimumLength + ? this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.slice() : vocabCopyPropertyArray(this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller);clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = vocabCopyTrustSet( + this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller, clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller, + ); if ("controller" in values && values.controller != null) { if (values.controller instanceof Application || values.controller instanceof Group || values.controller instanceof Organization || values.controller instanceof Person || values.controller instanceof Service || values.controller instanceof URL) { // @ts-ignore: type is checked above. clone.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = [values.controller]; - clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = new Set([0]); + clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller = new Set(); + clone.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[vocabTrustPrefix] = 1; } else { throw new TypeError( "The controller must be of type " + @@ -57014,7 +63166,8 @@ controller?: Application | Group | Organization | Person | Service | URL | null; ); } } - clone.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase = this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase.slice(); + clone.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase = this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase.length < vocabSparseArrayMinimumLength + ? this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase.slice() : vocabCopyPropertyArray(this.#_4XLHbsR2gLVWU3NpEqKt9wANzn4F_publicKeyMultibase); if ("publicKey" in values && values.publicKey != null) { if ( // @ts-ignore: CryptoKey exists in the global scope. @@ -57033,7 +63186,101 @@ controller?: Application | Group | Organization | Person | Service | URL | null; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +controller?: Application | Group | Organization | Person | Service | URL | null;publicKey?: CryptoKey | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Multikey { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Multikey; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Multikey; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.length; i++) { + const value = node.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[i]; + if (value != null && typeof value === "object") { + node.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[i] = context.value(value); + } + } + } + } +} }); } + async #fetchController( url: URL, options: { @@ -57419,7 +63666,8 @@ controller?: Application | Group | Organization | Person | Service | URL | null; } let v = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[0]; if (!(v instanceof URL) && - !this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.has(0)) { + !(0 < (this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[vocabTrustPrefix] ?? 0) || + this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#controller"); @@ -57487,7 +63735,8 @@ controller?: Application | Group | Organization | Person | Service | URL | null; mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.has(0)) { + !(0 < (this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller[vocabTrustPrefix] ?? 0) || + this.#_trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -57865,7 +64114,7 @@ controller?: Application | Group | Organization | Person | Service | URL | null; let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: Set = new Set(); + const _trust_2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller: VocabTrustSet = new Set(); let _2yr3eUBTP6cNcyaxKzAXWjFsnGzN_controller__array = values["https://w3id.org/security#controller"]; @@ -58162,8 +64411,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Agreement.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -58215,7 +64464,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Agreement;clone.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates = this.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates.slice(); + const clone = super.clone(values, options) as unknown as Agreement;clone.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates = this.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates.length < vocabSparseArrayMinimumLength + ? this.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates.slice() : vocabCopyPropertyArray(this.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates); if ("stipulates" in values && values.stipulates != null) { if (values.stipulates instanceof Commitment) { // @ts-ignore: type is checked above. @@ -58228,7 +64478,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal = this.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal.slice(); + clone.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal = this.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal.length < vocabSparseArrayMinimumLength + ? this.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal.slice() : vocabCopyPropertyArray(this.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal); if ("stipulatesReciprocal" in values && values.stipulatesReciprocal != null) { if (values.stipulatesReciprocal instanceof Commitment) { // @ts-ignore: type is checked above. @@ -58244,7 +64495,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];stipulates?: Commitment | null;stipulatesReciprocal?: Commitment | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Agreement { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Agreement; + + { + const array = node.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates.length; i++) { + const value = node.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates[i]; + if (value != null && typeof value === "object") { + node.#_37zeAJ2NVyecrDdP8os69FGAn9Q6_stipulates[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal.length; i++) { + const value = node.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal[i]; + if (value != null && typeof value === "object") { + node.#_4Vhx9DcywF65XWUQ4KZ35475FaJm_stipulatesReciprocal[i] = context.value(value); + } + } + } + } +} }); } + /** The primary {@link Commitment} associated with the agreement. This * commitment satisfies the primary {@link Intent} of the corresponding * {@link Proposal}. @@ -58953,8 +65326,8 @@ satisfies?: URL | null;resourceQuantity?: Measure | null;} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Commitment.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -58997,7 +65370,8 @@ satisfies?: URL | null;resourceQuantity?: Measure | null;} options ); copyPortableProvenance(this, clone); - clone.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies = this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies.slice(); + clone.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies = this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies.length < vocabSparseArrayMinimumLength + ? this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies.slice() : vocabCopyPropertyArray(this.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies); if ("satisfies" in values && values.satisfies != null) { if (values.satisfies instanceof URL) { // @ts-ignore: type is checked above. @@ -59010,7 +65384,8 @@ satisfies?: URL | null;resourceQuantity?: Measure | null;} ); } } - clone.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.slice(); + clone.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.length < vocabSparseArrayMinimumLength + ? this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.slice() : vocabCopyPropertyArray(this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity); if ("resourceQuantity" in values && values.resourceQuantity != null) { if (values.resourceQuantity instanceof Measure) { // @ts-ignore: type is checked above. @@ -59026,7 +65401,123 @@ satisfies?: URL | null;resourceQuantity?: Measure | null;} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +satisfies?: URL | null;resourceQuantity?: Measure | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Commitment { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Commitment; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Commitment; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies.length; i++) { + const value = node.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies[i]; + if (value != null && typeof value === "object") { + node.#_aCyzDK9TkXtLxrZs7JC8emuYisv_satisfies[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.length; i++) { + const value = node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity[i]; + if (value != null && typeof value === "object") { + node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity[i] = context.value(value); + } + } + } + } +} }); } + /** The {@link Intent} of a {@link Proposal} that this commitment * satisfies. The value is the proposal's URI with a * [fragment](https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Fragment) @@ -59754,8 +66245,8 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Intent.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -59798,7 +66289,8 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur options ); copyPortableProvenance(this, clone); - clone.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action = this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.slice(); + clone.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action = this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.length < vocabSparseArrayMinimumLength + ? this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.slice() : vocabCopyPropertyArray(this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action); if ("action" in values && values.action != null) { if (typeof values.action === "string") { // @ts-ignore: type is checked above. @@ -59811,7 +66303,8 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur ); } } - clone.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo = this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.slice(); + clone.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo = this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.length < vocabSparseArrayMinimumLength + ? this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.slice() : vocabCopyPropertyArray(this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo); if ("resourceConformsTo" in values && values.resourceConformsTo != null) { if (values.resourceConformsTo instanceof URL) { // @ts-ignore: type is checked above. @@ -59824,7 +66317,8 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur ); } } - clone.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.slice(); + clone.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.length < vocabSparseArrayMinimumLength + ? this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.slice() : vocabCopyPropertyArray(this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity); if ("resourceQuantity" in values && values.resourceQuantity != null) { if (values.resourceQuantity instanceof Measure) { // @ts-ignore: type is checked above. @@ -59837,7 +66331,8 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur ); } } - clone.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity = this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.slice(); + clone.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity = this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.length < vocabSparseArrayMinimumLength + ? this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.slice() : vocabCopyPropertyArray(this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity); if ("availableQuantity" in values && values.availableQuantity != null) { if (values.availableQuantity instanceof Measure) { // @ts-ignore: type is checked above. @@ -59850,7 +66345,8 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur ); } } - clone.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.slice(); + clone.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.length < vocabSparseArrayMinimumLength + ? this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.slice() : vocabCopyPropertyArray(this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity); if ("minimumQuantity" in values && values.minimumQuantity != null) { if (values.minimumQuantity instanceof Measure) { // @ts-ignore: type is checked above. @@ -59866,7 +66362,167 @@ action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measur return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +action?: string | null;resourceConformsTo?: URL | null;resourceQuantity?: Measure | null;availableQuantity?: Measure | null;minimumQuantity?: Measure | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Intent { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Intent; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Intent; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.length; i++) { + const value = node.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo[i]; + if (value != null && typeof value === "object") { + node.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.length; i++) { + const value = node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity[i]; + if (value != null && typeof value === "object") { + node.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity[i] = context.value(value); + } + } + } + } + + { + const array = node.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.length; i++) { + const value = node.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity[i]; + if (value != null && typeof value === "object") { + node.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.length; i++) { + const value = node.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity[i]; + if (value != null && typeof value === "object") { + node.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity[i] = context.value(value); + } + } + } + } +} }); } + /** The type of economic transaction. The value of this property should be * either \`"deliverService"\` or \`"transfer"\`. * @@ -60824,8 +67480,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Proposal.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -60877,7 +67533,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Proposal;clone.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose = this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose.slice(); + const clone = super.clone(values, options) as unknown as Proposal;clone.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose = this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose.length < vocabSparseArrayMinimumLength + ? this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose.slice() : vocabCopyPropertyArray(this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose); if ("purpose" in values && values.purpose != null) { if (typeof values.purpose === "string") { // @ts-ignore: type is checked above. @@ -60890,7 +67547,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes = this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.slice(); + clone.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes = this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.length < vocabSparseArrayMinimumLength + ? this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.slice() : vocabCopyPropertyArray(this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes); if ("publishes" in values && values.publishes != null) { if (values.publishes instanceof Intent) { // @ts-ignore: type is checked above. @@ -60903,7 +67561,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal = this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.slice(); + clone.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal = this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.length < vocabSparseArrayMinimumLength + ? this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.slice() : vocabCopyPropertyArray(this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal); if ("reciprocal" in values && values.reciprocal != null) { if (values.reciprocal instanceof Intent) { // @ts-ignore: type is checked above. @@ -60916,7 +67575,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased.slice(); + clone.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased.length < vocabSparseArrayMinimumLength + ? this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased.slice() : vocabCopyPropertyArray(this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased); if ("unitBased" in values && values.unitBased != null) { if (typeof values.unitBased === "boolean") { // @ts-ignore: type is checked above. @@ -60932,7 +67592,129 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];purpose?: string | null;publishes?: Intent | null;reciprocal?: Intent | null;unitBased?: boolean | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Proposal { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Proposal; + + { + const array = node.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.length; i++) { + const value = node.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes[i]; + if (value != null && typeof value === "object") { + node.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes[i] = context.value(value); + } + } + } + } + + { + const array = node.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.length; i++) { + const value = node.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal[i]; + if (value != null && typeof value === "object") { + node.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal[i] = context.value(value); + } + } + } + } +} }); } + /** The type of proposal. Possible values are \`"offer"\` and \`"request"\`. * */ @@ -61743,8 +68525,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Accept.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -61805,7 +68587,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Accept; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Accept { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -62189,8 +69047,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Add.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -62251,7 +69109,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Add; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Add { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -62630,8 +69564,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Announce.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -62692,7 +69626,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Announce; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Announce { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -63017,39 +70027,39 @@ export class Application extends Object { #_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername: ((string | LanguageString))[] = []; #_axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); #_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); #_hQiaHhZP8hqxckxTBrpsGNs57E3: (URL)[] = []; #_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers: (boolean)[] = []; #_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); #_41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); #_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); #_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); #_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); #_4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); #_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); #_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); #_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); #_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints: (Endpoints)[] = []; #_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable: (boolean)[] = []; #_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended: (boolean)[] = []; @@ -63057,13 +70067,13 @@ export class Application extends Object { #_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable: (boolean)[] = []; #_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); #_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); #_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); #_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage: (string)[] = []; #_2xEU4QtkC53RAun67T81Egqt9vmL_isCat: (boolean)[] = []; #_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense: (URL)[] = []; @@ -63132,10 +70142,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === "string" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === "string" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -63168,14 +70202,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; - for (let i = 0; i < values.publicKeys.length; i++) { - this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -63208,14 +70264,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; - for (let i = 0; i < values.assertionMethods.length; i++) { - this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -63248,10 +70326,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -63380,14 +70482,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | if ("streams" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; - for (let i = 0; i < values.streams.length; i++) { - this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -63498,14 +70622,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; - for (let i = 0; i < values.aliases.length; i++) { - this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -63538,14 +70684,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; - for (let i = 0; i < values.services.length; i++) { - this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -63606,8 +70774,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Application.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -63665,7 +70833,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Application;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice(); + const clone = super.clone(values, options) as unknown as Application;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < vocabSparseArrayMinimumLength + ? this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice() : vocabCopyPropertyArray(this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername); if ("preferredUsername" in values && values.preferredUsername != null) { if (typeof values.preferredUsername === "string" || values.preferredUsername instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -63689,10 +70858,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === "string" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === "string" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -63701,12 +70894,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice();clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length < vocabSparseArrayMinimumLength + ? this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice() : vocabCopyPropertyArray(this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey);clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = vocabCopyTrustSet( + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, + ); if ("publicKey" in values && values.publicKey != null) { if (values.publicKey instanceof CryptographicKey || values.publicKey instanceof URL) { // @ts-ignore: type is checked above. clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = [values.publicKey]; - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set([0]); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] = 1; } else { throw new TypeError( "The publicKey must be of type " + @@ -63725,15 +70922,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); - for (let i = 0; i < values.publicKeys.length; i++) { - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -63742,12 +70961,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice();clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length < vocabSparseArrayMinimumLength + ? this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice() : vocabCopyPropertyArray(this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod);clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = vocabCopyTrustSet( + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, + ); if ("assertionMethod" in values && values.assertionMethod != null) { if (values.assertionMethod instanceof Multikey || values.assertionMethod instanceof URL) { // @ts-ignore: type is checked above. clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = [values.assertionMethod]; - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set([0]); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] = 1; } else { throw new TypeError( "The assertionMethod must be of type " + @@ -63766,15 +70989,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); - for (let i = 0; i < values.assertionMethods.length; i++) { - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -63783,7 +71028,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length < vocabSparseArrayMinimumLength + ? this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice() : vocabCopyPropertyArray(this.#_hQiaHhZP8hqxckxTBrpsGNs57E3); if ("gateway" in values && values.gateway != null) { if (values.gateway instanceof URL && isGatewayUrl(values.gateway)) { // @ts-ignore: type is checked above. @@ -63807,10 +71053,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -63819,7 +71089,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice(); + clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.length < vocabSparseArrayMinimumLength + ? this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice() : vocabCopyPropertyArray(this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers); if ("manuallyApprovesFollowers" in values && values.manuallyApprovesFollowers != null) { if (typeof values.manuallyApprovesFollowers === "boolean") { // @ts-ignore: type is checked above. @@ -63832,12 +71103,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice();clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox); + clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length < vocabSparseArrayMinimumLength + ? this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice() : vocabCopyPropertyArray(this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox);clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = vocabCopyTrustSet( + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, + ); if ("inbox" in values && values.inbox != null) { if (values.inbox instanceof OrderedCollection || values.inbox instanceof OrderedCollectionPage || values.inbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = [values.inbox]; - clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set([0]); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] = 1; } else { throw new TypeError( "The inbox must be of type " + @@ -63845,12 +71120,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice();clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox); + clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length < vocabSparseArrayMinimumLength + ? this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice() : vocabCopyPropertyArray(this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox);clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = vocabCopyTrustSet( + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, + ); if ("outbox" in values && values.outbox != null) { if (values.outbox instanceof OrderedCollection || values.outbox instanceof OrderedCollectionPage || values.outbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = [values.outbox]; - clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set([0]); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] = 1; } else { throw new TypeError( "The outbox must be of type " + @@ -63858,12 +71137,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice();clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following); + clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length < vocabSparseArrayMinimumLength + ? this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice() : vocabCopyPropertyArray(this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following);clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = vocabCopyTrustSet( + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, + ); if ("following" in values && values.following != null) { if (values.following instanceof Collection || values.following instanceof URL) { // @ts-ignore: type is checked above. clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = [values.following]; - clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set([0]); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] = 1; } else { throw new TypeError( "The following must be of type " + @@ -63871,12 +71154,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice();clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers); + clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length < vocabSparseArrayMinimumLength + ? this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice() : vocabCopyPropertyArray(this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers);clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = vocabCopyTrustSet( + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, + ); if ("followers" in values && values.followers != null) { if (values.followers instanceof Collection || values.followers instanceof URL) { // @ts-ignore: type is checked above. clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = [values.followers]; - clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set([0]); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] = 1; } else { throw new TypeError( "The followers must be of type " + @@ -63884,12 +71171,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice();clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked); + clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length < vocabSparseArrayMinimumLength + ? this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice() : vocabCopyPropertyArray(this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked);clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = vocabCopyTrustSet( + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, + ); if ("liked" in values && values.liked != null) { if (values.liked instanceof Collection || values.liked instanceof URL) { // @ts-ignore: type is checked above. clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = [values.liked]; - clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set([0]); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] = 1; } else { throw new TypeError( "The liked must be of type " + @@ -63897,12 +71188,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice();clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured); + clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length < vocabSparseArrayMinimumLength + ? this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice() : vocabCopyPropertyArray(this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured);clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = vocabCopyTrustSet( + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, + ); if ("featured" in values && values.featured != null) { if (values.featured instanceof Collection || values.featured instanceof URL) { // @ts-ignore: type is checked above. clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = [values.featured]; - clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set([0]); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] = 1; } else { throw new TypeError( "The featured must be of type " + @@ -63910,12 +71205,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice();clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags); + clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length < vocabSparseArrayMinimumLength + ? this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice() : vocabCopyPropertyArray(this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags);clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = vocabCopyTrustSet( + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, + ); if ("featuredTags" in values && values.featuredTags != null) { if (values.featuredTags instanceof Collection || values.featuredTags instanceof URL) { // @ts-ignore: type is checked above. clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = [values.featuredTags]; - clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set([0]); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] = 1; } else { throw new TypeError( "The featuredTags must be of type " + @@ -63923,12 +71222,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice();clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections); + clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length < vocabSparseArrayMinimumLength + ? this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice() : vocabCopyPropertyArray(this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections);clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = vocabCopyTrustSet( + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, + ); if ("featuredCollections" in values && values.featuredCollections != null) { if (values.featuredCollections instanceof Collection || values.featuredCollections instanceof URL) { // @ts-ignore: type is checked above. clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = [values.featuredCollections]; - clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set([0]); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] = 1; } else { throw new TypeError( "The featuredCollections must be of type " + @@ -63936,18 +71239,43 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice();clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length < vocabSparseArrayMinimumLength + ? this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice() : vocabCopyPropertyArray(this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams);clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = vocabCopyTrustSet( + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, + ); if ("streams" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(); - for (let i = 0; i < values.streams.length; i++) { - clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -63956,7 +71284,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice(); + clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length < vocabSparseArrayMinimumLength + ? this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice() : vocabCopyPropertyArray(this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints); if ("endpoints" in values && values.endpoints != null) { if (values.endpoints instanceof Endpoints) { // @ts-ignore: type is checked above. @@ -63969,7 +71298,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice(); + clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length < vocabSparseArrayMinimumLength + ? this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice() : vocabCopyPropertyArray(this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable); if ("discoverable" in values && values.discoverable != null) { if (typeof values.discoverable === "boolean") { // @ts-ignore: type is checked above. @@ -63982,7 +71312,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice(); + clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.length < vocabSparseArrayMinimumLength + ? this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice() : vocabCopyPropertyArray(this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended); if ("suspended" in values && values.suspended != null) { if (typeof values.suspended === "boolean") { // @ts-ignore: type is checked above. @@ -63995,7 +71326,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice(); + clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.length < vocabSparseArrayMinimumLength + ? this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice() : vocabCopyPropertyArray(this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial); if ("memorial" in values && values.memorial != null) { if (typeof values.memorial === "boolean") { // @ts-ignore: type is checked above. @@ -64008,7 +71340,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice(); + clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.length < vocabSparseArrayMinimumLength + ? this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice() : vocabCopyPropertyArray(this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable); if ("indexable" in values && values.indexable != null) { if (typeof values.indexable === "boolean") { // @ts-ignore: type is checked above. @@ -64021,12 +71354,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice();clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo); + clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length < vocabSparseArrayMinimumLength + ? this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice() : vocabCopyPropertyArray(this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo);clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = vocabCopyTrustSet( + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, + ); if ("successor" in values && values.successor != null) { if (values.successor instanceof Application || values.successor instanceof Group || values.successor instanceof Organization || values.successor instanceof Person || values.successor instanceof Service || values.successor instanceof URL) { // @ts-ignore: type is checked above. clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = [values.successor]; - clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set([0]); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] = 1; } else { throw new TypeError( "The successor must be of type " + @@ -64034,12 +71371,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice();clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length < vocabSparseArrayMinimumLength + ? this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice() : vocabCopyPropertyArray(this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs);clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = vocabCopyTrustSet( + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, + ); if ("alias" in values && values.alias != null) { if (values.alias instanceof Application || values.alias instanceof Group || values.alias instanceof Organization || values.alias instanceof Person || values.alias instanceof Service || values.alias instanceof URL) { // @ts-ignore: type is checked above. clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = [values.alias]; - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set([0]); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] = 1; } else { throw new TypeError( "The alias must be of type " + @@ -64058,15 +71399,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); - for (let i = 0; i < values.aliases.length; i++) { - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -64075,12 +71438,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice();clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length < vocabSparseArrayMinimumLength + ? this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice() : vocabCopyPropertyArray(this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service);clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = vocabCopyTrustSet( + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, + ); if ("service" in values && values.service != null) { if (values.service instanceof DidService || values.service instanceof URL) { // @ts-ignore: type is checked above. clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = [values.service]; - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set([0]); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] = 1; } else { throw new TypeError( "The service must be of type " + @@ -64099,15 +71466,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); - for (let i = 0; i < values.services.length; i++) { - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -64116,7 +71505,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice(); + clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.length < vocabSparseArrayMinimumLength + ? this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice() : vocabCopyPropertyArray(this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage); if ("followedMessage" in values && values.followedMessage != null) { if (typeof values.followedMessage === "string") { // @ts-ignore: type is checked above. @@ -64129,7 +71519,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice(); + clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.length < vocabSparseArrayMinimumLength + ? this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice() : vocabCopyPropertyArray(this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat); if ("cat" in values && values.cat != null) { if (typeof values.cat === "boolean") { // @ts-ignore: type is checked above. @@ -64142,7 +71533,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice(); + clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length < vocabSparseArrayMinimumLength + ? this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice() : vocabCopyPropertyArray(this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense); if ("preferredLicense" in values && values.preferredLicense != null) { if (values.preferredLicense instanceof URL) { // @ts-ignore: type is checked above. @@ -64158,7 +71550,465 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];preferredUsername?: string | LanguageString | null; +preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; +publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; +assertionMethods?: (Multikey | URL)[];gateway?: URL | null; +gateways?: (URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;featuredCollections?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; +aliases?: (Application | Group | Organization | Person | Service | URL)[];service?: DidService | URL | null; +services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | null;preferredLicense?: URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Application { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Application; + + { + const array = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length; i++) { + const value = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i]; + if (value != null && typeof value === "object") { + node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length; i++) { + const value = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i]; + if (value != null && typeof value === "object") { + node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i] = context.value(value); + } + } + } + } + + { + const array = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length; i++) { + const value = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i]; + if (value != null && typeof value === "object") { + node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length; i++) { + const value = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i]; + if (value != null && typeof value === "object") { + node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length; i++) { + const value = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i]; + if (value != null && typeof value === "object") { + node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length; i++) { + const value = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i]; + if (value != null && typeof value === "object") { + node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i] = context.value(value); + } + } + } + } + + { + const array = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length; i++) { + const value = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i]; + if (value != null && typeof value === "object") { + node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length; i++) { + const value = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i]; + if (value != null && typeof value === "object") { + node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length; i++) { + const value = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i]; + if (value != null && typeof value === "object") { + node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length; i++) { + const value = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i]; + if (value != null && typeof value === "object") { + node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i] = context.value(value); + } + } + } + } + + { + const array = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length; i++) { + const value = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i]; + if (value != null && typeof value === "object") { + node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length; i++) { + const value = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i]; + if (value != null && typeof value === "object") { + node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i] = context.value(value); + } + } + } + } + + { + const array = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length; i++) { + const value = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i]; + if (value != null && typeof value === "object") { + node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length; i++) { + const value = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i]; + if (value != null && typeof value === "object") { + node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length; i++) { + const value = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i]; + if (value != null && typeof value === "object") { + node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length; i++) { + const value = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i]; + if (value != null && typeof value === "object") { + node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i] = context.value(value); + } + } + } + } + + { + const array = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length; i++) { + const value = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i]; + if (value != null && typeof value === "object") { + node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i] = context.value(value); + } + } + } + } +} }); } + /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. * @@ -64507,7 +72357,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[0]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#publicKey"); @@ -64575,7 +72426,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -64662,7 +72514,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#publicKey"); @@ -64734,7 +72587,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -65088,7 +72942,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#assertionMethod"); @@ -65156,7 +73011,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -65247,7 +73103,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#assertionMethod"); @@ -65319,7 +73176,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -65743,7 +73601,8 @@ get gateways(): (URL)[] { } let v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0]; if (!(v instanceof URL) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "http://www.w3.org/ns/ldp#inbox"); @@ -65811,7 +73670,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -66185,7 +74045,8 @@ get gateways(): (URL)[] { } let v = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[0]; if (!(v instanceof URL) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#outbox"); @@ -66253,7 +74114,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -66607,7 +74469,8 @@ get gateways(): (URL)[] { } let v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0]; if (!(v instanceof URL) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#following"); @@ -66675,7 +74538,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -67032,7 +74896,8 @@ get gateways(): (URL)[] { } let v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0]; if (!(v instanceof URL) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#followers"); @@ -67100,7 +74965,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -67455,7 +75321,8 @@ get gateways(): (URL)[] { } let v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0]; if (!(v instanceof URL) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#liked"); @@ -67523,7 +75390,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -67876,7 +75744,8 @@ get gateways(): (URL)[] { } let v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[0]; if (!(v instanceof URL) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "http://joinmastodon.org/ns#featured"); @@ -67944,7 +75813,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -68297,7 +76167,8 @@ get gateways(): (URL)[] { } let v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0]; if (!(v instanceof URL) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "http://joinmastodon.org/ns#featuredTags"); @@ -68365,7 +76236,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -68715,7 +76587,8 @@ get gateways(): (URL)[] { } let v = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[0]; if (!(v instanceof URL) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/7aa9#featuredCollections"); @@ -68783,7 +76656,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -69133,7 +77007,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#streams"); @@ -69205,7 +77080,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -69690,7 +77566,8 @@ get gateways(): (URL)[] { } let v = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0]; if (!(v instanceof URL) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#movedTo"); @@ -69758,7 +77635,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -70171,7 +78049,8 @@ get gateways(): (URL)[] { } let v = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#alsoKnownAs"); @@ -70239,7 +78118,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -70330,7 +78210,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#alsoKnownAs"); @@ -70402,7 +78283,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -70756,7 +78638,8 @@ get gateways(): (URL)[] { } let v = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/did#service"); @@ -70824,7 +78707,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -70915,7 +78799,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/did#service"); @@ -70987,7 +78872,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -72386,7 +80272,7 @@ get gateways(): (URL)[] { instance.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; const _axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); let _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array = values["https://w3id.org/security#publicKey"]; @@ -72427,7 +80313,7 @@ get gateways(): (URL)[] { instance.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = _axq166E2eZADq34V4MYUc8KMZdC_publicKey; const _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); let _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array = values["https://w3id.org/security#assertionMethod"]; @@ -72526,7 +80412,7 @@ get gateways(): (URL)[] { instance.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers; const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); let _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array = values["http://www.w3.org/ns/ldp#inbox"]; @@ -72573,7 +80459,7 @@ get gateways(): (URL)[] { instance.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; const _41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); let _41QwhqJouoLg3h8dRPKat21brynC_outbox__array = values["https://www.w3.org/ns/activitystreams#outbox"]; @@ -72620,7 +80506,7 @@ get gateways(): (URL)[] { instance.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = _41QwhqJouoLg3h8dRPKat21brynC_outbox; const _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); let _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array = values["https://www.w3.org/ns/activitystreams#following"]; @@ -72661,7 +80547,7 @@ get gateways(): (URL)[] { instance.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; const _BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); let _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array = values["https://www.w3.org/ns/activitystreams#followers"]; @@ -72702,7 +80588,7 @@ get gateways(): (URL)[] { instance.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = _BBCTgfphhsFzpVfKTykGSpBNwoA_followers; const _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); let _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array = values["https://www.w3.org/ns/activitystreams#liked"]; @@ -72743,7 +80629,7 @@ get gateways(): (URL)[] { instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; const _4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); let _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array = values["http://joinmastodon.org/ns#featured"]; @@ -72784,7 +80670,7 @@ get gateways(): (URL)[] { instance.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = _4N1vBJzXDf8NbBumeECQMFvKetja_featured; const _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); let _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array = values["http://joinmastodon.org/ns#featuredTags"]; @@ -72825,7 +80711,7 @@ get gateways(): (URL)[] { instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; const _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); let _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections__array = values["https://w3id.org/fep/7aa9#featuredCollections"]; @@ -72866,7 +80752,7 @@ get gateways(): (URL)[] { instance.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); let _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array = values["https://www.w3.org/ns/activitystreams#streams"]; @@ -73055,7 +80941,7 @@ get gateways(): (URL)[] { instance.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable; const _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); let _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array = values["https://www.w3.org/ns/activitystreams#movedTo"]; @@ -73113,7 +80999,7 @@ get gateways(): (URL)[] { instance.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; const _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); let _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array = values["https://www.w3.org/ns/activitystreams#alsoKnownAs"]; @@ -73171,7 +81057,7 @@ get gateways(): (URL)[] { instance.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; const _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); let _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array = values["https://www.w3.org/ns/did#service"]; @@ -73940,46 +81826,127 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} -, +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + verifyPortableObject?: PortableObjectVerifier, + } = {}, + ) { + super(values, options);} + + /** + * Clones this instance, optionally updating it with the given values. + * + * This is a shallow copy: property arrays are copied, but nested objects + * and URLs are shared with this instance. Dereferencing accessors can cache + * fetched objects in the instance whose accessor is called. Hydrating a + * shared nested object through the clone can affect the original as well, + * and can change JSON-LD output when either is embedded in another + * object. Hydrating a top-level property of the clone does not update this + * instance's property. + * + * To resolve properties without sharing nested objects, use + * {@link IntransitiveActivity.deepClone} before hydration. + * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) + * for details, including how cached JSON-LD affects serialization. + * + * A clone never inherits a signed JSON-LD representation retained by + * \`signObject()\`: the clone may differ from the document that the proof + * covers, so embedding the original secured JSON in a parent document + * would be wrong. Sign the clone again if it has to be embedded as a + * secured child. + * + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance with its own property arrays. Nested objects + * and URLs are shared with this instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} + + = {}, options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, verifyPortableObject?: PortableObjectVerifier, - } = {}, - ) { - super(values, options);} + } = {} + ): IntransitiveActivity { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as IntransitiveActivity; + return clone; + } /** - * Clones this instance, optionally updating it with the given values. + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. * - * This is a shallow copy: property arrays are copied, but nested objects - * and URLs are shared with this instance. Dereferencing accessors can cache - * fetched objects in the instance whose accessor is called. Hydrating a - * shared nested object through the clone can affect the original as well, - * and can change JSON-LD output when either is embedded in another - * object. Hydrating a top-level property of the clone does not update this - * instance's property. + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. - * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) - * for details, including how cached JSON-LD affects serialization. + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. * - * A clone never inherits a signed JSON-LD representation retained by - * \`signObject()\`: the clone may differ from the document that the proof - * covers, so embedding the original secured JSON in a parent document - * would be wrong. Sign the clone again if it has to be embedded as a - * secured child. + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. * - * @param values The values to update the clone with. - * @param options The options to use for cloning. - * @returns The cloned instance with its own property arrays. Nested objects - * and URLs are shared with this instance. + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 */ - override clone( - values: - { + override deepClone(values: +{ id?: URL | null; attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; @@ -74004,26 +81971,21 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - verifyPortableObject?: PortableObjectVerifier, - } = {} - ): IntransitiveActivity { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - // @ts-ignore: $warning is not recognized as a property, but it is. - options = { ...options, $warning: this._warning }; - } - const clone = super.clone(values, options) as unknown as IntransitiveActivity; - return clone; += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): IntransitiveActivity { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -74414,8 +82376,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Arrive.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -74476,7 +82438,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Arrive; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Arrive { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -74800,11 +82838,11 @@ export class Article extends Object { } #_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); #_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; #_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); /** * Constructs a new instance of Article with the given values. @@ -74892,8 +82930,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Article.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -74945,12 +82983,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Article;clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice();clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote); + const clone = super.clone(values, options) as unknown as Article;clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length < vocabSparseArrayMinimumLength + ? this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice() : vocabCopyPropertyArray(this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote);clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = vocabCopyTrustSet( + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, + ); if ("quote" in values && values.quote != null) { if (values.quote instanceof Object || values.quote instanceof URL) { // @ts-ignore: type is checked above. clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = [values.quote]; - clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set([0]); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] = 1; } else { throw new TypeError( "The quote must be of type " + @@ -74958,7 +83000,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice(); + clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length < vocabSparseArrayMinimumLength + ? this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice() : vocabCopyPropertyArray(this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl); if ("quoteUrl" in values && values.quoteUrl != null) { if (values.quoteUrl instanceof URL) { // @ts-ignore: type is checked above. @@ -74971,12 +83014,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice();clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization); + clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice() : vocabCopyPropertyArray(this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization);clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = vocabCopyTrustSet( + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, + ); if ("quoteAuthorization" in values && values.quoteAuthorization != null) { if (values.quoteAuthorization instanceof QuoteAuthorization || values.quoteAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = [values.quoteAuthorization]; - clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set([0]); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( "The quoteAuthorization must be of type " + @@ -74987,7 +83034,151 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];quote?: Object | URL | null;quoteUrl?: URL | null;quoteAuthorization?: QuoteAuthorization | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Article { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Article; + + { + const array = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length; i++) { + const value = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i]; + if (value != null && typeof value === "object") { + node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i] = context.value(value); + } + } + } + } + + { + const array = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length; i++) { + const value = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i]; + if (value != null && typeof value === "object") { + node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i] = context.value(value); + } + } + } + } + + { + const array = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length; i++) { + const value = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i]; + if (value != null && typeof value === "object") { + node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i] = context.value(value); + } + } + } + } +} }); } + async #fetchQuote( url: URL, options: { @@ -75316,7 +83507,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[0]; if (!(v instanceof URL) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/044f#quote"); @@ -75384,7 +83576,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -75758,7 +83951,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/044f#quoteAuthorization"); @@ -75826,7 +84020,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -76253,7 +84448,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); let _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote__array = values["https://w3id.org/fep/044f#quote"]; @@ -76333,7 +84528,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; const _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); let _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization__array = values["https://w3id.org/fep/044f#quoteAuthorization"]; @@ -76591,8 +84786,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Document.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -76644,7 +84839,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Document;clone.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.slice(); + const clone = super.clone(values, options) as unknown as Document;clone.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.length < vocabSparseArrayMinimumLength + ? this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.slice() : vocabCopyPropertyArray(this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width); if ("width" in values && values.width != null) { if (typeof values.width === "number" && Number.isInteger(values.width) && values.width >= 0) { // @ts-ignore: type is checked above. @@ -76657,7 +84853,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.slice(); + clone.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.length < vocabSparseArrayMinimumLength + ? this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.slice() : vocabCopyPropertyArray(this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height); if ("height" in values && values.height != null) { if (typeof values.height === "number" && Number.isInteger(values.height) && values.height >= 0) { // @ts-ignore: type is checked above. @@ -76670,7 +84867,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase = this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase.slice(); + clone.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase = this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase.length < vocabSparseArrayMinimumLength + ? this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase.slice() : vocabCopyPropertyArray(this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase); if ("digestMultibase" in values && values.digestMultibase != null) { if (typeof values.digestMultibase === "string") { // @ts-ignore: type is checked above. @@ -76686,7 +84884,77 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];width?: number | null;height?: number | null;digestMultibase?: string | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Document { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** Specifies a hint as to the rendering width in * device-independent pixels of the linked resource. * @@ -77399,8 +85667,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Audio.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -77455,7 +85723,77 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const clone = super.clone(values, options) as unknown as Audio; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];width?: number | null;height?: number | null;digestMultibase?: string | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Audio { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -77831,46 +86169,127 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} -, +, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + tracerProvider?: TracerProvider, + verifyPortableObject?: PortableObjectVerifier, + } = {}, + ) { + super(values, options);} + + /** + * Clones this instance, optionally updating it with the given values. + * + * This is a shallow copy: property arrays are copied, but nested objects + * and URLs are shared with this instance. Dereferencing accessors can cache + * fetched objects in the instance whose accessor is called. Hydrating a + * shared nested object through the clone can affect the original as well, + * and can change JSON-LD output when either is embedded in another + * object. Hydrating a top-level property of the clone does not update this + * instance's property. + * + * To resolve properties without sharing nested objects, use + * {@link Ignore.deepClone} before hydration. + * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) + * for details, including how cached JSON-LD affects serialization. + * + * A clone never inherits a signed JSON-LD representation retained by + * \`signObject()\`: the clone may differ from the document that the proof + * covers, so embedding the original secured JSON in a parent document + * would be wrong. Sign the clone again if it has to be embedded as a + * secured child. + * + * @param values The values to update the clone with. + * @param options The options to use for cloning. + * @returns The cloned instance with its own property arrays. Nested objects + * and URLs are shared with this instance. + */ + override clone( + values: + { +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} + + = {}, options: { documentLoader?: DocumentLoader, contextLoader?: DocumentLoader, - tracerProvider?: TracerProvider, verifyPortableObject?: PortableObjectVerifier, - } = {}, - ) { - super(values, options);} + } = {} + ): Ignore { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as Ignore; + return clone; + } /** - * Clones this instance, optionally updating it with the given values. + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. * - * This is a shallow copy: property arrays are copied, but nested objects - * and URLs are shared with this instance. Dereferencing accessors can cache - * fetched objects in the instance whose accessor is called. Hydrating a - * shared nested object through the clone can affect the original as well, - * and can change JSON-LD output when either is embedded in another - * object. Hydrating a top-level property of the clone does not update this - * instance's property. + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. - * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) - * for details, including how cached JSON-LD affects serialization. + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. * - * A clone never inherits a signed JSON-LD representation retained by - * \`signObject()\`: the clone may differ from the document that the proof - * covers, so embedding the original secured JSON in a parent document - * would be wrong. Sign the clone again if it has to be embedded as a - * secured child. + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. * - * @param values The values to update the clone with. - * @param options The options to use for cloning. - * @returns The cloned instance with its own property arrays. Nested objects - * and URLs are shared with this instance. + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 */ - override clone( - values: - { + override deepClone(values: +{ id?: URL | null; attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; @@ -77895,26 +86314,21 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - verifyPortableObject?: PortableObjectVerifier, - } = {} - ): Ignore { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - // @ts-ignore: $warning is not recognized as a property, but it is. - options = { ...options, $warning: this._warning }; - } - const clone = super.clone(values, options) as unknown as Ignore; - return clone; += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Ignore { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -78298,8 +86712,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Block.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -78360,7 +86774,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Block; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Block { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -78687,13 +87177,13 @@ export class CollectionPage extends Collection { } #_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf: (Collection | URL)[] = []; - #_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf: Set = new Set(); + #_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf: VocabTrustSet = new Set(); #_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next: (CollectionPage | URL)[] = []; - #_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next: Set = new Set(); + #_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next: VocabTrustSet = new Set(); #_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev: (CollectionPage | URL)[] = []; - #_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev: Set = new Set(); + #_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev: VocabTrustSet = new Set(); /** * Constructs a new instance of CollectionPage with the given values. @@ -78781,8 +87271,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link CollectionPage.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -78834,12 +87324,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as CollectionPage;clone.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.slice();clone.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = new Set(this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf); + const clone = super.clone(values, options) as unknown as CollectionPage;clone.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.length < vocabSparseArrayMinimumLength + ? this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.slice() : vocabCopyPropertyArray(this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf);clone.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = vocabCopyTrustSet( + this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf, clone.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf, + ); if ("partOf" in values && values.partOf != null) { if (values.partOf instanceof Collection || values.partOf instanceof URL) { // @ts-ignore: type is checked above. clone.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = [values.partOf]; - clone.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = new Set([0]); + clone.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = new Set(); + clone.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf[vocabTrustPrefix] = 1; } else { throw new TypeError( "The partOf must be of type " + @@ -78847,12 +87341,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.slice();clone.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = new Set(this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next); + clone.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.length < vocabSparseArrayMinimumLength + ? this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.slice() : vocabCopyPropertyArray(this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next);clone.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = vocabCopyTrustSet( + this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next, clone.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next, + ); if ("next" in values && values.next != null) { if (values.next instanceof CollectionPage || values.next instanceof URL) { // @ts-ignore: type is checked above. clone.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = [values.next]; - clone.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = new Set([0]); + clone.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = new Set(); + clone.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next[vocabTrustPrefix] = 1; } else { throw new TypeError( "The next must be of type " + @@ -78860,12 +87358,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.slice();clone.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = new Set(this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev); + clone.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.length < vocabSparseArrayMinimumLength + ? this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.slice() : vocabCopyPropertyArray(this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev);clone.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = vocabCopyTrustSet( + this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev, clone.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev, + ); if ("prev" in values && values.prev != null) { if (values.prev instanceof CollectionPage || values.prev instanceof URL) { // @ts-ignore: type is checked above. clone.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = [values.prev]; - clone.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = new Set([0]); + clone.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev = new Set(); + clone.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev[vocabTrustPrefix] = 1; } else { throw new TypeError( "The prev must be of type " + @@ -78876,7 +87378,151 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;items?: (Object | Link | URL)[];likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): CollectionPage { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as CollectionPage; + + { + const array = node.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.length; i++) { + const value = node.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf[i]; + if (value != null && typeof value === "object") { + node.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.length; i++) { + const value = node.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next[i]; + if (value != null && typeof value === "object") { + node.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.length; i++) { + const value = node.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev[i]; + if (value != null && typeof value === "object") { + node.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev[i] = context.value(value); + } + } + } + } +} }); } + async #fetchPartOf( url: URL, options: { @@ -79204,7 +87850,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf[0]; if (!(v instanceof URL) && - !this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.has(0)) { + !(0 < (this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#partOf"); @@ -79272,7 +87919,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.has(0)) { + !(0 < (this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -79621,7 +88269,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next[0]; if (!(v instanceof URL) && - !this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.has(0)) { + !(0 < (this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next[vocabTrustPrefix] ?? 0) || + this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#next"); @@ -79689,7 +88338,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.has(0)) { + !(0 < (this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next[vocabTrustPrefix] ?? 0) || + this.#_trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -80039,7 +88689,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev[0]; if (!(v instanceof URL) && - !this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.has(0)) { + !(0 < (this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev[vocabTrustPrefix] ?? 0) || + this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#prev"); @@ -80107,7 +88758,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.has(0)) { + !(0 < (this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev[vocabTrustPrefix] ?? 0) || + this.#_trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -80528,7 +89180,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf: (Collection | URL)[] = []; - const _trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf: Set = new Set(); + const _trust_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf: VocabTrustSet = new Set(); let _2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf__array = values["https://www.w3.org/ns/activitystreams#partOf"]; @@ -80569,7 +89221,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf = _2kWgBhQKjEauxx8C6qF3ZQamK4Le_partOf; const _3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next: (CollectionPage | URL)[] = []; - const _trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next: Set = new Set(); + const _trust_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next: VocabTrustSet = new Set(); let _3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next__array = values["https://www.w3.org/ns/activitystreams#next"]; @@ -80610,7 +89262,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next = _3BT4kQLcXhHx7TAWaNDKh8nFn9eY_next; const _3b8yG8tDNzQFFEnWhCc13G8eHooA_prev: (CollectionPage | URL)[] = []; - const _trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev: Set = new Set(); + const _trust_3b8yG8tDNzQFFEnWhCc13G8eHooA_prev: VocabTrustSet = new Set(); let _3b8yG8tDNzQFFEnWhCc13G8eHooA_prev__array = values["https://www.w3.org/ns/activitystreams#prev"]; @@ -80832,8 +89484,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Create.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -80894,7 +89546,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Create; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Create { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -81272,8 +90000,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Delete.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -81334,7 +90062,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Delete; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Delete { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -81710,8 +90514,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Dislike.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -81772,7 +90576,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Dislike; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Dislike { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -82312,8 +91192,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Endpoints.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -82356,7 +91236,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint options ); copyPortableProvenance(this, clone); - clone.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl = this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl.slice(); + clone.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl = this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl.length < vocabSparseArrayMinimumLength + ? this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl.slice() : vocabCopyPropertyArray(this.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl); if ("proxyUrl" in values && values.proxyUrl != null) { if (values.proxyUrl instanceof URL) { // @ts-ignore: type is checked above. @@ -82369,7 +91250,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint ); } } - clone.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint = this.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint.slice(); + clone.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint = this.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint.length < vocabSparseArrayMinimumLength + ? this.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint.slice() : vocabCopyPropertyArray(this.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint); if ("oauthAuthorizationEndpoint" in values && values.oauthAuthorizationEndpoint != null) { if (values.oauthAuthorizationEndpoint instanceof URL) { // @ts-ignore: type is checked above. @@ -82382,7 +91264,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint ); } } - clone.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint = this.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint.slice(); + clone.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint = this.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint.length < vocabSparseArrayMinimumLength + ? this.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint.slice() : vocabCopyPropertyArray(this.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint); if ("oauthTokenEndpoint" in values && values.oauthTokenEndpoint != null) { if (values.oauthTokenEndpoint instanceof URL) { // @ts-ignore: type is checked above. @@ -82395,7 +91278,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint ); } } - clone.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey = this.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey.slice(); + clone.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey = this.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey.length < vocabSparseArrayMinimumLength + ? this.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey.slice() : vocabCopyPropertyArray(this.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey); if ("provideClientKey" in values && values.provideClientKey != null) { if (values.provideClientKey instanceof URL) { // @ts-ignore: type is checked above. @@ -82408,7 +91292,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint ); } } - clone.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey = this.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey.slice(); + clone.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey = this.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey.length < vocabSparseArrayMinimumLength + ? this.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey.slice() : vocabCopyPropertyArray(this.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey); if ("signClientKey" in values && values.signClientKey != null) { if (values.signClientKey instanceof URL) { // @ts-ignore: type is checked above. @@ -82421,7 +91306,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint ); } } - clone.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox = this.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox.slice(); + clone.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox = this.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox.length < vocabSparseArrayMinimumLength + ? this.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox.slice() : vocabCopyPropertyArray(this.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox); if ("sharedInbox" in values && values.sharedInbox != null) { if (values.sharedInbox instanceof URL) { // @ts-ignore: type is checked above. @@ -82434,7 +91320,8 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint ); } } - clone.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia = this.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia.slice(); + clone.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia = this.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia.length < vocabSparseArrayMinimumLength + ? this.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia.slice() : vocabCopyPropertyArray(this.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia); if ("uploadMedia" in values && values.uploadMedia != null) { if (values.uploadMedia instanceof URL) { // @ts-ignore: type is checked above. @@ -82450,7 +91337,233 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint?: URL | null;provideClientKey?: URL | null;signClientKey?: URL | null;sharedInbox?: URL | null;uploadMedia?: URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Endpoints { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Endpoints; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Endpoints; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl.length; i++) { + const value = node.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl[i]; + if (value != null && typeof value === "object") { + node.#_2JCYDbSxEHCCLdBYed33cCETfGyR_proxyUrl[i] = context.value(value); + } + } + } + } + + { + const array = node.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint.length; i++) { + const value = node.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint[i]; + if (value != null && typeof value === "object") { + node.#_25S6UmgzDead8hxL5sQFezZTAusd_oauthAuthorizationEndpoint[i] = context.value(value); + } + } + } + } + + { + const array = node.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint.length; i++) { + const value = node.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint[i]; + if (value != null && typeof value === "object") { + node.#_iAMxqrSba7yBCRB1FZ5kEVdKEZ3_oauthTokenEndpoint[i] = context.value(value); + } + } + } + } + + { + const array = node.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey.length; i++) { + const value = node.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey[i]; + if (value != null && typeof value === "object") { + node.#_8Bx9qN8oU7Bpt2xi6khaxWp1gMr_provideClientKey[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey.length; i++) { + const value = node.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey[i]; + if (value != null && typeof value === "object") { + node.#_3dU7PMVQZJpsCpo2F4RQXxBXdPmS_signClientKey[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox.length; i++) { + const value = node.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox[i]; + if (value != null && typeof value === "object") { + node.#_3JprUSDLVqqX4dwHRi37qGZZCRCc_sharedInbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia.length; i++) { + const value = node.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia[i]; + if (value != null && typeof value === "object") { + node.#_KukVKGqFRETxAxXA15YCYAA7XAT_uploadMedia[i] = context.value(value); + } + } + } + } +} }); } + /** Endpoint URI so this actor's clients may access remote ActivityStreams * objects which require authentication to access. To use this endpoint, * the client posts an \`x-www-form-urlencoded\` \`id\` parameter with the value @@ -83544,8 +92657,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Event.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -83600,7 +92713,77 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const clone = super.clone(values, options) as unknown as Event; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Event { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -83998,8 +93181,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Flag.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -84060,7 +93243,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Flag; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Flag { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -84440,8 +93699,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Follow.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -84502,7 +93761,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Follow; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Follow { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -84827,39 +94162,39 @@ export class Group extends Object { #_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername: ((string | LanguageString))[] = []; #_axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); #_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); #_hQiaHhZP8hqxckxTBrpsGNs57E3: (URL)[] = []; #_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers: (boolean)[] = []; #_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); #_41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); #_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); #_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); #_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); #_4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); #_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); #_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); #_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); #_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints: (Endpoints)[] = []; #_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable: (boolean)[] = []; #_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended: (boolean)[] = []; @@ -84867,13 +94202,13 @@ export class Group extends Object { #_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable: (boolean)[] = []; #_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); #_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); #_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); #_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage: (string)[] = []; #_2xEU4QtkC53RAun67T81Egqt9vmL_isCat: (boolean)[] = []; #_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense: (URL)[] = []; @@ -84942,10 +94277,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === "string" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === "string" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -84978,14 +94337,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; - for (let i = 0; i < values.publicKeys.length; i++) { - this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -85018,14 +94399,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; - for (let i = 0; i < values.assertionMethods.length; i++) { - this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -85058,10 +94461,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -85190,14 +94617,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | if ("streams" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; - for (let i = 0; i < values.streams.length; i++) { - this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -85308,14 +94757,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; - for (let i = 0; i < values.aliases.length; i++) { - this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -85348,14 +94819,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; - for (let i = 0; i < values.services.length; i++) { - this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -85416,8 +94909,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Group.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -85475,7 +94968,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Group;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice(); + const clone = super.clone(values, options) as unknown as Group;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < vocabSparseArrayMinimumLength + ? this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice() : vocabCopyPropertyArray(this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername); if ("preferredUsername" in values && values.preferredUsername != null) { if (typeof values.preferredUsername === "string" || values.preferredUsername instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -85499,10 +94993,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === "string" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === "string" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -85511,12 +95029,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice();clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length < vocabSparseArrayMinimumLength + ? this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice() : vocabCopyPropertyArray(this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey);clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = vocabCopyTrustSet( + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, + ); if ("publicKey" in values && values.publicKey != null) { if (values.publicKey instanceof CryptographicKey || values.publicKey instanceof URL) { // @ts-ignore: type is checked above. clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = [values.publicKey]; - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set([0]); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] = 1; } else { throw new TypeError( "The publicKey must be of type " + @@ -85535,15 +95057,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); - for (let i = 0; i < values.publicKeys.length; i++) { - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -85552,12 +95096,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice();clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length < vocabSparseArrayMinimumLength + ? this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice() : vocabCopyPropertyArray(this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod);clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = vocabCopyTrustSet( + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, + ); if ("assertionMethod" in values && values.assertionMethod != null) { if (values.assertionMethod instanceof Multikey || values.assertionMethod instanceof URL) { // @ts-ignore: type is checked above. clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = [values.assertionMethod]; - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set([0]); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] = 1; } else { throw new TypeError( "The assertionMethod must be of type " + @@ -85576,15 +95124,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); - for (let i = 0; i < values.assertionMethods.length; i++) { - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -85593,7 +95163,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length < vocabSparseArrayMinimumLength + ? this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice() : vocabCopyPropertyArray(this.#_hQiaHhZP8hqxckxTBrpsGNs57E3); if ("gateway" in values && values.gateway != null) { if (values.gateway instanceof URL && isGatewayUrl(values.gateway)) { // @ts-ignore: type is checked above. @@ -85617,10 +95188,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -85629,7 +95224,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice(); + clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.length < vocabSparseArrayMinimumLength + ? this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice() : vocabCopyPropertyArray(this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers); if ("manuallyApprovesFollowers" in values && values.manuallyApprovesFollowers != null) { if (typeof values.manuallyApprovesFollowers === "boolean") { // @ts-ignore: type is checked above. @@ -85642,12 +95238,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice();clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox); + clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length < vocabSparseArrayMinimumLength + ? this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice() : vocabCopyPropertyArray(this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox);clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = vocabCopyTrustSet( + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, + ); if ("inbox" in values && values.inbox != null) { if (values.inbox instanceof OrderedCollection || values.inbox instanceof OrderedCollectionPage || values.inbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = [values.inbox]; - clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set([0]); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] = 1; } else { throw new TypeError( "The inbox must be of type " + @@ -85655,12 +95255,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice();clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox); + clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length < vocabSparseArrayMinimumLength + ? this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice() : vocabCopyPropertyArray(this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox);clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = vocabCopyTrustSet( + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, + ); if ("outbox" in values && values.outbox != null) { if (values.outbox instanceof OrderedCollection || values.outbox instanceof OrderedCollectionPage || values.outbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = [values.outbox]; - clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set([0]); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] = 1; } else { throw new TypeError( "The outbox must be of type " + @@ -85668,12 +95272,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice();clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following); + clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length < vocabSparseArrayMinimumLength + ? this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice() : vocabCopyPropertyArray(this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following);clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = vocabCopyTrustSet( + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, + ); if ("following" in values && values.following != null) { if (values.following instanceof Collection || values.following instanceof URL) { // @ts-ignore: type is checked above. clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = [values.following]; - clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set([0]); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] = 1; } else { throw new TypeError( "The following must be of type " + @@ -85681,12 +95289,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice();clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers); + clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length < vocabSparseArrayMinimumLength + ? this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice() : vocabCopyPropertyArray(this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers);clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = vocabCopyTrustSet( + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, + ); if ("followers" in values && values.followers != null) { if (values.followers instanceof Collection || values.followers instanceof URL) { // @ts-ignore: type is checked above. clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = [values.followers]; - clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set([0]); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] = 1; } else { throw new TypeError( "The followers must be of type " + @@ -85694,12 +95306,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice();clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked); + clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length < vocabSparseArrayMinimumLength + ? this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice() : vocabCopyPropertyArray(this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked);clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = vocabCopyTrustSet( + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, + ); if ("liked" in values && values.liked != null) { if (values.liked instanceof Collection || values.liked instanceof URL) { // @ts-ignore: type is checked above. clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = [values.liked]; - clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set([0]); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] = 1; } else { throw new TypeError( "The liked must be of type " + @@ -85707,12 +95323,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice();clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured); + clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length < vocabSparseArrayMinimumLength + ? this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice() : vocabCopyPropertyArray(this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured);clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = vocabCopyTrustSet( + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, + ); if ("featured" in values && values.featured != null) { if (values.featured instanceof Collection || values.featured instanceof URL) { // @ts-ignore: type is checked above. clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = [values.featured]; - clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set([0]); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] = 1; } else { throw new TypeError( "The featured must be of type " + @@ -85720,12 +95340,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice();clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags); + clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length < vocabSparseArrayMinimumLength + ? this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice() : vocabCopyPropertyArray(this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags);clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = vocabCopyTrustSet( + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, + ); if ("featuredTags" in values && values.featuredTags != null) { if (values.featuredTags instanceof Collection || values.featuredTags instanceof URL) { // @ts-ignore: type is checked above. clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = [values.featuredTags]; - clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set([0]); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] = 1; } else { throw new TypeError( "The featuredTags must be of type " + @@ -85733,12 +95357,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice();clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections); + clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length < vocabSparseArrayMinimumLength + ? this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice() : vocabCopyPropertyArray(this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections);clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = vocabCopyTrustSet( + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, + ); if ("featuredCollections" in values && values.featuredCollections != null) { if (values.featuredCollections instanceof Collection || values.featuredCollections instanceof URL) { // @ts-ignore: type is checked above. clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = [values.featuredCollections]; - clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set([0]); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] = 1; } else { throw new TypeError( "The featuredCollections must be of type " + @@ -85746,18 +95374,43 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice();clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length < vocabSparseArrayMinimumLength + ? this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice() : vocabCopyPropertyArray(this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams);clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = vocabCopyTrustSet( + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, + ); if ("streams" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(); - for (let i = 0; i < values.streams.length; i++) { - clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -85766,7 +95419,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice(); + clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length < vocabSparseArrayMinimumLength + ? this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice() : vocabCopyPropertyArray(this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints); if ("endpoints" in values && values.endpoints != null) { if (values.endpoints instanceof Endpoints) { // @ts-ignore: type is checked above. @@ -85779,7 +95433,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice(); + clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length < vocabSparseArrayMinimumLength + ? this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice() : vocabCopyPropertyArray(this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable); if ("discoverable" in values && values.discoverable != null) { if (typeof values.discoverable === "boolean") { // @ts-ignore: type is checked above. @@ -85792,7 +95447,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice(); + clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.length < vocabSparseArrayMinimumLength + ? this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice() : vocabCopyPropertyArray(this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended); if ("suspended" in values && values.suspended != null) { if (typeof values.suspended === "boolean") { // @ts-ignore: type is checked above. @@ -85805,7 +95461,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice(); + clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.length < vocabSparseArrayMinimumLength + ? this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice() : vocabCopyPropertyArray(this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial); if ("memorial" in values && values.memorial != null) { if (typeof values.memorial === "boolean") { // @ts-ignore: type is checked above. @@ -85818,7 +95475,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice(); + clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.length < vocabSparseArrayMinimumLength + ? this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice() : vocabCopyPropertyArray(this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable); if ("indexable" in values && values.indexable != null) { if (typeof values.indexable === "boolean") { // @ts-ignore: type is checked above. @@ -85831,12 +95489,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice();clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo); + clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length < vocabSparseArrayMinimumLength + ? this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice() : vocabCopyPropertyArray(this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo);clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = vocabCopyTrustSet( + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, + ); if ("successor" in values && values.successor != null) { if (values.successor instanceof Application || values.successor instanceof Group || values.successor instanceof Organization || values.successor instanceof Person || values.successor instanceof Service || values.successor instanceof URL) { // @ts-ignore: type is checked above. clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = [values.successor]; - clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set([0]); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] = 1; } else { throw new TypeError( "The successor must be of type " + @@ -85844,12 +95506,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice();clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length < vocabSparseArrayMinimumLength + ? this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice() : vocabCopyPropertyArray(this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs);clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = vocabCopyTrustSet( + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, + ); if ("alias" in values && values.alias != null) { if (values.alias instanceof Application || values.alias instanceof Group || values.alias instanceof Organization || values.alias instanceof Person || values.alias instanceof Service || values.alias instanceof URL) { // @ts-ignore: type is checked above. clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = [values.alias]; - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set([0]); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] = 1; } else { throw new TypeError( "The alias must be of type " + @@ -85868,15 +95534,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); - for (let i = 0; i < values.aliases.length; i++) { - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -85885,12 +95573,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice();clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length < vocabSparseArrayMinimumLength + ? this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice() : vocabCopyPropertyArray(this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service);clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = vocabCopyTrustSet( + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, + ); if ("service" in values && values.service != null) { if (values.service instanceof DidService || values.service instanceof URL) { // @ts-ignore: type is checked above. clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = [values.service]; - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set([0]); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] = 1; } else { throw new TypeError( "The service must be of type " + @@ -85909,15 +95601,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); - for (let i = 0; i < values.services.length; i++) { - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -85926,7 +95640,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice(); + clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.length < vocabSparseArrayMinimumLength + ? this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice() : vocabCopyPropertyArray(this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage); if ("followedMessage" in values && values.followedMessage != null) { if (typeof values.followedMessage === "string") { // @ts-ignore: type is checked above. @@ -85939,7 +95654,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice(); + clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.length < vocabSparseArrayMinimumLength + ? this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice() : vocabCopyPropertyArray(this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat); if ("cat" in values && values.cat != null) { if (typeof values.cat === "boolean") { // @ts-ignore: type is checked above. @@ -85952,7 +95668,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice(); + clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length < vocabSparseArrayMinimumLength + ? this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice() : vocabCopyPropertyArray(this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense); if ("preferredLicense" in values && values.preferredLicense != null) { if (values.preferredLicense instanceof URL) { // @ts-ignore: type is checked above. @@ -85968,7 +95685,465 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];preferredUsername?: string | LanguageString | null; +preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; +publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; +assertionMethods?: (Multikey | URL)[];gateway?: URL | null; +gateways?: (URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;featuredCollections?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; +aliases?: (Application | Group | Organization | Person | Service | URL)[];service?: DidService | URL | null; +services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | null;preferredLicense?: URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Group { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Group; + + { + const array = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length; i++) { + const value = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i]; + if (value != null && typeof value === "object") { + node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length; i++) { + const value = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i]; + if (value != null && typeof value === "object") { + node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i] = context.value(value); + } + } + } + } + + { + const array = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length; i++) { + const value = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i]; + if (value != null && typeof value === "object") { + node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length; i++) { + const value = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i]; + if (value != null && typeof value === "object") { + node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length; i++) { + const value = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i]; + if (value != null && typeof value === "object") { + node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length; i++) { + const value = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i]; + if (value != null && typeof value === "object") { + node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i] = context.value(value); + } + } + } + } + + { + const array = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length; i++) { + const value = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i]; + if (value != null && typeof value === "object") { + node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length; i++) { + const value = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i]; + if (value != null && typeof value === "object") { + node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length; i++) { + const value = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i]; + if (value != null && typeof value === "object") { + node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length; i++) { + const value = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i]; + if (value != null && typeof value === "object") { + node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i] = context.value(value); + } + } + } + } + + { + const array = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length; i++) { + const value = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i]; + if (value != null && typeof value === "object") { + node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length; i++) { + const value = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i]; + if (value != null && typeof value === "object") { + node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i] = context.value(value); + } + } + } + } + + { + const array = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length; i++) { + const value = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i]; + if (value != null && typeof value === "object") { + node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length; i++) { + const value = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i]; + if (value != null && typeof value === "object") { + node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length; i++) { + const value = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i]; + if (value != null && typeof value === "object") { + node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length; i++) { + const value = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i]; + if (value != null && typeof value === "object") { + node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i] = context.value(value); + } + } + } + } + + { + const array = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length; i++) { + const value = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i]; + if (value != null && typeof value === "object") { + node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i] = context.value(value); + } + } + } + } +} }); } + /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. * @@ -86317,7 +96492,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[0]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#publicKey"); @@ -86385,7 +96561,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -86472,7 +96649,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#publicKey"); @@ -86544,7 +96722,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -86898,7 +97077,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#assertionMethod"); @@ -86966,7 +97146,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -87057,7 +97238,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#assertionMethod"); @@ -87129,7 +97311,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -87553,7 +97736,8 @@ get gateways(): (URL)[] { } let v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0]; if (!(v instanceof URL) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "http://www.w3.org/ns/ldp#inbox"); @@ -87621,7 +97805,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -87995,7 +98180,8 @@ get gateways(): (URL)[] { } let v = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[0]; if (!(v instanceof URL) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#outbox"); @@ -88063,7 +98249,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -88417,7 +98604,8 @@ get gateways(): (URL)[] { } let v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0]; if (!(v instanceof URL) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#following"); @@ -88485,7 +98673,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -88842,7 +99031,8 @@ get gateways(): (URL)[] { } let v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0]; if (!(v instanceof URL) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#followers"); @@ -88910,7 +99100,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -89265,7 +99456,8 @@ get gateways(): (URL)[] { } let v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0]; if (!(v instanceof URL) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#liked"); @@ -89333,7 +99525,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -89686,7 +99879,8 @@ get gateways(): (URL)[] { } let v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[0]; if (!(v instanceof URL) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "http://joinmastodon.org/ns#featured"); @@ -89754,7 +99948,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -90107,7 +100302,8 @@ get gateways(): (URL)[] { } let v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0]; if (!(v instanceof URL) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "http://joinmastodon.org/ns#featuredTags"); @@ -90175,7 +100371,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -90525,7 +100722,8 @@ get gateways(): (URL)[] { } let v = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[0]; if (!(v instanceof URL) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/7aa9#featuredCollections"); @@ -90593,7 +100791,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -90943,7 +101142,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#streams"); @@ -91015,7 +101215,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -91500,7 +101701,8 @@ get gateways(): (URL)[] { } let v = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0]; if (!(v instanceof URL) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#movedTo"); @@ -91568,7 +101770,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -91981,7 +102184,8 @@ get gateways(): (URL)[] { } let v = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#alsoKnownAs"); @@ -92049,7 +102253,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -92140,7 +102345,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#alsoKnownAs"); @@ -92212,7 +102418,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -92566,7 +102773,8 @@ get gateways(): (URL)[] { } let v = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/did#service"); @@ -92634,7 +102842,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -92725,7 +102934,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/did#service"); @@ -92797,7 +103007,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -94196,7 +104407,7 @@ get gateways(): (URL)[] { instance.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; const _axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); let _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array = values["https://w3id.org/security#publicKey"]; @@ -94237,7 +104448,7 @@ get gateways(): (URL)[] { instance.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = _axq166E2eZADq34V4MYUc8KMZdC_publicKey; const _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); let _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array = values["https://w3id.org/security#assertionMethod"]; @@ -94336,7 +104547,7 @@ get gateways(): (URL)[] { instance.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers; const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); let _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array = values["http://www.w3.org/ns/ldp#inbox"]; @@ -94383,7 +104594,7 @@ get gateways(): (URL)[] { instance.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; const _41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); let _41QwhqJouoLg3h8dRPKat21brynC_outbox__array = values["https://www.w3.org/ns/activitystreams#outbox"]; @@ -94430,7 +104641,7 @@ get gateways(): (URL)[] { instance.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = _41QwhqJouoLg3h8dRPKat21brynC_outbox; const _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); let _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array = values["https://www.w3.org/ns/activitystreams#following"]; @@ -94471,7 +104682,7 @@ get gateways(): (URL)[] { instance.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; const _BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); let _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array = values["https://www.w3.org/ns/activitystreams#followers"]; @@ -94512,7 +104723,7 @@ get gateways(): (URL)[] { instance.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = _BBCTgfphhsFzpVfKTykGSpBNwoA_followers; const _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); let _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array = values["https://www.w3.org/ns/activitystreams#liked"]; @@ -94553,7 +104764,7 @@ get gateways(): (URL)[] { instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; const _4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); let _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array = values["http://joinmastodon.org/ns#featured"]; @@ -94594,7 +104805,7 @@ get gateways(): (URL)[] { instance.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = _4N1vBJzXDf8NbBumeECQMFvKetja_featured; const _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); let _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array = values["http://joinmastodon.org/ns#featuredTags"]; @@ -94635,7 +104846,7 @@ get gateways(): (URL)[] { instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; const _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); let _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections__array = values["https://w3id.org/fep/7aa9#featuredCollections"]; @@ -94676,7 +104887,7 @@ get gateways(): (URL)[] { instance.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); let _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array = values["https://www.w3.org/ns/activitystreams#streams"]; @@ -94865,7 +105076,7 @@ get gateways(): (URL)[] { instance.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable; const _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); let _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array = values["https://www.w3.org/ns/activitystreams#movedTo"]; @@ -94923,7 +105134,7 @@ get gateways(): (URL)[] { instance.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; const _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); let _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array = values["https://www.w3.org/ns/activitystreams#alsoKnownAs"]; @@ -94981,7 +105192,7 @@ get gateways(): (URL)[] { instance.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; const _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); let _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array = values["https://www.w3.org/ns/did#service"]; @@ -95801,7 +106012,7 @@ export class Link { #_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width: (number)[] = []; #_gCVTegXxWWCw6wWRxa1QF65zusg_preview: (Link | Object | URL)[] = []; - #_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: Set = new Set(); + #_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: VocabTrustSet = new Set(); #_2rzkBRS4gNPrkJk9DohHAMUAxA2d: (URL)[] = []; /** @@ -95880,10 +106091,34 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } - if (Array.isArray(values.rels) && - values.rels.every(v => typeof v === "string")) { + let copied!: (string)[]; + let valid = false; + if (Array.isArray(values.rels)) { + const array = values.rels; + const test = (v: string): boolean => typeof v === "string"; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.rels; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel = values.rels.slice(); + this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel = copied; } else { throw new TypeError( @@ -95942,10 +106177,34 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } - if (Array.isArray(values.names) && - values.names.every(v => typeof v === "string" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.names)) { + const array = values.names; + const test = (v: string | LanguageString): boolean => typeof v === "string" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.names; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = values.names.slice(); + this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = copied; } else { throw new TypeError( @@ -95996,14 +106255,36 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num if ("previews" in values && values.previews != null) { - if (Array.isArray(values.previews) && - values.previews.every(v => v instanceof Link || v instanceof Object || v instanceof URL)) { + let copied!: (Link | Object | URL)[]; + let valid = false; + if (Array.isArray(values.previews)) { + const array = values.previews; + const test = (v: Link | Object | URL): boolean => v instanceof Link || v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.previews; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = values.previews.slice(); + this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = copied; - for (let i = 0; i < values.previews.length; i++) { - this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.add(i); - } + vocabSetTrustPrefix(this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length); } else { throw new TypeError( @@ -96015,10 +106296,34 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num if ("licenses" in values && values.licenses != null) { - if (Array.isArray(values.licenses) && - values.licenses.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.licenses)) { + const array = values.licenses; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.licenses; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = values.licenses.slice(); + this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = copied; } else { throw new TypeError( @@ -96040,8 +106345,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Link.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -96086,7 +106391,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num options ); copyPortableProvenance(this, clone); - clone.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href = this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href.slice(); + clone.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href = this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href.length < vocabSparseArrayMinimumLength + ? this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href.slice() : vocabCopyPropertyArray(this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href); if ("href" in values && values.href != null) { if (values.href instanceof URL) { // @ts-ignore: type is checked above. @@ -96099,7 +106405,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel = this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel.slice(); + clone.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel = this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel.length < vocabSparseArrayMinimumLength + ? this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel.slice() : vocabCopyPropertyArray(this.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel); if ("rel" in values && values.rel != null) { if (typeof values.rel === "string") { // @ts-ignore: type is checked above. @@ -96123,10 +106430,34 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } - if (Array.isArray(values.rels) && - values.rels.every(v => typeof v === "string")) { + let copied!: (string)[]; + let valid = false; + if (Array.isArray(values.rels)) { + const array = values.rels; + const test = (v: string): boolean => typeof v === "string"; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.rels; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel = values.rels.slice(); + clone.#_2a1c5GkfkQsnyyLybF8UXBQfFuHZ_rel = copied; } else { throw new TypeError( @@ -96135,7 +106466,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.slice(); + clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.length < vocabSparseArrayMinimumLength + ? this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.slice() : vocabCopyPropertyArray(this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType); if ("mediaType" in values && values.mediaType != null) { if (typeof values.mediaType === "string") { // @ts-ignore: type is checked above. @@ -96148,7 +106480,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase = this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase.slice(); + clone.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase = this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase.length < vocabSparseArrayMinimumLength + ? this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase.slice() : vocabCopyPropertyArray(this.#_2ydcBe182LRq82jFGE6Rxw6VfvEM_digestMultibase); if ("digestMultibase" in values && values.digestMultibase != null) { if (typeof values.digestMultibase === "string") { // @ts-ignore: type is checked above. @@ -96161,7 +106494,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.slice(); + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.length < vocabSparseArrayMinimumLength + ? this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name.slice() : vocabCopyPropertyArray(this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name); if ("name" in values && values.name != null) { if (typeof values.name === "string" || values.name instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -96185,10 +106519,34 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } - if (Array.isArray(values.names) && - values.names.every(v => typeof v === "string" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.names)) { + const array = values.names; + const test = (v: string | LanguageString): boolean => typeof v === "string" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.names; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = values.names.slice(); + clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = copied; } else { throw new TypeError( @@ -96197,7 +106555,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang = this.#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang.slice(); + clone.#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang = this.#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang.length < vocabSparseArrayMinimumLength + ? this.#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang.slice() : vocabCopyPropertyArray(this.#_f57HKWCp1YRBbTJE8PF12RbDJGf_hreflang); if ("language" in values && values.language != null) { if (values.language instanceof Intl.Locale) { // @ts-ignore: type is checked above. @@ -96210,7 +106569,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.slice(); + clone.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height = this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.length < vocabSparseArrayMinimumLength + ? this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height.slice() : vocabCopyPropertyArray(this.#_2cGKFeFJMmiNpGZFEF75mCwFQsKb_height); if ("height" in values && values.height != null) { if (typeof values.height === "number" && Number.isInteger(values.height) && values.height >= 0) { // @ts-ignore: type is checked above. @@ -96223,7 +106583,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.slice(); + clone.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.length < vocabSparseArrayMinimumLength + ? this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width.slice() : vocabCopyPropertyArray(this.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width); if ("width" in values && values.width != null) { if (typeof values.width === "number" && Number.isInteger(values.width) && values.width >= 0) { // @ts-ignore: type is checked above. @@ -96236,18 +106597,43 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.slice();clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = new Set(this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview); + clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length < vocabSparseArrayMinimumLength + ? this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.slice() : vocabCopyPropertyArray(this.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview);clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = vocabCopyTrustSet( + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, + ); if ("previews" in values && values.previews != null) { - if (Array.isArray(values.previews) && - values.previews.every(v => v instanceof Link || v instanceof Object || v instanceof URL)) { + let copied!: (Link | Object | URL)[]; + let valid = false; + if (Array.isArray(values.previews)) { + const array = values.previews; + const test = (v: Link | Object | URL): boolean => v instanceof Link || v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.previews; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = values.previews.slice(); + clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview = copied; clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview = new Set(); - for (let i = 0; i < values.previews.length; i++) { - clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.add(i); - } + vocabSetTrustPrefix(clone.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview, clone.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length); } else { throw new TypeError( @@ -96256,13 +106642,38 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num ); } } - clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.slice(); + clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.length < vocabSparseArrayMinimumLength + ? this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.slice() : vocabCopyPropertyArray(this.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d); if ("licenses" in values && values.licenses != null) { - if (Array.isArray(values.licenses) && - values.licenses.every(v => v instanceof URL)) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.licenses)) { + const array = values.licenses; + const test = (v: URL): boolean => v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.licenses; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = values.licenses.slice(); + clone.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d = copied; } else { throw new TypeError( @@ -96274,7 +106685,147 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +href?: URL | null;rel?: string | null; +rels?: (string)[];mediaType?: string | null;digestMultibase?: string | null;name?: string | LanguageString | null; +names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: number | null;width?: number | null;previews?: (Link | Object | URL)[];licenses?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Link { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Link; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Link; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + + { + const array = node.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href.length; i++) { + const value = node.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href[i]; + if (value != null && typeof value === "object") { + node.#_pVjLsybKQdmkjuU7MHjiVmNnuj7_href[i] = context.value(value); + } + } + } + } + + { + const array = node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview.length; i++) { + const value = node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview[i]; + if (value != null && typeof value === "object") { + node.#_gCVTegXxWWCw6wWRxa1QF65zusg_preview[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d.length; i++) { + const value = node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d[i]; + if (value != null && typeof value === "object") { + node.#_2rzkBRS4gNPrkJk9DohHAMUAxA2d[i] = context.value(value); + } + } + } + } +} }); } + /** The target resource pointed to by a {@link Link}. */ get href(): (URL | null) { @@ -96760,7 +107311,8 @@ get names(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i)) { + !(i < (this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview[vocabTrustPrefix] ?? 0) || + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#preview"); @@ -96832,7 +107384,8 @@ get names(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i)) { + !(i < (this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview[vocabTrustPrefix] ?? 0) || + this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -97751,7 +108304,7 @@ get licenses(): (URL)[] { instance.#_2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width = _2e9AP7WdHBJYAgXG6GEyq7nSkNMe_width; const _gCVTegXxWWCw6wWRxa1QF65zusg_preview: (Link | Object | URL)[] = []; - const _trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: Set = new Set(); + const _trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview: VocabTrustSet = new Set(); let _gCVTegXxWWCw6wWRxa1QF65zusg_preview__array = values["https://www.w3.org/ns/activitystreams#preview"]; @@ -98171,8 +108724,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Hashtag.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -98213,7 +108766,63 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num const clone = super.clone(values, options) as unknown as Hashtag; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +href?: URL | null;rel?: string | null; +rels?: (string)[];mediaType?: string | null;digestMultibase?: string | null;name?: string | LanguageString | null; +names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: number | null;width?: number | null;previews?: (Link | Object | URL)[];licenses?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Hashtag { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -98591,8 +109200,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Image.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -98647,7 +109256,77 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const clone = super.clone(values, options) as unknown as Image; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];width?: number | null;height?: number | null;digestMultibase?: string | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Image { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -99045,8 +109724,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Offer.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -99088,26 +109767,102 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - verifyPortableObject?: PortableObjectVerifier, - } = {} - ): Offer { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - // @ts-ignore: $warning is not recognized as a property, but it is. - options = { ...options, $warning: this._warning }; - } - const clone = super.clone(values, options) as unknown as Offer; - return clone; + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {} + ): Offer { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as Offer; + return clone; + } + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Offer { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -99489,8 +110244,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Invite.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -99551,7 +110306,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Invite; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Invite { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -99929,8 +110760,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Join.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -99991,7 +110822,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Join; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Join { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -100369,8 +111276,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Leave.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -100431,7 +111338,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Leave; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Leave { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -100809,8 +111792,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Like.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -100871,7 +111854,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Like; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Like { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -101247,8 +112306,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Listen.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -101309,7 +112368,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Listen; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Listen { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -101665,8 +112800,8 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Mention.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -101707,7 +112842,63 @@ names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: num const clone = super.clone(values, options) as unknown as Mention; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +href?: URL | null;rel?: string | null; +rels?: (string)[];mediaType?: string | null;digestMultibase?: string | null;name?: string | LanguageString | null; +names?: ((string | LanguageString))[];language?: Intl.Locale | null;height?: number | null;width?: number | null;previews?: (Link | Object | URL)[];licenses?: (URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Mention { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -102094,8 +113285,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Move.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -102137,26 +113328,102 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - verifyPortableObject?: PortableObjectVerifier, - } = {} - ): Move { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - // @ts-ignore: $warning is not recognized as a property, but it is. - options = { ...options, $warning: this._warning }; - } - const clone = super.clone(values, options) as unknown as Move; - return clone; + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {} + ): Move { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as Move; + return clone; + } + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Move { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -102482,11 +113749,11 @@ export class Note extends Object { } #_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); #_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; #_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); /** * Constructs a new instance of Note with the given values. @@ -102574,8 +113841,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Note.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -102627,12 +113894,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Note;clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice();clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote); + const clone = super.clone(values, options) as unknown as Note;clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length < vocabSparseArrayMinimumLength + ? this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice() : vocabCopyPropertyArray(this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote);clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = vocabCopyTrustSet( + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, + ); if ("quote" in values && values.quote != null) { if (values.quote instanceof Object || values.quote instanceof URL) { // @ts-ignore: type is checked above. clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = [values.quote]; - clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set([0]); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] = 1; } else { throw new TypeError( "The quote must be of type " + @@ -102640,7 +113911,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice(); + clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length < vocabSparseArrayMinimumLength + ? this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice() : vocabCopyPropertyArray(this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl); if ("quoteUrl" in values && values.quoteUrl != null) { if (values.quoteUrl instanceof URL) { // @ts-ignore: type is checked above. @@ -102653,12 +113925,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice();clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization); + clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice() : vocabCopyPropertyArray(this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization);clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = vocabCopyTrustSet( + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, + ); if ("quoteAuthorization" in values && values.quoteAuthorization != null) { if (values.quoteAuthorization instanceof QuoteAuthorization || values.quoteAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = [values.quoteAuthorization]; - clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set([0]); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( "The quoteAuthorization must be of type " + @@ -102669,7 +113945,151 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];quote?: Object | URL | null;quoteUrl?: URL | null;quoteAuthorization?: QuoteAuthorization | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Note { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Note; + + { + const array = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length; i++) { + const value = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i]; + if (value != null && typeof value === "object") { + node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i] = context.value(value); + } + } + } + } + + { + const array = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length; i++) { + const value = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i]; + if (value != null && typeof value === "object") { + node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i] = context.value(value); + } + } + } + } + + { + const array = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length; i++) { + const value = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i]; + if (value != null && typeof value === "object") { + node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i] = context.value(value); + } + } + } + } +} }); } + async #fetchQuote( url: URL, options: { @@ -102998,7 +114418,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[0]; if (!(v instanceof URL) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/044f#quote"); @@ -103066,7 +114487,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -103440,7 +114862,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/044f#quoteAuthorization"); @@ -103508,7 +114931,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -103935,7 +115359,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); let _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote__array = values["https://w3id.org/fep/044f#quote"]; @@ -104015,7 +115439,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; const _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); let _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization__array = values["https://w3id.org/fep/044f#quoteAuthorization"]; @@ -104188,7 +115612,7 @@ export class OrderedCollectionPage extends CollectionPage { } #_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: (Object | Link | URL)[] = []; - #_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: Set = new Set(); + #_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: VocabTrustSet = new Set(); #_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex: (number)[] = []; /** @@ -104228,14 +115652,36 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu super(values, options); if ("items" in values && values.items != null) { - if (Array.isArray(values.items) && - values.items.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.items)) { + const array = values.items; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.items; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = values.items.slice(); + this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = copied; - for (let i = 0; i < values.items.length; i++) { - this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.add(i); - } + vocabSetTrustPrefix(this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length); } else { throw new TypeError( @@ -104270,8 +115716,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link OrderedCollectionPage.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -104323,18 +115769,43 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as OrderedCollectionPage;clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.slice();clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = new Set(this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items); + const clone = super.clone(values, options) as unknown as OrderedCollectionPage;clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length < vocabSparseArrayMinimumLength + ? this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.slice() : vocabCopyPropertyArray(this.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items);clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = vocabCopyTrustSet( + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, + ); if ("items" in values && values.items != null) { - if (Array.isArray(values.items) && - values.items.every(v => v instanceof Object || v instanceof Link || v instanceof URL)) { + let copied!: (Object | Link | URL)[]; + let valid = false; + if (Array.isArray(values.items)) { + const array = values.items; + const test = (v: Object | Link | URL): boolean => v instanceof Object || v instanceof Link || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.items; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = values.items.slice(); + clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = copied; clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items = new Set(); - for (let i = 0; i < values.items.length; i++) { - clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items, clone.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length); } else { throw new TypeError( @@ -104343,7 +115814,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex = this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex.slice(); + clone.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex = this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex.length < vocabSparseArrayMinimumLength + ? this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex.slice() : vocabCopyPropertyArray(this.#_2W4yinFwqmpneu2h4m1mZ3pcLADd_startIndex); if ("startIndex" in values && values.startIndex != null) { if (typeof values.startIndex === "number" && Number.isInteger(values.startIndex) && values.startIndex >= 0) { // @ts-ignore: type is checked above. @@ -104359,7 +115831,107 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];totalItems?: number | null;current?: CollectionPage | URL | null;first?: CollectionPage | URL | null;last?: CollectionPage | URL | null;likesOf?: Object | URL | null;sharesOf?: Object | URL | null;repliesOf?: Object | URL | null;inboxOf?: Object | URL | null;outboxOf?: Object | URL | null;followersOf?: Object | URL | null;followingOf?: Object | URL | null;likedOf?: Object | URL | null;partOf?: Collection | URL | null;next?: CollectionPage | URL | null;prev?: CollectionPage | URL | null;items?: (Object | Link | URL)[];startIndex?: number | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): OrderedCollectionPage { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as OrderedCollectionPage; + + { + const array = node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.length; i++) { + const value = node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[i]; + if (value != null && typeof value === "object") { + node.#_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[i] = context.value(value); + } + } + } + } +} }); } + async #fetchItem( url: URL, options: { @@ -104702,7 +116274,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i)) { + !(i < (this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[vocabTrustPrefix] ?? 0) || + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#items"); @@ -104774,7 +116347,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i)) { + !(i < (this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items[vocabTrustPrefix] ?? 0) || + this.#_trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -105167,7 +116741,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: (Object | Link | URL)[] = []; - const _trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: Set = new Set(); + const _trust_2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items: VocabTrustSet = new Set(); let _2JPCKWTcfBmTCcW8Tv3TpRaLVaqg_items__array = values["https://www.w3.org/ns/activitystreams#items"]; @@ -105356,39 +116930,39 @@ export class Organization extends Object { #_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername: ((string | LanguageString))[] = []; #_axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); #_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); #_hQiaHhZP8hqxckxTBrpsGNs57E3: (URL)[] = []; #_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers: (boolean)[] = []; #_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); #_41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); #_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); #_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); #_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); #_4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); #_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); #_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); #_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); #_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints: (Endpoints)[] = []; #_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable: (boolean)[] = []; #_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended: (boolean)[] = []; @@ -105396,13 +116970,13 @@ export class Organization extends Object { #_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable: (boolean)[] = []; #_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); #_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); #_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); #_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage: (string)[] = []; #_2xEU4QtkC53RAun67T81Egqt9vmL_isCat: (boolean)[] = []; #_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense: (URL)[] = []; @@ -105471,10 +117045,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === "string" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === "string" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -105507,14 +117105,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; - for (let i = 0; i < values.publicKeys.length; i++) { - this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -105547,14 +117167,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; - for (let i = 0; i < values.assertionMethods.length; i++) { - this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -105587,10 +117229,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -105719,14 +117385,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | if ("streams" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; - for (let i = 0; i < values.streams.length; i++) { - this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -105837,14 +117525,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; - for (let i = 0; i < values.aliases.length; i++) { - this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -105877,14 +117587,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; - for (let i = 0; i < values.services.length; i++) { - this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -105945,8 +117677,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Organization.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -106004,7 +117736,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Organization;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice(); + const clone = super.clone(values, options) as unknown as Organization;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < vocabSparseArrayMinimumLength + ? this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice() : vocabCopyPropertyArray(this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername); if ("preferredUsername" in values && values.preferredUsername != null) { if (typeof values.preferredUsername === "string" || values.preferredUsername instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -106028,10 +117761,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === "string" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === "string" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -106040,12 +117797,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice();clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length < vocabSparseArrayMinimumLength + ? this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice() : vocabCopyPropertyArray(this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey);clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = vocabCopyTrustSet( + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, + ); if ("publicKey" in values && values.publicKey != null) { if (values.publicKey instanceof CryptographicKey || values.publicKey instanceof URL) { // @ts-ignore: type is checked above. clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = [values.publicKey]; - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set([0]); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] = 1; } else { throw new TypeError( "The publicKey must be of type " + @@ -106064,15 +117825,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); - for (let i = 0; i < values.publicKeys.length; i++) { - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -106081,12 +117864,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice();clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length < vocabSparseArrayMinimumLength + ? this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice() : vocabCopyPropertyArray(this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod);clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = vocabCopyTrustSet( + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, + ); if ("assertionMethod" in values && values.assertionMethod != null) { if (values.assertionMethod instanceof Multikey || values.assertionMethod instanceof URL) { // @ts-ignore: type is checked above. clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = [values.assertionMethod]; - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set([0]); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] = 1; } else { throw new TypeError( "The assertionMethod must be of type " + @@ -106105,15 +117892,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); - for (let i = 0; i < values.assertionMethods.length; i++) { - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -106122,7 +117931,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length < vocabSparseArrayMinimumLength + ? this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice() : vocabCopyPropertyArray(this.#_hQiaHhZP8hqxckxTBrpsGNs57E3); if ("gateway" in values && values.gateway != null) { if (values.gateway instanceof URL && isGatewayUrl(values.gateway)) { // @ts-ignore: type is checked above. @@ -106146,10 +117956,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -106158,7 +117992,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice(); + clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.length < vocabSparseArrayMinimumLength + ? this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice() : vocabCopyPropertyArray(this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers); if ("manuallyApprovesFollowers" in values && values.manuallyApprovesFollowers != null) { if (typeof values.manuallyApprovesFollowers === "boolean") { // @ts-ignore: type is checked above. @@ -106171,12 +118006,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice();clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox); + clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length < vocabSparseArrayMinimumLength + ? this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice() : vocabCopyPropertyArray(this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox);clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = vocabCopyTrustSet( + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, + ); if ("inbox" in values && values.inbox != null) { if (values.inbox instanceof OrderedCollection || values.inbox instanceof OrderedCollectionPage || values.inbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = [values.inbox]; - clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set([0]); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] = 1; } else { throw new TypeError( "The inbox must be of type " + @@ -106184,12 +118023,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice();clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox); + clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length < vocabSparseArrayMinimumLength + ? this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice() : vocabCopyPropertyArray(this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox);clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = vocabCopyTrustSet( + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, + ); if ("outbox" in values && values.outbox != null) { if (values.outbox instanceof OrderedCollection || values.outbox instanceof OrderedCollectionPage || values.outbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = [values.outbox]; - clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set([0]); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] = 1; } else { throw new TypeError( "The outbox must be of type " + @@ -106197,12 +118040,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice();clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following); + clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length < vocabSparseArrayMinimumLength + ? this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice() : vocabCopyPropertyArray(this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following);clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = vocabCopyTrustSet( + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, + ); if ("following" in values && values.following != null) { if (values.following instanceof Collection || values.following instanceof URL) { // @ts-ignore: type is checked above. clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = [values.following]; - clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set([0]); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] = 1; } else { throw new TypeError( "The following must be of type " + @@ -106210,12 +118057,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice();clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers); + clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length < vocabSparseArrayMinimumLength + ? this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice() : vocabCopyPropertyArray(this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers);clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = vocabCopyTrustSet( + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, + ); if ("followers" in values && values.followers != null) { if (values.followers instanceof Collection || values.followers instanceof URL) { // @ts-ignore: type is checked above. clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = [values.followers]; - clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set([0]); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] = 1; } else { throw new TypeError( "The followers must be of type " + @@ -106223,12 +118074,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice();clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked); + clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length < vocabSparseArrayMinimumLength + ? this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice() : vocabCopyPropertyArray(this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked);clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = vocabCopyTrustSet( + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, + ); if ("liked" in values && values.liked != null) { if (values.liked instanceof Collection || values.liked instanceof URL) { // @ts-ignore: type is checked above. clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = [values.liked]; - clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set([0]); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] = 1; } else { throw new TypeError( "The liked must be of type " + @@ -106236,12 +118091,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice();clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured); + clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length < vocabSparseArrayMinimumLength + ? this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice() : vocabCopyPropertyArray(this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured);clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = vocabCopyTrustSet( + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, + ); if ("featured" in values && values.featured != null) { if (values.featured instanceof Collection || values.featured instanceof URL) { // @ts-ignore: type is checked above. clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = [values.featured]; - clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set([0]); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] = 1; } else { throw new TypeError( "The featured must be of type " + @@ -106249,12 +118108,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice();clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags); + clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length < vocabSparseArrayMinimumLength + ? this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice() : vocabCopyPropertyArray(this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags);clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = vocabCopyTrustSet( + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, + ); if ("featuredTags" in values && values.featuredTags != null) { if (values.featuredTags instanceof Collection || values.featuredTags instanceof URL) { // @ts-ignore: type is checked above. clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = [values.featuredTags]; - clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set([0]); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] = 1; } else { throw new TypeError( "The featuredTags must be of type " + @@ -106262,12 +118125,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice();clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections); + clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length < vocabSparseArrayMinimumLength + ? this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice() : vocabCopyPropertyArray(this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections);clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = vocabCopyTrustSet( + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, + ); if ("featuredCollections" in values && values.featuredCollections != null) { if (values.featuredCollections instanceof Collection || values.featuredCollections instanceof URL) { // @ts-ignore: type is checked above. clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = [values.featuredCollections]; - clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set([0]); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] = 1; } else { throw new TypeError( "The featuredCollections must be of type " + @@ -106275,18 +118142,43 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice();clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length < vocabSparseArrayMinimumLength + ? this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice() : vocabCopyPropertyArray(this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams);clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = vocabCopyTrustSet( + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, + ); if ("streams" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(); - for (let i = 0; i < values.streams.length; i++) { - clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -106295,7 +118187,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice(); + clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length < vocabSparseArrayMinimumLength + ? this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice() : vocabCopyPropertyArray(this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints); if ("endpoints" in values && values.endpoints != null) { if (values.endpoints instanceof Endpoints) { // @ts-ignore: type is checked above. @@ -106308,7 +118201,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice(); + clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length < vocabSparseArrayMinimumLength + ? this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice() : vocabCopyPropertyArray(this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable); if ("discoverable" in values && values.discoverable != null) { if (typeof values.discoverable === "boolean") { // @ts-ignore: type is checked above. @@ -106321,7 +118215,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice(); + clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.length < vocabSparseArrayMinimumLength + ? this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice() : vocabCopyPropertyArray(this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended); if ("suspended" in values && values.suspended != null) { if (typeof values.suspended === "boolean") { // @ts-ignore: type is checked above. @@ -106334,7 +118229,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice(); + clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.length < vocabSparseArrayMinimumLength + ? this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice() : vocabCopyPropertyArray(this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial); if ("memorial" in values && values.memorial != null) { if (typeof values.memorial === "boolean") { // @ts-ignore: type is checked above. @@ -106347,7 +118243,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice(); + clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.length < vocabSparseArrayMinimumLength + ? this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice() : vocabCopyPropertyArray(this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable); if ("indexable" in values && values.indexable != null) { if (typeof values.indexable === "boolean") { // @ts-ignore: type is checked above. @@ -106360,12 +118257,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice();clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo); + clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length < vocabSparseArrayMinimumLength + ? this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice() : vocabCopyPropertyArray(this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo);clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = vocabCopyTrustSet( + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, + ); if ("successor" in values && values.successor != null) { if (values.successor instanceof Application || values.successor instanceof Group || values.successor instanceof Organization || values.successor instanceof Person || values.successor instanceof Service || values.successor instanceof URL) { // @ts-ignore: type is checked above. clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = [values.successor]; - clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set([0]); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] = 1; } else { throw new TypeError( "The successor must be of type " + @@ -106373,12 +118274,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice();clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length < vocabSparseArrayMinimumLength + ? this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice() : vocabCopyPropertyArray(this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs);clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = vocabCopyTrustSet( + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, + ); if ("alias" in values && values.alias != null) { if (values.alias instanceof Application || values.alias instanceof Group || values.alias instanceof Organization || values.alias instanceof Person || values.alias instanceof Service || values.alias instanceof URL) { // @ts-ignore: type is checked above. clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = [values.alias]; - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set([0]); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] = 1; } else { throw new TypeError( "The alias must be of type " + @@ -106397,15 +118302,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); - for (let i = 0; i < values.aliases.length; i++) { - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -106414,12 +118341,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice();clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length < vocabSparseArrayMinimumLength + ? this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice() : vocabCopyPropertyArray(this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service);clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = vocabCopyTrustSet( + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, + ); if ("service" in values && values.service != null) { if (values.service instanceof DidService || values.service instanceof URL) { // @ts-ignore: type is checked above. clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = [values.service]; - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set([0]); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] = 1; } else { throw new TypeError( "The service must be of type " + @@ -106438,15 +118369,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); - for (let i = 0; i < values.services.length; i++) { - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -106455,7 +118408,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice(); + clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.length < vocabSparseArrayMinimumLength + ? this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice() : vocabCopyPropertyArray(this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage); if ("followedMessage" in values && values.followedMessage != null) { if (typeof values.followedMessage === "string") { // @ts-ignore: type is checked above. @@ -106468,7 +118422,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice(); + clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.length < vocabSparseArrayMinimumLength + ? this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice() : vocabCopyPropertyArray(this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat); if ("cat" in values && values.cat != null) { if (typeof values.cat === "boolean") { // @ts-ignore: type is checked above. @@ -106481,7 +118436,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice(); + clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length < vocabSparseArrayMinimumLength + ? this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice() : vocabCopyPropertyArray(this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense); if ("preferredLicense" in values && values.preferredLicense != null) { if (values.preferredLicense instanceof URL) { // @ts-ignore: type is checked above. @@ -106497,7 +118453,465 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];preferredUsername?: string | LanguageString | null; +preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; +publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; +assertionMethods?: (Multikey | URL)[];gateway?: URL | null; +gateways?: (URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;featuredCollections?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; +aliases?: (Application | Group | Organization | Person | Service | URL)[];service?: DidService | URL | null; +services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | null;preferredLicense?: URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Organization { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Organization; + + { + const array = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length; i++) { + const value = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i]; + if (value != null && typeof value === "object") { + node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length; i++) { + const value = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i]; + if (value != null && typeof value === "object") { + node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i] = context.value(value); + } + } + } + } + + { + const array = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length; i++) { + const value = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i]; + if (value != null && typeof value === "object") { + node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length; i++) { + const value = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i]; + if (value != null && typeof value === "object") { + node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length; i++) { + const value = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i]; + if (value != null && typeof value === "object") { + node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length; i++) { + const value = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i]; + if (value != null && typeof value === "object") { + node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i] = context.value(value); + } + } + } + } + + { + const array = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length; i++) { + const value = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i]; + if (value != null && typeof value === "object") { + node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length; i++) { + const value = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i]; + if (value != null && typeof value === "object") { + node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length; i++) { + const value = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i]; + if (value != null && typeof value === "object") { + node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length; i++) { + const value = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i]; + if (value != null && typeof value === "object") { + node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i] = context.value(value); + } + } + } + } + + { + const array = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length; i++) { + const value = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i]; + if (value != null && typeof value === "object") { + node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length; i++) { + const value = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i]; + if (value != null && typeof value === "object") { + node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i] = context.value(value); + } + } + } + } + + { + const array = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length; i++) { + const value = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i]; + if (value != null && typeof value === "object") { + node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length; i++) { + const value = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i]; + if (value != null && typeof value === "object") { + node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length; i++) { + const value = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i]; + if (value != null && typeof value === "object") { + node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length; i++) { + const value = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i]; + if (value != null && typeof value === "object") { + node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i] = context.value(value); + } + } + } + } + + { + const array = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length; i++) { + const value = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i]; + if (value != null && typeof value === "object") { + node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i] = context.value(value); + } + } + } + } +} }); } + /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. * @@ -106846,7 +119260,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[0]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#publicKey"); @@ -106914,7 +119329,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -107001,7 +119417,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#publicKey"); @@ -107073,7 +119490,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -107427,7 +119845,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#assertionMethod"); @@ -107495,7 +119914,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -107586,7 +120006,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#assertionMethod"); @@ -107658,7 +120079,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -108082,7 +120504,8 @@ get gateways(): (URL)[] { } let v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0]; if (!(v instanceof URL) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "http://www.w3.org/ns/ldp#inbox"); @@ -108150,7 +120573,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -108524,7 +120948,8 @@ get gateways(): (URL)[] { } let v = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[0]; if (!(v instanceof URL) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#outbox"); @@ -108592,7 +121017,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -108946,7 +121372,8 @@ get gateways(): (URL)[] { } let v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0]; if (!(v instanceof URL) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#following"); @@ -109014,7 +121441,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -109371,7 +121799,8 @@ get gateways(): (URL)[] { } let v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0]; if (!(v instanceof URL) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#followers"); @@ -109439,7 +121868,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -109794,7 +122224,8 @@ get gateways(): (URL)[] { } let v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0]; if (!(v instanceof URL) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#liked"); @@ -109862,7 +122293,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -110215,7 +122647,8 @@ get gateways(): (URL)[] { } let v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[0]; if (!(v instanceof URL) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "http://joinmastodon.org/ns#featured"); @@ -110283,7 +122716,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -110636,7 +123070,8 @@ get gateways(): (URL)[] { } let v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0]; if (!(v instanceof URL) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "http://joinmastodon.org/ns#featuredTags"); @@ -110704,7 +123139,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -111054,7 +123490,8 @@ get gateways(): (URL)[] { } let v = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[0]; if (!(v instanceof URL) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/7aa9#featuredCollections"); @@ -111122,7 +123559,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -111472,7 +123910,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#streams"); @@ -111544,7 +123983,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -112029,7 +124469,8 @@ get gateways(): (URL)[] { } let v = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0]; if (!(v instanceof URL) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#movedTo"); @@ -112097,7 +124538,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -112510,7 +124952,8 @@ get gateways(): (URL)[] { } let v = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#alsoKnownAs"); @@ -112578,7 +125021,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -112669,7 +125113,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#alsoKnownAs"); @@ -112741,7 +125186,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -113095,7 +125541,8 @@ get gateways(): (URL)[] { } let v = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/did#service"); @@ -113163,7 +125610,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -113254,7 +125702,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/did#service"); @@ -113326,7 +125775,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -114725,7 +127175,7 @@ get gateways(): (URL)[] { instance.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; const _axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); let _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array = values["https://w3id.org/security#publicKey"]; @@ -114766,7 +127216,7 @@ get gateways(): (URL)[] { instance.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = _axq166E2eZADq34V4MYUc8KMZdC_publicKey; const _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); let _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array = values["https://w3id.org/security#assertionMethod"]; @@ -114865,7 +127315,7 @@ get gateways(): (URL)[] { instance.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers; const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); let _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array = values["http://www.w3.org/ns/ldp#inbox"]; @@ -114912,7 +127362,7 @@ get gateways(): (URL)[] { instance.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; const _41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); let _41QwhqJouoLg3h8dRPKat21brynC_outbox__array = values["https://www.w3.org/ns/activitystreams#outbox"]; @@ -114959,7 +127409,7 @@ get gateways(): (URL)[] { instance.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = _41QwhqJouoLg3h8dRPKat21brynC_outbox; const _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); let _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array = values["https://www.w3.org/ns/activitystreams#following"]; @@ -115000,7 +127450,7 @@ get gateways(): (URL)[] { instance.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; const _BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); let _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array = values["https://www.w3.org/ns/activitystreams#followers"]; @@ -115041,7 +127491,7 @@ get gateways(): (URL)[] { instance.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = _BBCTgfphhsFzpVfKTykGSpBNwoA_followers; const _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); let _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array = values["https://www.w3.org/ns/activitystreams#liked"]; @@ -115082,7 +127532,7 @@ get gateways(): (URL)[] { instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; const _4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); let _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array = values["http://joinmastodon.org/ns#featured"]; @@ -115123,7 +127573,7 @@ get gateways(): (URL)[] { instance.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = _4N1vBJzXDf8NbBumeECQMFvKetja_featured; const _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); let _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array = values["http://joinmastodon.org/ns#featuredTags"]; @@ -115164,7 +127614,7 @@ get gateways(): (URL)[] { instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; const _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); let _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections__array = values["https://w3id.org/fep/7aa9#featuredCollections"]; @@ -115205,7 +127655,7 @@ get gateways(): (URL)[] { instance.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); let _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array = values["https://www.w3.org/ns/activitystreams#streams"]; @@ -115394,7 +127844,7 @@ get gateways(): (URL)[] { instance.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable; const _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); let _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array = values["https://www.w3.org/ns/activitystreams#movedTo"]; @@ -115452,7 +127902,7 @@ get gateways(): (URL)[] { instance.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; const _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); let _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array = values["https://www.w3.org/ns/activitystreams#alsoKnownAs"]; @@ -115510,7 +127960,7 @@ get gateways(): (URL)[] { instance.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; const _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); let _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array = values["https://www.w3.org/ns/did#service"]; @@ -116291,8 +128741,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Page.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -116347,7 +128797,77 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const clone = super.clone(values, options) as unknown as Page; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];width?: number | null;height?: number | null;digestMultibase?: string | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Page { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -116691,39 +129211,39 @@ export class Person extends Object { #_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername: ((string | LanguageString))[] = []; #_axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); #_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); #_hQiaHhZP8hqxckxTBrpsGNs57E3: (URL)[] = []; #_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers: (boolean)[] = []; #_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); #_41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); #_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); #_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); #_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); #_4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); #_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); #_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); #_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); #_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints: (Endpoints)[] = []; #_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable: (boolean)[] = []; #_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended: (boolean)[] = []; @@ -116731,13 +129251,13 @@ export class Person extends Object { #_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable: (boolean)[] = []; #_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); #_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); #_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); #_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage: (string)[] = []; #_2xEU4QtkC53RAun67T81Egqt9vmL_isCat: (boolean)[] = []; #_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense: (URL)[] = []; @@ -116806,10 +129326,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === "string" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === "string" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -116842,14 +129386,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; - for (let i = 0; i < values.publicKeys.length; i++) { - this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -116882,14 +129448,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; - for (let i = 0; i < values.assertionMethods.length; i++) { - this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -116922,10 +129510,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -117054,14 +129666,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | if ("streams" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; - for (let i = 0; i < values.streams.length; i++) { - this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -117172,14 +129806,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; - for (let i = 0; i < values.aliases.length; i++) { - this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -117212,14 +129868,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; - for (let i = 0; i < values.services.length; i++) { - this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -117280,8 +129958,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Person.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -117339,7 +130017,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Person;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice(); + const clone = super.clone(values, options) as unknown as Person;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < vocabSparseArrayMinimumLength + ? this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice() : vocabCopyPropertyArray(this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername); if ("preferredUsername" in values && values.preferredUsername != null) { if (typeof values.preferredUsername === "string" || values.preferredUsername instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -117363,10 +130042,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === "string" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === "string" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -117375,12 +130078,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice();clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length < vocabSparseArrayMinimumLength + ? this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice() : vocabCopyPropertyArray(this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey);clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = vocabCopyTrustSet( + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, + ); if ("publicKey" in values && values.publicKey != null) { if (values.publicKey instanceof CryptographicKey || values.publicKey instanceof URL) { // @ts-ignore: type is checked above. clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = [values.publicKey]; - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set([0]); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] = 1; } else { throw new TypeError( "The publicKey must be of type " + @@ -117399,15 +130106,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); - for (let i = 0; i < values.publicKeys.length; i++) { - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -117416,12 +130145,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice();clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length < vocabSparseArrayMinimumLength + ? this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice() : vocabCopyPropertyArray(this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod);clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = vocabCopyTrustSet( + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, + ); if ("assertionMethod" in values && values.assertionMethod != null) { if (values.assertionMethod instanceof Multikey || values.assertionMethod instanceof URL) { // @ts-ignore: type is checked above. clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = [values.assertionMethod]; - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set([0]); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] = 1; } else { throw new TypeError( "The assertionMethod must be of type " + @@ -117440,15 +130173,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); - for (let i = 0; i < values.assertionMethods.length; i++) { - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -117457,7 +130212,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length < vocabSparseArrayMinimumLength + ? this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice() : vocabCopyPropertyArray(this.#_hQiaHhZP8hqxckxTBrpsGNs57E3); if ("gateway" in values && values.gateway != null) { if (values.gateway instanceof URL && isGatewayUrl(values.gateway)) { // @ts-ignore: type is checked above. @@ -117481,10 +130237,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -117493,7 +130273,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice(); + clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.length < vocabSparseArrayMinimumLength + ? this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice() : vocabCopyPropertyArray(this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers); if ("manuallyApprovesFollowers" in values && values.manuallyApprovesFollowers != null) { if (typeof values.manuallyApprovesFollowers === "boolean") { // @ts-ignore: type is checked above. @@ -117506,12 +130287,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice();clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox); + clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length < vocabSparseArrayMinimumLength + ? this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice() : vocabCopyPropertyArray(this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox);clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = vocabCopyTrustSet( + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, + ); if ("inbox" in values && values.inbox != null) { if (values.inbox instanceof OrderedCollection || values.inbox instanceof OrderedCollectionPage || values.inbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = [values.inbox]; - clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set([0]); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] = 1; } else { throw new TypeError( "The inbox must be of type " + @@ -117519,12 +130304,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice();clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox); + clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length < vocabSparseArrayMinimumLength + ? this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice() : vocabCopyPropertyArray(this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox);clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = vocabCopyTrustSet( + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, + ); if ("outbox" in values && values.outbox != null) { if (values.outbox instanceof OrderedCollection || values.outbox instanceof OrderedCollectionPage || values.outbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = [values.outbox]; - clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set([0]); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] = 1; } else { throw new TypeError( "The outbox must be of type " + @@ -117532,12 +130321,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice();clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following); + clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length < vocabSparseArrayMinimumLength + ? this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice() : vocabCopyPropertyArray(this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following);clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = vocabCopyTrustSet( + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, + ); if ("following" in values && values.following != null) { if (values.following instanceof Collection || values.following instanceof URL) { // @ts-ignore: type is checked above. clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = [values.following]; - clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set([0]); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] = 1; } else { throw new TypeError( "The following must be of type " + @@ -117545,12 +130338,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice();clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers); + clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length < vocabSparseArrayMinimumLength + ? this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice() : vocabCopyPropertyArray(this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers);clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = vocabCopyTrustSet( + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, + ); if ("followers" in values && values.followers != null) { if (values.followers instanceof Collection || values.followers instanceof URL) { // @ts-ignore: type is checked above. clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = [values.followers]; - clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set([0]); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] = 1; } else { throw new TypeError( "The followers must be of type " + @@ -117558,12 +130355,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice();clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked); + clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length < vocabSparseArrayMinimumLength + ? this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice() : vocabCopyPropertyArray(this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked);clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = vocabCopyTrustSet( + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, + ); if ("liked" in values && values.liked != null) { if (values.liked instanceof Collection || values.liked instanceof URL) { // @ts-ignore: type is checked above. clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = [values.liked]; - clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set([0]); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] = 1; } else { throw new TypeError( "The liked must be of type " + @@ -117571,12 +130372,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice();clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured); + clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length < vocabSparseArrayMinimumLength + ? this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice() : vocabCopyPropertyArray(this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured);clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = vocabCopyTrustSet( + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, + ); if ("featured" in values && values.featured != null) { if (values.featured instanceof Collection || values.featured instanceof URL) { // @ts-ignore: type is checked above. clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = [values.featured]; - clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set([0]); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] = 1; } else { throw new TypeError( "The featured must be of type " + @@ -117584,12 +130389,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice();clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags); + clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length < vocabSparseArrayMinimumLength + ? this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice() : vocabCopyPropertyArray(this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags);clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = vocabCopyTrustSet( + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, + ); if ("featuredTags" in values && values.featuredTags != null) { if (values.featuredTags instanceof Collection || values.featuredTags instanceof URL) { // @ts-ignore: type is checked above. clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = [values.featuredTags]; - clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set([0]); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] = 1; } else { throw new TypeError( "The featuredTags must be of type " + @@ -117597,12 +130406,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice();clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections); + clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length < vocabSparseArrayMinimumLength + ? this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice() : vocabCopyPropertyArray(this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections);clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = vocabCopyTrustSet( + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, + ); if ("featuredCollections" in values && values.featuredCollections != null) { if (values.featuredCollections instanceof Collection || values.featuredCollections instanceof URL) { // @ts-ignore: type is checked above. clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = [values.featuredCollections]; - clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set([0]); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] = 1; } else { throw new TypeError( "The featuredCollections must be of type " + @@ -117610,18 +130423,43 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice();clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length < vocabSparseArrayMinimumLength + ? this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice() : vocabCopyPropertyArray(this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams);clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = vocabCopyTrustSet( + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, + ); if ("streams" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(); - for (let i = 0; i < values.streams.length; i++) { - clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -117630,7 +130468,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice(); + clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length < vocabSparseArrayMinimumLength + ? this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice() : vocabCopyPropertyArray(this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints); if ("endpoints" in values && values.endpoints != null) { if (values.endpoints instanceof Endpoints) { // @ts-ignore: type is checked above. @@ -117643,7 +130482,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice(); + clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length < vocabSparseArrayMinimumLength + ? this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice() : vocabCopyPropertyArray(this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable); if ("discoverable" in values && values.discoverable != null) { if (typeof values.discoverable === "boolean") { // @ts-ignore: type is checked above. @@ -117656,7 +130496,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice(); + clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.length < vocabSparseArrayMinimumLength + ? this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice() : vocabCopyPropertyArray(this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended); if ("suspended" in values && values.suspended != null) { if (typeof values.suspended === "boolean") { // @ts-ignore: type is checked above. @@ -117669,7 +130510,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice(); + clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.length < vocabSparseArrayMinimumLength + ? this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice() : vocabCopyPropertyArray(this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial); if ("memorial" in values && values.memorial != null) { if (typeof values.memorial === "boolean") { // @ts-ignore: type is checked above. @@ -117682,7 +130524,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice(); + clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.length < vocabSparseArrayMinimumLength + ? this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice() : vocabCopyPropertyArray(this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable); if ("indexable" in values && values.indexable != null) { if (typeof values.indexable === "boolean") { // @ts-ignore: type is checked above. @@ -117695,12 +130538,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice();clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo); + clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length < vocabSparseArrayMinimumLength + ? this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice() : vocabCopyPropertyArray(this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo);clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = vocabCopyTrustSet( + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, + ); if ("successor" in values && values.successor != null) { if (values.successor instanceof Application || values.successor instanceof Group || values.successor instanceof Organization || values.successor instanceof Person || values.successor instanceof Service || values.successor instanceof URL) { // @ts-ignore: type is checked above. clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = [values.successor]; - clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set([0]); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] = 1; } else { throw new TypeError( "The successor must be of type " + @@ -117708,12 +130555,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice();clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length < vocabSparseArrayMinimumLength + ? this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice() : vocabCopyPropertyArray(this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs);clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = vocabCopyTrustSet( + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, + ); if ("alias" in values && values.alias != null) { if (values.alias instanceof Application || values.alias instanceof Group || values.alias instanceof Organization || values.alias instanceof Person || values.alias instanceof Service || values.alias instanceof URL) { // @ts-ignore: type is checked above. clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = [values.alias]; - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set([0]); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] = 1; } else { throw new TypeError( "The alias must be of type " + @@ -117732,15 +130583,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); - for (let i = 0; i < values.aliases.length; i++) { - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -117749,12 +130622,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice();clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length < vocabSparseArrayMinimumLength + ? this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice() : vocabCopyPropertyArray(this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service);clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = vocabCopyTrustSet( + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, + ); if ("service" in values && values.service != null) { if (values.service instanceof DidService || values.service instanceof URL) { // @ts-ignore: type is checked above. clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = [values.service]; - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set([0]); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] = 1; } else { throw new TypeError( "The service must be of type " + @@ -117773,15 +130650,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); - for (let i = 0; i < values.services.length; i++) { - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -117790,7 +130689,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice(); + clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.length < vocabSparseArrayMinimumLength + ? this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice() : vocabCopyPropertyArray(this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage); if ("followedMessage" in values && values.followedMessage != null) { if (typeof values.followedMessage === "string") { // @ts-ignore: type is checked above. @@ -117803,7 +130703,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice(); + clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.length < vocabSparseArrayMinimumLength + ? this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice() : vocabCopyPropertyArray(this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat); if ("cat" in values && values.cat != null) { if (typeof values.cat === "boolean") { // @ts-ignore: type is checked above. @@ -117816,7 +130717,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice(); + clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length < vocabSparseArrayMinimumLength + ? this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice() : vocabCopyPropertyArray(this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense); if ("preferredLicense" in values && values.preferredLicense != null) { if (values.preferredLicense instanceof URL) { // @ts-ignore: type is checked above. @@ -117832,7 +130734,465 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];preferredUsername?: string | LanguageString | null; +preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; +publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; +assertionMethods?: (Multikey | URL)[];gateway?: URL | null; +gateways?: (URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;featuredCollections?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; +aliases?: (Application | Group | Organization | Person | Service | URL)[];service?: DidService | URL | null; +services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | null;preferredLicense?: URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Person { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Person; + + { + const array = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length; i++) { + const value = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i]; + if (value != null && typeof value === "object") { + node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length; i++) { + const value = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i]; + if (value != null && typeof value === "object") { + node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i] = context.value(value); + } + } + } + } + + { + const array = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length; i++) { + const value = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i]; + if (value != null && typeof value === "object") { + node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length; i++) { + const value = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i]; + if (value != null && typeof value === "object") { + node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length; i++) { + const value = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i]; + if (value != null && typeof value === "object") { + node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length; i++) { + const value = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i]; + if (value != null && typeof value === "object") { + node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i] = context.value(value); + } + } + } + } + + { + const array = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length; i++) { + const value = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i]; + if (value != null && typeof value === "object") { + node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length; i++) { + const value = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i]; + if (value != null && typeof value === "object") { + node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length; i++) { + const value = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i]; + if (value != null && typeof value === "object") { + node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length; i++) { + const value = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i]; + if (value != null && typeof value === "object") { + node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i] = context.value(value); + } + } + } + } + + { + const array = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length; i++) { + const value = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i]; + if (value != null && typeof value === "object") { + node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length; i++) { + const value = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i]; + if (value != null && typeof value === "object") { + node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i] = context.value(value); + } + } + } + } + + { + const array = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length; i++) { + const value = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i]; + if (value != null && typeof value === "object") { + node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length; i++) { + const value = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i]; + if (value != null && typeof value === "object") { + node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length; i++) { + const value = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i]; + if (value != null && typeof value === "object") { + node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length; i++) { + const value = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i]; + if (value != null && typeof value === "object") { + node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i] = context.value(value); + } + } + } + } + + { + const array = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length; i++) { + const value = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i]; + if (value != null && typeof value === "object") { + node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i] = context.value(value); + } + } + } + } +} }); } + /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. * @@ -118181,7 +131541,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[0]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#publicKey"); @@ -118249,7 +131610,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -118336,7 +131698,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#publicKey"); @@ -118408,7 +131771,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -118762,7 +132126,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#assertionMethod"); @@ -118830,7 +132195,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -118921,7 +132287,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#assertionMethod"); @@ -118993,7 +132360,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -119417,7 +132785,8 @@ get gateways(): (URL)[] { } let v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0]; if (!(v instanceof URL) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "http://www.w3.org/ns/ldp#inbox"); @@ -119485,7 +132854,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -119859,7 +133229,8 @@ get gateways(): (URL)[] { } let v = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[0]; if (!(v instanceof URL) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#outbox"); @@ -119927,7 +133298,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -120281,7 +133653,8 @@ get gateways(): (URL)[] { } let v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0]; if (!(v instanceof URL) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#following"); @@ -120349,7 +133722,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -120706,7 +134080,8 @@ get gateways(): (URL)[] { } let v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0]; if (!(v instanceof URL) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#followers"); @@ -120774,7 +134149,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -121129,7 +134505,8 @@ get gateways(): (URL)[] { } let v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0]; if (!(v instanceof URL) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#liked"); @@ -121197,7 +134574,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -121550,7 +134928,8 @@ get gateways(): (URL)[] { } let v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[0]; if (!(v instanceof URL) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "http://joinmastodon.org/ns#featured"); @@ -121618,7 +134997,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -121971,7 +135351,8 @@ get gateways(): (URL)[] { } let v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0]; if (!(v instanceof URL) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "http://joinmastodon.org/ns#featuredTags"); @@ -122039,7 +135420,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -122389,7 +135771,8 @@ get gateways(): (URL)[] { } let v = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[0]; if (!(v instanceof URL) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/7aa9#featuredCollections"); @@ -122457,7 +135840,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -122807,7 +136191,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#streams"); @@ -122879,7 +136264,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -123364,7 +136750,8 @@ get gateways(): (URL)[] { } let v = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0]; if (!(v instanceof URL) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#movedTo"); @@ -123432,7 +136819,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -123845,7 +137233,8 @@ get gateways(): (URL)[] { } let v = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#alsoKnownAs"); @@ -123913,7 +137302,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -124004,7 +137394,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#alsoKnownAs"); @@ -124076,7 +137467,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -124430,7 +137822,8 @@ get gateways(): (URL)[] { } let v = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/did#service"); @@ -124498,7 +137891,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -124589,7 +137983,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/did#service"); @@ -124661,7 +138056,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -126060,7 +139456,7 @@ get gateways(): (URL)[] { instance.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; const _axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); let _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array = values["https://w3id.org/security#publicKey"]; @@ -126101,7 +139497,7 @@ get gateways(): (URL)[] { instance.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = _axq166E2eZADq34V4MYUc8KMZdC_publicKey; const _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); let _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array = values["https://w3id.org/security#assertionMethod"]; @@ -126200,7 +139596,7 @@ get gateways(): (URL)[] { instance.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers; const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); let _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array = values["http://www.w3.org/ns/ldp#inbox"]; @@ -126247,7 +139643,7 @@ get gateways(): (URL)[] { instance.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; const _41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); let _41QwhqJouoLg3h8dRPKat21brynC_outbox__array = values["https://www.w3.org/ns/activitystreams#outbox"]; @@ -126294,7 +139690,7 @@ get gateways(): (URL)[] { instance.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = _41QwhqJouoLg3h8dRPKat21brynC_outbox; const _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); let _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array = values["https://www.w3.org/ns/activitystreams#following"]; @@ -126335,7 +139731,7 @@ get gateways(): (URL)[] { instance.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; const _BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); let _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array = values["https://www.w3.org/ns/activitystreams#followers"]; @@ -126376,7 +139772,7 @@ get gateways(): (URL)[] { instance.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = _BBCTgfphhsFzpVfKTykGSpBNwoA_followers; const _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); let _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array = values["https://www.w3.org/ns/activitystreams#liked"]; @@ -126417,7 +139813,7 @@ get gateways(): (URL)[] { instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; const _4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); let _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array = values["http://joinmastodon.org/ns#featured"]; @@ -126458,7 +139854,7 @@ get gateways(): (URL)[] { instance.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = _4N1vBJzXDf8NbBumeECQMFvKetja_featured; const _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); let _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array = values["http://joinmastodon.org/ns#featuredTags"]; @@ -126499,7 +139895,7 @@ get gateways(): (URL)[] { instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; const _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); let _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections__array = values["https://w3id.org/fep/7aa9#featuredCollections"]; @@ -126540,7 +139936,7 @@ get gateways(): (URL)[] { instance.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); let _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array = values["https://www.w3.org/ns/activitystreams#streams"]; @@ -126729,7 +140125,7 @@ get gateways(): (URL)[] { instance.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable; const _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); let _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array = values["https://www.w3.org/ns/activitystreams#movedTo"]; @@ -126787,7 +140183,7 @@ get gateways(): (URL)[] { instance.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; const _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); let _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array = values["https://www.w3.org/ns/activitystreams#alsoKnownAs"]; @@ -126845,7 +140241,7 @@ get gateways(): (URL)[] { instance.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; const _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); let _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array = values["https://www.w3.org/ns/did#service"]; @@ -127713,8 +141109,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Place.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -127766,7 +141162,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Place;clone.#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy = this.#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy.slice(); + const clone = super.clone(values, options) as unknown as Place;clone.#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy = this.#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy.length < vocabSparseArrayMinimumLength + ? this.#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy.slice() : vocabCopyPropertyArray(this.#_3UCsHnBHvDAXJnBuzw3zw1VVs3Ne_accuracy); if ("accuracy" in values && values.accuracy != null) { if (typeof values.accuracy === "number" && !Number.isNaN(values.accuracy)) { // @ts-ignore: type is checked above. @@ -127779,7 +141176,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude = this.#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude.slice(); + clone.#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude = this.#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude.length < vocabSparseArrayMinimumLength + ? this.#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude.slice() : vocabCopyPropertyArray(this.#_3Q6KDcFQUJRRaBux1BL2yp5QWiBi_altitude); if ("altitude" in values && values.altitude != null) { if (typeof values.altitude === "number" && !Number.isNaN(values.altitude)) { // @ts-ignore: type is checked above. @@ -127792,7 +141190,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude = this.#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude.slice(); + clone.#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude = this.#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude.length < vocabSparseArrayMinimumLength + ? this.#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude.slice() : vocabCopyPropertyArray(this.#_3g85RoKRnaNjP7DFyLSvsWDg7HGM_latitude); if ("latitude" in values && values.latitude != null) { if (typeof values.latitude === "number" && !Number.isNaN(values.latitude)) { // @ts-ignore: type is checked above. @@ -127805,7 +141204,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude = this.#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude.slice(); + clone.#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude = this.#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude.length < vocabSparseArrayMinimumLength + ? this.#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude.slice() : vocabCopyPropertyArray(this.#_B2GEYdS9yBAF3ho1pm1rcRg7cSf_longitude); if ("longitude" in values && values.longitude != null) { if (typeof values.longitude === "number" && !Number.isNaN(values.longitude)) { // @ts-ignore: type is checked above. @@ -127818,7 +141218,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius = this.#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius.slice(); + clone.#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius = this.#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius.length < vocabSparseArrayMinimumLength + ? this.#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius.slice() : vocabCopyPropertyArray(this.#_3ga86BKHUtRkGx5PHBjRiUXXzwnw_radius); if ("radius" in values && values.radius != null) { if (typeof values.radius === "number" && !Number.isNaN(values.radius)) { // @ts-ignore: type is checked above. @@ -127831,7 +141232,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu ); } } - clone.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units = this.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units.slice(); + clone.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units = this.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units.length < vocabSparseArrayMinimumLength + ? this.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units.slice() : vocabCopyPropertyArray(this.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units); if ("units" in values && values.units != null) { if (values.units == "cm" || values.units == "feet" || values.units == "inches" || values.units == "km" || values.units == "m" || values.units == "miles" || values.units instanceof URL) { // @ts-ignore: type is checked above. @@ -127847,7 +141249,107 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];accuracy?: number | null;altitude?: number | null;latitude?: number | null;longitude?: number | null;radius?: number | null;units?: "cm" | "feet" | "inches" | "km" | "m" | "miles" | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Place { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Place; + + { + const array = node.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units.length; i++) { + const value = node.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units[i]; + if (value != null && typeof value === "object") { + node.#_oKrwxU4V8wiKhMW1QEYQibcJh8c_units[i] = context.value(value); + } + } + } + } +} }); } + /** Indicates the accuracy of position coordinates on a {@link Place} objects. * Expressed in properties of percentage. e.g. "94.0" means "94.0% accurate". * @@ -128813,7 +142315,7 @@ export class Profile extends Object { } #_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes: (Object | URL)[] = []; - #_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes: Set = new Set(); + #_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes: VocabTrustSet = new Set(); /** * Constructs a new instance of Profile with the given values. @@ -128875,8 +142377,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Profile.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -128928,12 +142430,16 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Profile;clone.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = this.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.slice();clone.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = new Set(this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes); + const clone = super.clone(values, options) as unknown as Profile;clone.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = this.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.length < vocabSparseArrayMinimumLength + ? this.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.slice() : vocabCopyPropertyArray(this.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes);clone.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = vocabCopyTrustSet( + this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes, clone.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes, + ); if ("describes" in values && values.describes != null) { if (values.describes instanceof Object || values.describes instanceof URL) { // @ts-ignore: type is checked above. clone.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = [values.describes]; - clone.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = new Set([0]); + clone.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes = new Set(); + clone.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes[vocabTrustPrefix] = 1; } else { throw new TypeError( "The describes must be of type " + @@ -128944,7 +142450,107 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];describes?: Object | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Profile { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Profile; + + { + const array = node.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.length; i++) { + const value = node.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes[i]; + if (value != null && typeof value === "object") { + node.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes[i] = context.value(value); + } + } + } + } +} }); } + async #fetchDescribes( url: URL, options: { @@ -129272,7 +142878,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu } let v = this.#_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes[0]; if (!(v instanceof URL) && - !this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.has(0)) { + !(0 < (this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes[vocabTrustPrefix] ?? 0) || + this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#describes"); @@ -129340,7 +142947,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.has(0)) { + !(0 < (this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes[vocabTrustPrefix] ?? 0) || + this.#_trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -129677,7 +143285,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes: (Object | URL)[] = []; - const _trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes: Set = new Set(); + const _trust_3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes: VocabTrustSet = new Set(); let _3CLQ1PLSXrhSQbTGGHuxNyaEFKM1_describes__array = values["https://www.w3.org/ns/activitystreams#describes"]; @@ -129815,19 +143423,19 @@ export class Question extends IntransitiveActivity { } #_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf: (Object | URL)[] = []; - #_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf: Set = new Set(); + #_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf: VocabTrustSet = new Set(); #_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf: (Object | URL)[] = []; - #_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf: Set = new Set(); + #_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf: VocabTrustSet = new Set(); #_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed: ((Temporal.Instant | boolean))[] = []; #_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount: (number)[] = []; #_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + #_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); #_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl: (URL)[] = []; #_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + #_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); /** * Constructs a new instance of Question with the given values. @@ -129872,14 +143480,36 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti super(values, options); if ("exclusiveOptions" in values && values.exclusiveOptions != null) { - if (Array.isArray(values.exclusiveOptions) && - values.exclusiveOptions.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.exclusiveOptions)) { + const array = values.exclusiveOptions; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.exclusiveOptions; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = values.exclusiveOptions.slice(); + this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = copied; - for (let i = 0; i < values.exclusiveOptions.length; i++) { - this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.add(i); - } + vocabSetTrustPrefix(this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf, this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.length); } else { throw new TypeError( @@ -129891,14 +143521,36 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti if ("inclusiveOptions" in values && values.inclusiveOptions != null) { - if (Array.isArray(values.inclusiveOptions) && - values.inclusiveOptions.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.inclusiveOptions)) { + const array = values.inclusiveOptions; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.inclusiveOptions; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = values.inclusiveOptions.slice(); + this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = copied; - for (let i = 0; i < values.inclusiveOptions.length; i++) { - this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.add(i); - } + vocabSetTrustPrefix(this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf, this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.length); } else { throw new TypeError( @@ -129985,8 +143637,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Question.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -130044,18 +143696,43 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Question;clone.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.slice();clone.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = new Set(this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf); + const clone = super.clone(values, options) as unknown as Question;clone.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.length < vocabSparseArrayMinimumLength + ? this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.slice() : vocabCopyPropertyArray(this.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf);clone.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = vocabCopyTrustSet( + this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf, clone.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf, + ); if ("exclusiveOptions" in values && values.exclusiveOptions != null) { - if (Array.isArray(values.exclusiveOptions) && - values.exclusiveOptions.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.exclusiveOptions)) { + const array = values.exclusiveOptions; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.exclusiveOptions; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = values.exclusiveOptions.slice(); + clone.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = copied; clone.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = new Set(); - for (let i = 0; i < values.exclusiveOptions.length; i++) { - clone.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf, clone.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.length); } else { throw new TypeError( @@ -130064,18 +143741,43 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti ); } } - clone.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.slice();clone.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = new Set(this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf); + clone.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.length < vocabSparseArrayMinimumLength + ? this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.slice() : vocabCopyPropertyArray(this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf);clone.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = vocabCopyTrustSet( + this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf, clone.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf, + ); if ("inclusiveOptions" in values && values.inclusiveOptions != null) { - if (Array.isArray(values.inclusiveOptions) && - values.inclusiveOptions.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.inclusiveOptions)) { + const array = values.inclusiveOptions; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.inclusiveOptions; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = values.inclusiveOptions.slice(); + clone.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = copied; clone.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = new Set(); - for (let i = 0; i < values.inclusiveOptions.length; i++) { - clone.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf, clone.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.length); } else { throw new TypeError( @@ -130084,7 +143786,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti ); } } - clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed.slice(); + clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed.length < vocabSparseArrayMinimumLength + ? this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed.slice() : vocabCopyPropertyArray(this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed); if ("closed" in values && values.closed != null) { if (isTemporalInstant(values.closed) || typeof values.closed === "boolean") { // @ts-ignore: type is checked above. @@ -130097,7 +143800,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti ); } } - clone.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount = this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount.slice(); + clone.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount = this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount.length < vocabSparseArrayMinimumLength + ? this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount.slice() : vocabCopyPropertyArray(this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount); if ("voters" in values && values.voters != null) { if (typeof values.voters === "number" && Number.isInteger(values.voters) && values.voters >= 0) { // @ts-ignore: type is checked above. @@ -130110,12 +143814,16 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti ); } } - clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice();clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote); + clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length < vocabSparseArrayMinimumLength + ? this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.slice() : vocabCopyPropertyArray(this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote);clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = vocabCopyTrustSet( + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote, + ); if ("quote" in values && values.quote != null) { if (values.quote instanceof Object || values.quote instanceof URL) { // @ts-ignore: type is checked above. clone.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = [values.quote]; - clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set([0]); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote = new Set(); + clone.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] = 1; } else { throw new TypeError( "The quote must be of type " + @@ -130123,7 +143831,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti ); } } - clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice(); + clone.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length < vocabSparseArrayMinimumLength + ? this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.slice() : vocabCopyPropertyArray(this.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl); if ("quoteUrl" in values && values.quoteUrl != null) { if (values.quoteUrl instanceof URL) { // @ts-ignore: type is checked above. @@ -130136,12 +143845,16 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti ); } } - clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice();clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization); + clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length < vocabSparseArrayMinimumLength + ? this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.slice() : vocabCopyPropertyArray(this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization);clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = vocabCopyTrustSet( + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization, + ); if ("quoteAuthorization" in values && values.quoteAuthorization != null) { if (values.quoteAuthorization instanceof QuoteAuthorization || values.quoteAuthorization instanceof URL) { // @ts-ignore: type is checked above. clone.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = [values.quoteAuthorization]; - clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set([0]); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization = new Set(); + clone.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] = 1; } else { throw new TypeError( "The quoteAuthorization must be of type " + @@ -130152,7 +143865,201 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOptions?: (Object | URL)[];closed?: Temporal.Instant | boolean | null;voters?: number | null;quote?: Object | URL | null;quoteUrl?: URL | null;quoteAuthorization?: QuoteAuthorization | URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Question { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Question; + + { + const array = node.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.length; i++) { + const value = node.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf[i]; + if (value != null && typeof value === "object") { + node.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.length; i++) { + const value = node.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf[i]; + if (value != null && typeof value === "object") { + node.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.length; i++) { + const value = node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i]; + if (value != null && typeof value === "object") { + node.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[i] = context.value(value); + } + } + } + } + + { + const array = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.length; i++) { + const value = node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i]; + if (value != null && typeof value === "object") { + node.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl[i] = context.value(value); + } + } + } + } + + { + const array = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.length; i++) { + const value = node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i]; + if (value != null && typeof value === "object") { + node.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[i] = context.value(value); + } + } + } + } +} }); } + async #fetchExclusiveOption( url: URL, options: { @@ -130481,7 +144388,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.has(i)) { + !(i < (this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#oneOf"); @@ -130553,7 +144461,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.has(i)) { + !(i < (this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -130906,7 +144815,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.has(i)) { + !(i < (this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#anyOf"); @@ -130978,7 +144888,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.has(i)) { + !(i < (this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf[vocabTrustPrefix] ?? 0) || + this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -131361,7 +145272,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti } let v = this.#_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[0]; if (!(v instanceof URL) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/044f#quote"); @@ -131429,7 +145341,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0)) { + !(0 < (this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote[vocabTrustPrefix] ?? 0) || + this.#_trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -131803,7 +145716,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti } let v = this.#_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[0]; if (!(v instanceof URL) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/044f#quoteAuthorization"); @@ -131871,7 +145785,8 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0)) { + !(0 < (this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization[vocabTrustPrefix] ?? 0) || + this.#_trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -132299,7 +146214,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf: (Object | URL)[] = []; - const _trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf: Set = new Set(); + const _trust_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf: VocabTrustSet = new Set(); let _2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf__array = values["https://www.w3.org/ns/activitystreams#oneOf"]; @@ -132340,7 +146255,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti instance.#_2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf = _2N5scKaVEcdYHFmfKYYacAwUhUgQ_oneOf; const _2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf: (Object | URL)[] = []; - const _trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf: Set = new Set(); + const _trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf: VocabTrustSet = new Set(); let _2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf__array = values["https://www.w3.org/ns/activitystreams#anyOf"]; @@ -132449,7 +146364,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti instance.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount = _3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount; const _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: (Object | URL)[] = []; - const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: Set = new Set(); + const _trust_3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote: VocabTrustSet = new Set(); let _3obhVLFML2Fh2Qsbg3BM2dec8S9e_quote__array = values["https://w3id.org/fep/044f#quote"]; @@ -132529,7 +146444,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti instance.#_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl = _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl; const _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: (QuoteAuthorization | URL)[] = []; - const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: Set = new Set(); + const _trust_ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization: VocabTrustSet = new Set(); let _ZKAEiJeuEvjeYkC4pG58D5vAJ4m_quoteAuthorization__array = values["https://w3id.org/fep/044f#quoteAuthorization"]; @@ -132836,8 +146751,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Read.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -132898,7 +146813,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Read; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Read { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -133276,8 +147267,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Reject.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -133319,26 +147310,102 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - verifyPortableObject?: PortableObjectVerifier, - } = {} - ): Reject { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - // @ts-ignore: $warning is not recognized as a property, but it is. - options = { ...options, $warning: this._warning }; - } - const clone = super.clone(values, options) as unknown as Reject; - return clone; + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {} + ): Reject { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as Reject; + return clone; + } + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Reject { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -133673,13 +147740,13 @@ export class Relationship extends Object { } #_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject: (Object | URL)[] = []; - #_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject: Set = new Set(); + #_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject: VocabTrustSet = new Set(); #_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; - #_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); + #_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: VocabTrustSet = new Set(); #_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship: (Object | URL)[] = []; - #_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship: Set = new Set(); + #_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship: VocabTrustSet = new Set(); /** * Constructs a new instance of Relationship with the given values. @@ -133754,14 +147821,36 @@ relationships?: (Object | URL)[];} ); } - if (Array.isArray(values.objects) && - values.objects.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.objects)) { + const array = values.objects; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.objects; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects.slice(); + this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = copied; - for (let i = 0; i < values.objects.length; i++) { - this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); - } + vocabSetTrustPrefix(this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length); } else { throw new TypeError( @@ -133794,14 +147883,36 @@ relationships?: (Object | URL)[];} ); } - if (Array.isArray(values.relationships) && - values.relationships.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.relationships)) { + const array = values.relationships; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.relationships; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = values.relationships.slice(); + this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = copied; - for (let i = 0; i < values.relationships.length; i++) { - this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.add(i); - } + vocabSetTrustPrefix(this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship, this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.length); } else { throw new TypeError( @@ -133823,8 +147934,8 @@ relationships?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Relationship.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -133878,12 +147989,16 @@ relationships?: (Object | URL)[];} // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Relationship;clone.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.slice();clone.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = new Set(this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject); + const clone = super.clone(values, options) as unknown as Relationship;clone.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.length < vocabSparseArrayMinimumLength + ? this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.slice() : vocabCopyPropertyArray(this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject);clone.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = vocabCopyTrustSet( + this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject, clone.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject, + ); if ("subject" in values && values.subject != null) { if (values.subject instanceof Object || values.subject instanceof URL) { // @ts-ignore: type is checked above. clone.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = [values.subject]; - clone.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = new Set([0]); + clone.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = new Set(); + clone.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject[vocabTrustPrefix] = 1; } else { throw new TypeError( "The subject must be of type " + @@ -133891,12 +148006,16 @@ relationships?: (Object | URL)[];} ); } } - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.slice();clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object); + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length < vocabSparseArrayMinimumLength + ? this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.slice() : vocabCopyPropertyArray(this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object);clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = vocabCopyTrustSet( + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, + ); if ("object" in values && values.object != null) { if (values.object instanceof Object || values.object instanceof URL) { // @ts-ignore: type is checked above. clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = [values.object]; - clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set([0]); + clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(); + clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] = 1; } else { throw new TypeError( "The object must be of type " + @@ -133915,15 +148034,37 @@ relationships?: (Object | URL)[];} ); } - if (Array.isArray(values.objects) && - values.objects.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.objects)) { + const array = values.objects; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.objects; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = values.objects.slice(); + clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = copied; clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = new Set(); - for (let i = 0; i < values.objects.length; i++) { - clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.add(i); - } + vocabSetTrustPrefix(clone.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object, clone.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length); } else { throw new TypeError( @@ -133932,12 +148073,16 @@ relationships?: (Object | URL)[];} ); } } - clone.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.slice();clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = new Set(this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship); + clone.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.length < vocabSparseArrayMinimumLength + ? this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.slice() : vocabCopyPropertyArray(this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship);clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = vocabCopyTrustSet( + this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship, clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship, + ); if ("relationship" in values && values.relationship != null) { if (values.relationship instanceof Object || values.relationship instanceof URL) { // @ts-ignore: type is checked above. clone.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = [values.relationship]; - clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = new Set([0]); + clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = new Set(); + clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[vocabTrustPrefix] = 1; } else { throw new TypeError( "The relationship must be of type " + @@ -133956,15 +148101,37 @@ relationships?: (Object | URL)[];} ); } - if (Array.isArray(values.relationships) && - values.relationships.every(v => v instanceof Object || v instanceof URL)) { + let copied!: (Object | URL)[]; + let valid = false; + if (Array.isArray(values.relationships)) { + const array = values.relationships; + const test = (v: Object | URL): boolean => v instanceof Object || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.relationships; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = values.relationships.slice(); + clone.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = copied; clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship = new Set(); - for (let i = 0; i < values.relationships.length; i++) { - clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship, clone.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.length); } else { throw new TypeError( @@ -133976,7 +148143,153 @@ relationships?: (Object | URL)[];} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];subject?: Object | URL | null;object?: Object | URL | null; +objects?: (Object | URL)[];relationship?: Object | URL | null; +relationships?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Relationship { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Relationship; + + { + const array = node.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.length; i++) { + const value = node.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject[i]; + if (value != null && typeof value === "object") { + node.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.length; i++) { + const value = node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[i]; + if (value != null && typeof value === "object") { + node.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.length; i++) { + const value = node.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[i]; + if (value != null && typeof value === "object") { + node.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[i] = context.value(value); + } + } + } + } +} }); } + async #fetchSubject( url: URL, options: { @@ -134306,7 +148619,8 @@ relationships?: (Object | URL)[];} } let v = this.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject[0]; if (!(v instanceof URL) && - !this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.has(0)) { + !(0 < (this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject[vocabTrustPrefix] ?? 0) || + this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#subject"); @@ -134374,7 +148688,8 @@ relationships?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.has(0)) { + !(0 < (this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject[vocabTrustPrefix] ?? 0) || + this.#_trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -134724,7 +149039,8 @@ relationships?: (Object | URL)[];} } let v = this.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[0]; if (!(v instanceof URL) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { + !(0 < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#object"); @@ -134792,7 +149108,8 @@ relationships?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0)) { + !(0 < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -134880,7 +149197,8 @@ relationships?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i)) { + !(i < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#object"); @@ -134952,7 +149270,8 @@ relationships?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i)) { + !(i < (this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object[vocabTrustPrefix] ?? 0) || + this.#_trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -135305,7 +149624,8 @@ relationships?: (Object | URL)[];} } let v = this.#_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[0]; if (!(v instanceof URL) && - !this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(0)) { + !(0 < (this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[vocabTrustPrefix] ?? 0) || + this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#relationship"); @@ -135373,7 +149693,8 @@ relationships?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(0)) { + !(0 < (this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[vocabTrustPrefix] ?? 0) || + this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -135463,7 +149784,8 @@ relationships?: (Object | URL)[];} for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(i)) { + !(i < (this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[vocabTrustPrefix] ?? 0) || + this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#relationship"); @@ -135535,7 +149857,8 @@ relationships?: (Object | URL)[];} mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(i)) { + !(i < (this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship[vocabTrustPrefix] ?? 0) || + this.#_trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -135953,7 +150276,7 @@ relationships?: (Object | URL)[];} let shouldCacheJsonLd = instance._shouldCacheJsonLd; const _2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject: (Object | URL)[] = []; - const _trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject: Set = new Set(); + const _trust_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject: VocabTrustSet = new Set(); let _2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject__array = values["https://www.w3.org/ns/activitystreams#subject"]; @@ -135994,7 +150317,7 @@ relationships?: (Object | URL)[];} instance.#_2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject = _2Zqdmi46ZnDQsECS6mzwhrv3rUKq_subject; const _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: (Object | URL)[] = []; - const _trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: Set = new Set(); + const _trust_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object: VocabTrustSet = new Set(); let _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object__array = values["https://www.w3.org/ns/activitystreams#object"]; @@ -136035,7 +150358,7 @@ relationships?: (Object | URL)[];} instance.#_2MH19yxjn1wnHsNfa5n4JBhJzxyc_object = _2MH19yxjn1wnHsNfa5n4JBhJzxyc_object; const _4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship: (Object | URL)[] = []; - const _trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship: Set = new Set(); + const _trust_4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship: VocabTrustSet = new Set(); let _4Lzz89F9qipAQSGkWyX9DGWiUojG_relationship__array = values["https://www.w3.org/ns/activitystreams#relationship"]; @@ -136271,8 +150594,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Remove.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -136333,7 +150656,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Remove; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Remove { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -136658,39 +151057,39 @@ export class Service extends Object { #_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername: ((string | LanguageString))[] = []; #_axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + #_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); #_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + #_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); #_hQiaHhZP8hqxckxTBrpsGNs57E3: (URL)[] = []; #_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers: (boolean)[] = []; #_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + #_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); #_41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + #_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); #_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + #_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); #_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + #_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); #_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + #_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); #_4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + #_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); #_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + #_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); #_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + #_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); #_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + #_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); #_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints: (Endpoints)[] = []; #_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable: (boolean)[] = []; #_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended: (boolean)[] = []; @@ -136698,13 +151097,13 @@ export class Service extends Object { #_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable: (boolean)[] = []; #_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + #_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); #_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + #_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); #_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + #_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); #_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage: (string)[] = []; #_2xEU4QtkC53RAun67T81Egqt9vmL_isCat: (boolean)[] = []; #_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense: (URL)[] = []; @@ -136773,10 +151172,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === "string" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === "string" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -136809,14 +151232,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; - for (let i = 0; i < values.publicKeys.length; i++) { - this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -136849,14 +151294,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; - for (let i = 0; i < values.assertionMethods.length; i++) { - this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -136889,10 +151356,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + this.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -137021,14 +151512,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | if ("streams" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; - for (let i = 0; i < values.streams.length; i++) { - this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -137139,14 +151652,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; - for (let i = 0; i < values.aliases.length; i++) { - this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -137179,14 +151714,36 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; - for (let i = 0; i < values.services.length; i++) { - this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -137247,8 +151804,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Service.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -137306,7 +151863,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Service;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice(); + const clone = super.clone(values, options) as unknown as Service;clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.length < vocabSparseArrayMinimumLength + ? this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername.slice() : vocabCopyPropertyArray(this.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername); if ("preferredUsername" in values && values.preferredUsername != null) { if (typeof values.preferredUsername === "string" || values.preferredUsername instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -137330,10 +151888,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.preferredUsernames) && - values.preferredUsernames.every(v => typeof v === "string" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.preferredUsernames)) { + const array = values.preferredUsernames; + const test = (v: string | LanguageString): boolean => typeof v === "string" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.preferredUsernames; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = values.preferredUsernames.slice(); + clone.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = copied; } else { throw new TypeError( @@ -137342,12 +151924,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice();clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length < vocabSparseArrayMinimumLength + ? this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.slice() : vocabCopyPropertyArray(this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey);clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = vocabCopyTrustSet( + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, + ); if ("publicKey" in values && values.publicKey != null) { if (values.publicKey instanceof CryptographicKey || values.publicKey instanceof URL) { // @ts-ignore: type is checked above. clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = [values.publicKey]; - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set([0]); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); + clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] = 1; } else { throw new TypeError( "The publicKey must be of type " + @@ -137366,15 +151952,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.publicKeys) && - values.publicKeys.every(v => v instanceof CryptographicKey || v instanceof URL)) { + let copied!: (CryptographicKey | URL)[]; + let valid = false; + if (Array.isArray(values.publicKeys)) { + const array = values.publicKeys; + const test = (v: CryptographicKey | URL): boolean => v instanceof CryptographicKey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.publicKeys; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = values.publicKeys.slice(); + clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = copied; clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey = new Set(); - for (let i = 0; i < values.publicKeys.length; i++) { - clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.add(i); - } + vocabSetTrustPrefix(clone.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey, clone.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length); } else { throw new TypeError( @@ -137383,12 +151991,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice();clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length < vocabSparseArrayMinimumLength + ? this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.slice() : vocabCopyPropertyArray(this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod);clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = vocabCopyTrustSet( + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, + ); if ("assertionMethod" in values && values.assertionMethod != null) { if (values.assertionMethod instanceof Multikey || values.assertionMethod instanceof URL) { // @ts-ignore: type is checked above. clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = [values.assertionMethod]; - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set([0]); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); + clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] = 1; } else { throw new TypeError( "The assertionMethod must be of type " + @@ -137407,15 +152019,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.assertionMethods) && - values.assertionMethods.every(v => v instanceof Multikey || v instanceof URL)) { + let copied!: (Multikey | URL)[]; + let valid = false; + if (Array.isArray(values.assertionMethods)) { + const array = values.assertionMethods; + const test = (v: Multikey | URL): boolean => v instanceof Multikey || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.assertionMethods; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = values.assertionMethods.slice(); + clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = copied; clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod = new Set(); - for (let i = 0; i < values.assertionMethods.length; i++) { - clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod, clone.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length); } else { throw new TypeError( @@ -137424,7 +152058,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length < vocabSparseArrayMinimumLength + ? this.#_hQiaHhZP8hqxckxTBrpsGNs57E3.slice() : vocabCopyPropertyArray(this.#_hQiaHhZP8hqxckxTBrpsGNs57E3); if ("gateway" in values && values.gateway != null) { if (values.gateway instanceof URL && isGatewayUrl(values.gateway)) { // @ts-ignore: type is checked above. @@ -137448,10 +152083,34 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.gateways) && - values.gateways.every(v => v instanceof URL && isGatewayUrl(v))) { + let copied!: (URL)[]; + let valid = false; + if (Array.isArray(values.gateways)) { + const array = values.gateways; + const test = (v: URL): boolean => v instanceof URL && isGatewayUrl(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.gateways; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = values.gateways.slice(); + clone.#_hQiaHhZP8hqxckxTBrpsGNs57E3 = copied; } else { throw new TypeError( @@ -137460,7 +152119,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice(); + clone.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.length < vocabSparseArrayMinimumLength + ? this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers.slice() : vocabCopyPropertyArray(this.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers); if ("manuallyApprovesFollowers" in values && values.manuallyApprovesFollowers != null) { if (typeof values.manuallyApprovesFollowers === "boolean") { // @ts-ignore: type is checked above. @@ -137473,12 +152133,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice();clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox); + clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length < vocabSparseArrayMinimumLength + ? this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.slice() : vocabCopyPropertyArray(this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox);clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = vocabCopyTrustSet( + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox, + ); if ("inbox" in values && values.inbox != null) { if (values.inbox instanceof OrderedCollection || values.inbox instanceof OrderedCollectionPage || values.inbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = [values.inbox]; - clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set([0]); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = new Set(); + clone.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] = 1; } else { throw new TypeError( "The inbox must be of type " + @@ -137486,12 +152150,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice();clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox); + clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length < vocabSparseArrayMinimumLength + ? this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.slice() : vocabCopyPropertyArray(this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox);clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = vocabCopyTrustSet( + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox, + ); if ("outbox" in values && values.outbox != null) { if (values.outbox instanceof OrderedCollection || values.outbox instanceof OrderedCollectionPage || values.outbox instanceof URL) { // @ts-ignore: type is checked above. clone.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = [values.outbox]; - clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set([0]); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox = new Set(); + clone.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] = 1; } else { throw new TypeError( "The outbox must be of type " + @@ -137499,12 +152167,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice();clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following); + clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length < vocabSparseArrayMinimumLength + ? this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.slice() : vocabCopyPropertyArray(this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following);clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = vocabCopyTrustSet( + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following, + ); if ("following" in values && values.following != null) { if (values.following instanceof Collection || values.following instanceof URL) { // @ts-ignore: type is checked above. clone.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = [values.following]; - clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set([0]); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = new Set(); + clone.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] = 1; } else { throw new TypeError( "The following must be of type " + @@ -137512,12 +152184,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice();clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers); + clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length < vocabSparseArrayMinimumLength + ? this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.slice() : vocabCopyPropertyArray(this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers);clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = vocabCopyTrustSet( + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers, + ); if ("followers" in values && values.followers != null) { if (values.followers instanceof Collection || values.followers instanceof URL) { // @ts-ignore: type is checked above. clone.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = [values.followers]; - clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set([0]); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = new Set(); + clone.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] = 1; } else { throw new TypeError( "The followers must be of type " + @@ -137525,12 +152201,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice();clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked); + clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length < vocabSparseArrayMinimumLength + ? this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.slice() : vocabCopyPropertyArray(this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked);clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = vocabCopyTrustSet( + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked, + ); if ("liked" in values && values.liked != null) { if (values.liked instanceof Collection || values.liked instanceof URL) { // @ts-ignore: type is checked above. clone.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = [values.liked]; - clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set([0]); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = new Set(); + clone.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] = 1; } else { throw new TypeError( "The liked must be of type " + @@ -137538,12 +152218,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice();clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured); + clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length < vocabSparseArrayMinimumLength + ? this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.slice() : vocabCopyPropertyArray(this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured);clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = vocabCopyTrustSet( + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured, + ); if ("featured" in values && values.featured != null) { if (values.featured instanceof Collection || values.featured instanceof URL) { // @ts-ignore: type is checked above. clone.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = [values.featured]; - clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set([0]); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured = new Set(); + clone.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] = 1; } else { throw new TypeError( "The featured must be of type " + @@ -137551,12 +152235,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice();clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags); + clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length < vocabSparseArrayMinimumLength + ? this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.slice() : vocabCopyPropertyArray(this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags);clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = vocabCopyTrustSet( + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags, + ); if ("featuredTags" in values && values.featuredTags != null) { if (values.featuredTags instanceof Collection || values.featuredTags instanceof URL) { // @ts-ignore: type is checked above. clone.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = [values.featuredTags]; - clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set([0]); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = new Set(); + clone.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] = 1; } else { throw new TypeError( "The featuredTags must be of type " + @@ -137564,12 +152252,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice();clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections); + clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length < vocabSparseArrayMinimumLength + ? this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.slice() : vocabCopyPropertyArray(this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections);clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = vocabCopyTrustSet( + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections, + ); if ("featuredCollections" in values && values.featuredCollections != null) { if (values.featuredCollections instanceof Collection || values.featuredCollections instanceof URL) { // @ts-ignore: type is checked above. clone.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = [values.featuredCollections]; - clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set([0]); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = new Set(); + clone.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] = 1; } else { throw new TypeError( "The featuredCollections must be of type " + @@ -137577,18 +152269,43 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice();clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length < vocabSparseArrayMinimumLength + ? this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.slice() : vocabCopyPropertyArray(this.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams);clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = vocabCopyTrustSet( + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, + ); if ("streams" in values && values.streams != null) { - if (Array.isArray(values.streams) && - values.streams.every(v => v instanceof Collection || v instanceof URL)) { + let copied!: (Collection | URL)[]; + let valid = false; + if (Array.isArray(values.streams)) { + const array = values.streams; + const test = (v: Collection | URL): boolean => v instanceof Collection || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.streams; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = values.streams.slice(); + clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = copied; clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams = new Set(); - for (let i = 0; i < values.streams.length; i++) { - clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams, clone.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length); } else { throw new TypeError( @@ -137597,7 +152314,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice(); + clone.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints = this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length < vocabSparseArrayMinimumLength + ? this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.slice() : vocabCopyPropertyArray(this.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints); if ("endpoints" in values && values.endpoints != null) { if (values.endpoints instanceof Endpoints) { // @ts-ignore: type is checked above. @@ -137610,7 +152328,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice(); + clone.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable = this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.length < vocabSparseArrayMinimumLength + ? this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable.slice() : vocabCopyPropertyArray(this.#_gAJzg1QDc4rcefFsUzGSYmyXvNH_discoverable); if ("discoverable" in values && values.discoverable != null) { if (typeof values.discoverable === "boolean") { // @ts-ignore: type is checked above. @@ -137623,7 +152342,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice(); + clone.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended = this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.length < vocabSparseArrayMinimumLength + ? this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended.slice() : vocabCopyPropertyArray(this.#_2kGKkJtoFWg8c18PaVSqj9NKP4t7_suspended); if ("suspended" in values && values.suspended != null) { if (typeof values.suspended === "boolean") { // @ts-ignore: type is checked above. @@ -137636,7 +152356,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice(); + clone.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial = this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.length < vocabSparseArrayMinimumLength + ? this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial.slice() : vocabCopyPropertyArray(this.#_79S8K4f5J9MWUgCxziRyUe6PTHZ_memorial); if ("memorial" in values && values.memorial != null) { if (typeof values.memorial === "boolean") { // @ts-ignore: type is checked above. @@ -137649,7 +152370,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice(); + clone.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.length < vocabSparseArrayMinimumLength + ? this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable.slice() : vocabCopyPropertyArray(this.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable); if ("indexable" in values && values.indexable != null) { if (typeof values.indexable === "boolean") { // @ts-ignore: type is checked above. @@ -137662,12 +152384,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice();clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo); + clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length < vocabSparseArrayMinimumLength + ? this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.slice() : vocabCopyPropertyArray(this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo);clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = vocabCopyTrustSet( + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo, + ); if ("successor" in values && values.successor != null) { if (values.successor instanceof Application || values.successor instanceof Group || values.successor instanceof Organization || values.successor instanceof Person || values.successor instanceof Service || values.successor instanceof URL) { // @ts-ignore: type is checked above. clone.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = [values.successor]; - clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set([0]); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = new Set(); + clone.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] = 1; } else { throw new TypeError( "The successor must be of type " + @@ -137675,12 +152401,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice();clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length < vocabSparseArrayMinimumLength + ? this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.slice() : vocabCopyPropertyArray(this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs);clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = vocabCopyTrustSet( + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, + ); if ("alias" in values && values.alias != null) { if (values.alias instanceof Application || values.alias instanceof Group || values.alias instanceof Organization || values.alias instanceof Person || values.alias instanceof Service || values.alias instanceof URL) { // @ts-ignore: type is checked above. clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = [values.alias]; - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set([0]); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); + clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] = 1; } else { throw new TypeError( "The alias must be of type " + @@ -137699,15 +152429,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.aliases) && - values.aliases.every(v => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL)) { + let copied!: (Application | Group | Organization | Person | Service | URL)[]; + let valid = false; + if (Array.isArray(values.aliases)) { + const array = values.aliases; + const test = (v: Application | Group | Organization | Person | Service | URL): boolean => v instanceof Application || v instanceof Group || v instanceof Organization || v instanceof Person || v instanceof Service || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.aliases; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = values.aliases.slice(); + clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = copied; clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = new Set(); - for (let i = 0; i < values.aliases.length; i++) { - clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.add(i); - } + vocabSetTrustPrefix(clone.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs, clone.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length); } else { throw new TypeError( @@ -137716,12 +152468,16 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice();clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length < vocabSparseArrayMinimumLength + ? this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.slice() : vocabCopyPropertyArray(this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service);clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = vocabCopyTrustSet( + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, + ); if ("service" in values && values.service != null) { if (values.service instanceof DidService || values.service instanceof URL) { // @ts-ignore: type is checked above. clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = [values.service]; - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set([0]); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); + clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] = 1; } else { throw new TypeError( "The service must be of type " + @@ -137740,15 +152496,37 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } - if (Array.isArray(values.services) && - values.services.every(v => v instanceof DidService || v instanceof URL)) { + let copied!: (DidService | URL)[]; + let valid = false; + if (Array.isArray(values.services)) { + const array = values.services; + const test = (v: DidService | URL): boolean => v instanceof DidService || v instanceof URL; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.services; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = values.services.slice(); + clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = copied; clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service = new Set(); - for (let i = 0; i < values.services.length; i++) { - clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.add(i); - } + vocabSetTrustPrefix(clone.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service, clone.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length); } else { throw new TypeError( @@ -137757,7 +152535,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice(); + clone.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage = this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.length < vocabSparseArrayMinimumLength + ? this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage.slice() : vocabCopyPropertyArray(this.#_QuxorEK1txp7jGjq8BRQfTPvUwp__misskey_followedMessage); if ("followedMessage" in values && values.followedMessage != null) { if (typeof values.followedMessage === "string") { // @ts-ignore: type is checked above. @@ -137770,7 +152549,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice(); + clone.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat = this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.length < vocabSparseArrayMinimumLength + ? this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat.slice() : vocabCopyPropertyArray(this.#_2xEU4QtkC53RAun67T81Egqt9vmL_isCat); if ("cat" in values && values.cat != null) { if (typeof values.cat === "boolean") { // @ts-ignore: type is checked above. @@ -137783,7 +152563,8 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | ); } } - clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice(); + clone.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense = this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length < vocabSparseArrayMinimumLength + ? this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.slice() : vocabCopyPropertyArray(this.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense); if ("preferredLicense" in values && values.preferredLicense != null) { if (values.preferredLicense instanceof URL) { // @ts-ignore: type is checked above. @@ -137799,7 +152580,465 @@ services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];preferredUsername?: string | LanguageString | null; +preferredUsernames?: ((string | LanguageString))[];publicKey?: CryptographicKey | URL | null; +publicKeys?: (CryptographicKey | URL)[];assertionMethod?: Multikey | URL | null; +assertionMethods?: (Multikey | URL)[];gateway?: URL | null; +gateways?: (URL)[];manuallyApprovesFollowers?: boolean | null;inbox?: OrderedCollection | OrderedCollectionPage | URL | null;outbox?: OrderedCollection | OrderedCollectionPage | URL | null;following?: Collection | URL | null;followers?: Collection | URL | null;liked?: Collection | URL | null;featured?: Collection | URL | null;featuredTags?: Collection | URL | null;featuredCollections?: Collection | URL | null;streams?: (Collection | URL)[];endpoints?: Endpoints | null;discoverable?: boolean | null;suspended?: boolean | null;memorial?: boolean | null;indexable?: boolean | null;successor?: Application | Group | Organization | Person | Service | URL | null;alias?: Application | Group | Organization | Person | Service | URL | null; +aliases?: (Application | Group | Organization | Person | Service | URL)[];service?: DidService | URL | null; +services?: (DidService | URL)[];followedMessage?: string | null;cat?: boolean | null;preferredLicense?: URL | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Service { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as Service; + + { + const array = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey.length; i++) { + const value = node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i]; + if (value != null && typeof value === "object") { + node.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.length; i++) { + const value = node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i]; + if (value != null && typeof value === "object") { + node.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[i] = context.value(value); + } + } + } + } + + { + const array = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_hQiaHhZP8hqxckxTBrpsGNs57E3.length; i++) { + const value = node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i]; + if (value != null && typeof value === "object") { + node.#_hQiaHhZP8hqxckxTBrpsGNs57E3[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.length; i++) { + const value = node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i]; + if (value != null && typeof value === "object") { + node.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox.length; i++) { + const value = node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i]; + if (value != null && typeof value === "object") { + node.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.length; i++) { + const value = node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i]; + if (value != null && typeof value === "object") { + node.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[i] = context.value(value); + } + } + } + } + + { + const array = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.length; i++) { + const value = node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i]; + if (value != null && typeof value === "object") { + node.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.length; i++) { + const value = node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i]; + if (value != null && typeof value === "object") { + node.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured.length; i++) { + const value = node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i]; + if (value != null && typeof value === "object") { + node.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.length; i++) { + const value = node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i]; + if (value != null && typeof value === "object") { + node.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[i] = context.value(value); + } + } + } + } + + { + const array = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.length; i++) { + const value = node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i]; + if (value != null && typeof value === "object") { + node.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.length; i++) { + const value = node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i]; + if (value != null && typeof value === "object") { + node.#_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[i] = context.value(value); + } + } + } + } + + { + const array = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints.length; i++) { + const value = node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i]; + if (value != null && typeof value === "object") { + node.#_sEoQwUbfk4hEfugzNQ2ZiDcLMkG_endpoints[i] = context.value(value); + } + } + } + } + + { + const array = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.length; i++) { + const value = node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i]; + if (value != null && typeof value === "object") { + node.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[i] = context.value(value); + } + } + } + } + + { + const array = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.length; i++) { + const value = node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i]; + if (value != null && typeof value === "object") { + node.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[i] = context.value(value); + } + } + } + } + + { + const array = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.length; i++) { + const value = node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i]; + if (value != null && typeof value === "object") { + node.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[i] = context.value(value); + } + } + } + } + + { + const array = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense.length; i++) { + const value = node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i]; + if (value != null && typeof value === "object") { + node.#_248SCMQLVt8i7L4vUstp5SmQQFH6_preferredLicense[i] = context.value(value); + } + } + } + } +} }); } + /** A short username which may be used to refer to the actor, * with no uniqueness guarantees. * @@ -138148,7 +153387,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey[0]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#publicKey"); @@ -138216,7 +153456,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0)) { + !(0 < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -138303,7 +153544,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#publicKey"); @@ -138375,7 +153617,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i)) { + !(i < (this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey[vocabTrustPrefix] ?? 0) || + this.#_trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -138729,7 +153972,8 @@ get preferredUsernames(): ((string | LanguageString))[] { } let v = this.#_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[0]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#assertionMethod"); @@ -138797,7 +154041,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0)) { + !(0 < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -138888,7 +154133,8 @@ get preferredUsernames(): ((string | LanguageString))[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/security#assertionMethod"); @@ -138960,7 +154206,8 @@ get preferredUsernames(): ((string | LanguageString))[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i)) { + !(i < (this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod[vocabTrustPrefix] ?? 0) || + this.#_trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -139384,7 +154631,8 @@ get gateways(): (URL)[] { } let v = this.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[0]; if (!(v instanceof URL) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "http://www.w3.org/ns/ldp#inbox"); @@ -139452,7 +154700,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0)) { + !(0 < (this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox[vocabTrustPrefix] ?? 0) || + this.#_trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -139826,7 +155075,8 @@ get gateways(): (URL)[] { } let v = this.#_41QwhqJouoLg3h8dRPKat21brynC_outbox[0]; if (!(v instanceof URL) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#outbox"); @@ -139894,7 +155144,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0)) { + !(0 < (this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox[vocabTrustPrefix] ?? 0) || + this.#_trust_41QwhqJouoLg3h8dRPKat21brynC_outbox.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -140248,7 +155499,8 @@ get gateways(): (URL)[] { } let v = this.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[0]; if (!(v instanceof URL) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#following"); @@ -140316,7 +155568,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0)) { + !(0 < (this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following[vocabTrustPrefix] ?? 0) || + this.#_trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -140673,7 +155926,8 @@ get gateways(): (URL)[] { } let v = this.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[0]; if (!(v instanceof URL) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#followers"); @@ -140741,7 +155995,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0)) { + !(0 < (this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers[vocabTrustPrefix] ?? 0) || + this.#_trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -141096,7 +156351,8 @@ get gateways(): (URL)[] { } let v = this.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[0]; if (!(v instanceof URL) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#liked"); @@ -141164,7 +156420,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0)) { + !(0 < (this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked[vocabTrustPrefix] ?? 0) || + this.#_trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -141517,7 +156774,8 @@ get gateways(): (URL)[] { } let v = this.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured[0]; if (!(v instanceof URL) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "http://joinmastodon.org/ns#featured"); @@ -141585,7 +156843,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0)) { + !(0 < (this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured[vocabTrustPrefix] ?? 0) || + this.#_trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -141938,7 +157197,8 @@ get gateways(): (URL)[] { } let v = this.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[0]; if (!(v instanceof URL) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "http://joinmastodon.org/ns#featuredTags"); @@ -142006,7 +157266,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0)) { + !(0 < (this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags[vocabTrustPrefix] ?? 0) || + this.#_trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -142356,7 +157617,8 @@ get gateways(): (URL)[] { } let v = this.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[0]; if (!(v instanceof URL) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://w3id.org/fep/7aa9#featuredCollections"); @@ -142424,7 +157686,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0)) { + !(0 < (this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections[vocabTrustPrefix] ?? 0) || + this.#_trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -142774,7 +158037,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#streams"); @@ -142846,7 +158110,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i)) { + !(i < (this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams[vocabTrustPrefix] ?? 0) || + this.#_trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -143331,7 +158596,8 @@ get gateways(): (URL)[] { } let v = this.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[0]; if (!(v instanceof URL) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#movedTo"); @@ -143399,7 +158665,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0)) { + !(0 < (this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo[vocabTrustPrefix] ?? 0) || + this.#_trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -143812,7 +159079,8 @@ get gateways(): (URL)[] { } let v = this.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[0]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#alsoKnownAs"); @@ -143880,7 +159148,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0)) { + !(0 < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -143971,7 +159240,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/activitystreams#alsoKnownAs"); @@ -144043,7 +159313,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i)) { + !(i < (this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs[vocabTrustPrefix] ?? 0) || + this.#_trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -144397,7 +159668,8 @@ get gateways(): (URL)[] { } let v = this.#_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[0]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/did#service"); @@ -144465,7 +159737,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0)) { + !(0 < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -144556,7 +159829,8 @@ get gateways(): (URL)[] { for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, "https://www.w3.org/ns/did#service"); @@ -144628,7 +159902,8 @@ get gateways(): (URL)[] { mustDereferencePortableObject( this, this.id, v.id, options, )) && - !this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i)) { + !(i < (this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service[vocabTrustPrefix] ?? 0) || + this.#_trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -146027,7 +161302,7 @@ get gateways(): (URL)[] { instance.#_3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername = _3isuDgRAKSntq9XdbjiNxjwyPZAf_preferredUsername; const _axq166E2eZADq34V4MYUc8KMZdC_publicKey: (CryptographicKey | URL)[] = []; - const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: Set = new Set(); + const _trust_axq166E2eZADq34V4MYUc8KMZdC_publicKey: VocabTrustSet = new Set(); let _axq166E2eZADq34V4MYUc8KMZdC_publicKey__array = values["https://w3id.org/security#publicKey"]; @@ -146068,7 +161343,7 @@ get gateways(): (URL)[] { instance.#_axq166E2eZADq34V4MYUc8KMZdC_publicKey = _axq166E2eZADq34V4MYUc8KMZdC_publicKey; const _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: (Multikey | URL)[] = []; - const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: Set = new Set(); + const _trust_4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod: VocabTrustSet = new Set(); let _4EHQFWZSz1k1d4LmPrQiMba2GbP3_assertionMethod__array = values["https://w3id.org/security#assertionMethod"]; @@ -146167,7 +161442,7 @@ get gateways(): (URL)[] { instance.#_36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers = _36QNc9MxfkKf6h8sEUQSHnV9NZA_manuallyApprovesFollowers; const _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: Set = new Set(); + const _trust_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox: VocabTrustSet = new Set(); let _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox__array = values["http://www.w3.org/ns/ldp#inbox"]; @@ -146214,7 +161489,7 @@ get gateways(): (URL)[] { instance.#_3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox = _3ghX3VfZXXbLvhCRH7QJqpzLrXjB_inbox; const _41QwhqJouoLg3h8dRPKat21brynC_outbox: (OrderedCollection | OrderedCollectionPage | URL)[] = []; - const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: Set = new Set(); + const _trust_41QwhqJouoLg3h8dRPKat21brynC_outbox: VocabTrustSet = new Set(); let _41QwhqJouoLg3h8dRPKat21brynC_outbox__array = values["https://www.w3.org/ns/activitystreams#outbox"]; @@ -146261,7 +161536,7 @@ get gateways(): (URL)[] { instance.#_41QwhqJouoLg3h8dRPKat21brynC_outbox = _41QwhqJouoLg3h8dRPKat21brynC_outbox; const _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: (Collection | URL)[] = []; - const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: Set = new Set(); + const _trust_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following: VocabTrustSet = new Set(); let _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following__array = values["https://www.w3.org/ns/activitystreams#following"]; @@ -146302,7 +161577,7 @@ get gateways(): (URL)[] { instance.#_3yAv8jymNfNuJUDuBzJ1NQhdbAee_following = _3yAv8jymNfNuJUDuBzJ1NQhdbAee_following; const _BBCTgfphhsFzpVfKTykGSpBNwoA_followers: (Collection | URL)[] = []; - const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: Set = new Set(); + const _trust_BBCTgfphhsFzpVfKTykGSpBNwoA_followers: VocabTrustSet = new Set(); let _BBCTgfphhsFzpVfKTykGSpBNwoA_followers__array = values["https://www.w3.org/ns/activitystreams#followers"]; @@ -146343,7 +161618,7 @@ get gateways(): (URL)[] { instance.#_BBCTgfphhsFzpVfKTykGSpBNwoA_followers = _BBCTgfphhsFzpVfKTykGSpBNwoA_followers; const _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: (Collection | URL)[] = []; - const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: Set = new Set(); + const _trust_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked: VocabTrustSet = new Set(); let _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked__array = values["https://www.w3.org/ns/activitystreams#liked"]; @@ -146384,7 +161659,7 @@ get gateways(): (URL)[] { instance.#_3bgkPwJanyTCoVFM9ovRcus8tKkU_liked = _3bgkPwJanyTCoVFM9ovRcus8tKkU_liked; const _4N1vBJzXDf8NbBumeECQMFvKetja_featured: (Collection | URL)[] = []; - const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: Set = new Set(); + const _trust_4N1vBJzXDf8NbBumeECQMFvKetja_featured: VocabTrustSet = new Set(); let _4N1vBJzXDf8NbBumeECQMFvKetja_featured__array = values["http://joinmastodon.org/ns#featured"]; @@ -146425,7 +161700,7 @@ get gateways(): (URL)[] { instance.#_4N1vBJzXDf8NbBumeECQMFvKetja_featured = _4N1vBJzXDf8NbBumeECQMFvKetja_featured; const _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: (Collection | URL)[] = []; - const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: Set = new Set(); + const _trust_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags: VocabTrustSet = new Set(); let _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags__array = values["http://joinmastodon.org/ns#featuredTags"]; @@ -146466,7 +161741,7 @@ get gateways(): (URL)[] { instance.#_2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags = _2MxnRRLq9iPzx5CFq2NPrXdUDCac_featuredTags; const _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: (Collection | URL)[] = []; - const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: Set = new Set(); + const _trust_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections: VocabTrustSet = new Set(); let _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections__array = values["https://w3id.org/fep/7aa9#featuredCollections"]; @@ -146507,7 +161782,7 @@ get gateways(): (URL)[] { instance.#_43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections = _43Vdn8myiwHqPANJwoAEF3Yy3vsd_featuredCollections; const _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: (Collection | URL)[] = []; - const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: Set = new Set(); + const _trust_3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams: VocabTrustSet = new Set(); let _3sG2Hdwn9qzKGu9mpYkqakAMUkH9_streams__array = values["https://www.w3.org/ns/activitystreams#streams"]; @@ -146696,7 +161971,7 @@ get gateways(): (URL)[] { instance.#_2diCorzqPGQQqftp6e4SrCEwEnyk_indexable = _2diCorzqPGQQqftp6e4SrCEwEnyk_indexable; const _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: Set = new Set(); + const _trust_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo: VocabTrustSet = new Set(); let _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo__array = values["https://www.w3.org/ns/activitystreams#movedTo"]; @@ -146754,7 +162029,7 @@ get gateways(): (URL)[] { instance.#_2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo = _2ZNWDhuNdSXBwEmrB5kwffdKGzok_movedTo; const _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: (Application | Group | Organization | Person | Service | URL)[] = []; - const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: Set = new Set(); + const _trust_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs: VocabTrustSet = new Set(); let _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs__array = values["https://www.w3.org/ns/activitystreams#alsoKnownAs"]; @@ -146812,7 +162087,7 @@ get gateways(): (URL)[] { instance.#_3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs = _3NV7TGNhuABbryNjNi4wib4DgNpY_alsoKnownAs; const _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: (DidService | URL)[] = []; - const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: Set = new Set(); + const _trust_4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service: VocabTrustSet = new Set(); let _4Q6NrKH6bazBGtxwG8vyG77ir7Tg_service__array = values["https://www.w3.org/ns/did#service"]; @@ -147679,10 +162954,34 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} ); } - if (Array.isArray(values.contents) && - values.contents.every(v => typeof v === "string" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.contents)) { + const array = values.contents; + const test = (v: string | LanguageString): boolean => typeof v === "string" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.contents; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = values.contents.slice(); + this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = copied; } else { throw new TypeError( @@ -147717,8 +163016,8 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Source.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -147762,7 +163061,8 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} options ); copyPortableProvenance(this, clone); - clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.slice(); + clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.length < vocabSparseArrayMinimumLength + ? this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content.slice() : vocabCopyPropertyArray(this.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content); if ("content" in values && values.content != null) { if (typeof values.content === "string" || values.content instanceof LanguageString) { // @ts-ignore: type is checked above. @@ -147786,10 +163086,34 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} ); } - if (Array.isArray(values.contents) && - values.contents.every(v => typeof v === "string" || v instanceof LanguageString)) { + let copied!: (string | LanguageString)[]; + let valid = false; + if (Array.isArray(values.contents)) { + const array = values.contents; + const test = (v: string | LanguageString): boolean => typeof v === "string" || v instanceof LanguageString; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.contents; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = values.contents.slice(); + clone.#_4HuuRSdSrXq8Jj2J9gcdYfoCzeuz_content = copied; } else { throw new TypeError( @@ -147798,7 +163122,8 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} ); } } - clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.slice(); + clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.length < vocabSparseArrayMinimumLength + ? this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType.slice() : vocabCopyPropertyArray(this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType); if ("mediaType" in values && values.mediaType != null) { if (typeof values.mediaType === "string") { // @ts-ignore: type is checked above. @@ -147814,7 +163139,80 @@ contents?: ((string | LanguageString))[];mediaType?: string | null;} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + deepClone(values: +{ +id?: URL | null; +content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];mediaType?: string | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Source { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } +static { +deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as Source; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as Source; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); +} }); } + /** The source content. */ get content(): (string | LanguageString | null) { @@ -148418,8 +163816,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link TentativeAccept.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -148461,26 +163859,102 @@ targets?: (Object | URL)[];result?: Object | URL | null; results?: (Object | URL)[];origin?: Object | URL | null; origins?: (Object | URL)[];instrument?: Object | URL | null; instruments?: (Object | URL)[];} - - = {}, - options: { - documentLoader?: DocumentLoader, - contextLoader?: DocumentLoader, - verifyPortableObject?: PortableObjectVerifier, - } = {} - ): TentativeAccept { - if (this._warning != null) { - getLogger(this._warning.category).warn( - this._warning.message, - this._warning.values - ); - // @ts-ignore: $warning is not recognized as a property, but it is. - options = { ...options, $warning: this._warning }; - } - const clone = super.clone(values, options) as unknown as TentativeAccept; - return clone; + + = {}, + options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {} + ): TentativeAccept { + if (this._warning != null) { + getLogger(this._warning.category).warn( + this._warning.message, + this._warning.values + ); + // @ts-ignore: $warning is not recognized as a property, but it is. + options = { ...options, $warning: this._warning }; + } + const clone = super.clone(values, options) as unknown as TentativeAccept; + return clone; + } + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): TentativeAccept { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); } - + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -148858,8 +164332,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link TentativeReject.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -148920,7 +164394,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as TentativeReject; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): TentativeReject { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -149307,10 +164857,34 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;} ); } - if (Array.isArray(values.formerTypes) && - values.formerTypes.every(v => isEntityType(v))) { + let copied!: ($EntityType)[]; + let valid = false; + if (Array.isArray(values.formerTypes)) { + const array = values.formerTypes; + const test = (v: $EntityType): boolean => isEntityType(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.formerTypes; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType = values.formerTypes.slice(); + this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType = copied; } else { throw new TypeError( @@ -149345,8 +164919,8 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Tombstone.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -149399,7 +164973,8 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;} // @ts-ignore: $warning is not recognized as a property, but it is. options = { ...options, $warning: this._warning }; } - const clone = super.clone(values, options) as unknown as Tombstone;clone.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType = this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType.slice(); + const clone = super.clone(values, options) as unknown as Tombstone;clone.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType = this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType.length < vocabSparseArrayMinimumLength + ? this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType.slice() : vocabCopyPropertyArray(this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType); if ("formerType" in values && values.formerType != null) { if (isEntityType(values.formerType)) { // @ts-ignore: type is checked above. @@ -149423,10 +164998,34 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;} ); } - if (Array.isArray(values.formerTypes) && - values.formerTypes.every(v => isEntityType(v))) { + let copied!: ($EntityType)[]; + let valid = false; + if (Array.isArray(values.formerTypes)) { + const array = values.formerTypes; + const test = (v: $EntityType): boolean => isEntityType(v); + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.formerTypes; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + // @ts-ignore: type is checked above. - clone.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType = values.formerTypes.slice(); + clone.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType = copied; } else { throw new TypeError( @@ -149435,7 +165034,8 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;} ); } } - clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted.slice(); + clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted.length < vocabSparseArrayMinimumLength + ? this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted.slice() : vocabCopyPropertyArray(this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted); if ("deleted" in values && values.deleted != null) { if (isTemporalInstant(values.deleted)) { // @ts-ignore: type is checked above. @@ -149451,7 +165051,78 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;} return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];formerType?: $EntityType | null; +formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Tombstone { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** On a \`Tombstone\` object, the \`formerType\` property identifies the type of * the object that was deleted. * @@ -150089,8 +165760,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Travel.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -150151,7 +165822,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Travel; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Travel { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -150534,8 +166281,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Undo.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -150596,7 +166343,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Undo; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Undo { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -150977,8 +166800,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Update.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -151039,7 +166862,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as Update; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Update { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -151409,8 +167308,8 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link Video.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -151465,7 +167364,77 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu const clone = super.clone(values, options) as unknown as Video; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];width?: number | null;height?: number | null;digestMultibase?: string | null;} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): Video { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. @@ -151861,8 +167830,8 @@ instruments?: (Object | URL)[];} * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link View.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -151923,7 +167892,83 @@ instruments?: (Object | URL)[];} const clone = super.clone(values, options) as unknown as View; return clone; } - + + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + override deepClone(values: +{ +id?: URL | null; +attachments?: (Object | Link | PropertyValue | URL)[];attribution?: Application | Group | Organization | Person | Service | URL | null; +attributions?: (Application | Group | Organization | Person | Service | URL)[];audience?: Object | URL | null; +audiences?: (Object | URL)[];content?: string | LanguageString | null; +contents?: ((string | LanguageString))[];contexts?: (Object | Link | URL)[];name?: string | LanguageString | null; +names?: ((string | LanguageString))[];endTime?: Temporal.Instant | null;generators?: (Object | Link | URL)[];icon?: Image | URL | null; +icons?: (Image | URL)[];image?: Image | URL | null; +images?: (Image | URL)[];replyTarget?: Object | Link | URL | null; +replyTargets?: (Object | Link | URL)[];location?: Object | Link | URL | null; +locations?: (Object | Link | URL)[];preview?: Link | Object | URL | null; +previews?: (Link | Object | URL)[];published?: Temporal.Instant | null;replies?: Collection | URL | null;shares?: Collection | URL | null;likes?: Collection | URL | null;emojiReactions?: Collection | URL | null;startTime?: Temporal.Instant | null;summary?: string | LanguageString | null; +summaries?: ((string | LanguageString))[];tags?: (Object | Link | URL)[];updated?: Temporal.Instant | null;url?: URL | Link | null; +urls?: ((URL | Link))[];to?: Object | URL | null; +tos?: (Object | URL)[];bto?: Object | URL | null; +btos?: (Object | URL)[];cc?: Object | URL | null; +ccs?: (Object | URL)[];bcc?: Object | URL | null; +bccs?: (Object | URL)[];mediaType?: string | null;duration?: Temporal.Duration | null;sensitive?: boolean | null;source?: Source | null;proof?: DataIntegrityProof | URL | null; +proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | null;approvedBy?: URL | null;likeAuthorization?: LikeAuthorization | URL | null;replyAuthorization?: ReplyAuthorization | URL | null;announceAuthorization?: AnnounceAuthorization | URL | null;translations?: (Translation)[];licenses?: (URL)[];actor?: Application | Group | Organization | Person | Service | URL | null; +actors?: (Application | Group | Organization | Person | Service | URL)[];object?: Object | URL | null; +objects?: (Object | URL)[];target?: Object | URL | null; +targets?: (Object | URL)[];result?: Object | URL | null; +results?: (Object | URL)[];origin?: Object | URL | null; +origins?: (Object | URL)[];instrument?: Object | URL | null; +instruments?: (Object | URL)[];} += {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): View { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + } + /** * Converts this object to a JSON-LD structure. * @param options The options to use. diff --git a/packages/vocab-tools/src/class.ts b/packages/vocab-tools/src/class.ts index b363ebf89..ef1d497ad 100644 --- a/packages/vocab-tools/src/class.ts +++ b/packages/vocab-tools/src/class.ts @@ -1,8 +1,17 @@ import { generateDecoder, generateEncoder } from "./codec.ts"; -import { generateCloner, generateConstructor } from "./constructor.ts"; +import { + generateCloner, + generateConstructor, + generateDeepCloner, +} from "./constructor.ts"; +import { + generateDeepCloneDescriptor, + generateDeepCloneHelpers, +} from "./deep-clone.ts"; import { generateFields } from "./field.ts"; import { generateInspector, generateInspectorPostClass } from "./inspector.ts"; import { generateProperties } from "./property.ts"; +import { generatePropertyArrayHelpers } from "./property-array.ts"; import { type PropertySchema, type TypeSchema, @@ -36,6 +45,7 @@ const PORTABLE_DEREFERENCE_IMPORTS = [ "parseCompatibleEf61Reference", "type PortableResponseClaim", "recordPortableReferrer", + "retargetPortableReferrer", "rejectMalformedCompatibleReference", "warnUnverifiableEmbeddedObject", ].join(",\n "); @@ -192,6 +202,12 @@ async function* generateClass( for await (const code of generateFields(typeUri, types)) yield code; for await (const code of generateConstructor(typeUri, types)) yield code; for await (const code of generateCloner(typeUri, types)) yield code; + for await (const code of generateDeepCloner(typeUri, types)) { + yield code.replace(/[ \t]+$/gm, ""); + } + for await (const code of generateDeepCloneDescriptor(typeUri, types)) { + yield code.replace(/[ \t]+$/gm, ""); + } for await (const code of generateProperties(typeUri, types, moduleVarNames)) { yield code; } @@ -330,6 +346,8 @@ function inspectIri(iri: URL): string { try { return formatIri(iri); } catch { return iri.href; } } `; + yield generatePropertyArrayHelpers(); + yield generateDeepCloneHelpers(); yield ` function isValidLanguageTag(language: string): boolean { try { diff --git a/packages/vocab-tools/src/constructor.ts b/packages/vocab-tools/src/constructor.ts index a27a2c5f4..5d14e7eaf 100644 --- a/packages/vocab-tools/src/constructor.ts +++ b/packages/vocab-tools/src/constructor.ts @@ -69,6 +69,40 @@ async function* generateParametersType( if (parentheses) yield "}\n"; } +function generateValidatedArrayCopy( + name: string, + typeNames: string, + typeGuards: string, +): string { + return ` + let copied!: (${typeNames})[]; + let valid = false; + if (Array.isArray(values.${name})) { + const array = values.${name}; + const test = (v: ${typeNames}): boolean => ${typeGuards}; + let checked: VocabArrayValidation | undefined; + if (array.length < vocabSparseArrayMinimumLength + ? array.every(test) + : (checked = vocabValidatePropertyArray(array, test)).valid) { + const input = values.${name}; + if (input.length < vocabSparseArrayMinimumLength && !checked?.sparse) { + copied = input.slice(); + valid = true; + } else { + const result = vocabCopyValidatedPropertyArray( + input, test, checked ?? { valid: true, sparse: false }, + ); + if (result.ok) { + copied = result.array; + valid = true; + } + } + } + } + if (valid) { + `.trimEnd() + "\n"; +} + export async function* generateConstructor( typeUri: string, types: Record, @@ -175,17 +209,18 @@ export async function* generateConstructor( } `; } + yield generateValidatedArrayCopy( + property.pluralName, + typeNames, + typeGuards, + ); yield ` - if (Array.isArray(values.${property.pluralName}) && - values.${property.pluralName}.every(v => ${typeGuards})) { // @ts-ignore: type is checked above. - this.${fieldName} = values.${property.pluralName}.slice(); + this.${fieldName} = copied; `; if (!allScalarTypes) { yield ` - for (let i = 0; i < values.${property.pluralName}.length; i++) { - this.${trustFieldName}.add(i); - } + vocabSetTrustPrefix(this.${trustFieldName}, this.${fieldName}.length); `; } yield ` @@ -219,8 +254,8 @@ export async function* generateCloner( * object. Hydrating a top-level property of the clone does not update this * instance's property. * - * To resolve properties without sharing nested objects, serialize and - * re-parse the instance before hydration rather than using this method. + * To resolve properties without sharing nested objects, use + * {@link ${type.name}.deepClone} before hydration. * See the [vocabulary manual](https://fedify.dev/manual/vocab#immutability) * for details, including how cached JSON-LD affects serialization. * @@ -272,9 +307,12 @@ export async function* generateCloner( const fieldName = await getFieldName(property.uri); const trustFieldName = await getFieldName(property.uri, "#_trust"); const allScalarTypes = areAllScalarTypes(property.range, types); - yield `clone.${fieldName} = this.${fieldName}.slice();`; + yield `clone.${fieldName} = this.${fieldName}.length < vocabSparseArrayMinimumLength + ? this.${fieldName}.slice() : vocabCopyPropertyArray(this.${fieldName});`; if (!allScalarTypes) { - yield `clone.${trustFieldName} = new Set(this.${trustFieldName});`; + yield `clone.${trustFieldName} = vocabCopyTrustSet( + this.${trustFieldName}, clone.${trustFieldName}, + );`; } if (hasSingularAccessor(property)) { let typeGuards = getTypeGuards( @@ -297,7 +335,8 @@ export async function* generateCloner( clone.${fieldName} = [values.${property.singularName}]; `; if (!allScalarTypes) { - yield `clone.${trustFieldName} = new Set([0]);`; + yield `clone.${trustFieldName} = new Set(); + clone.${trustFieldName}[vocabTrustPrefix] = 1;`; } yield ` } else { @@ -332,18 +371,19 @@ export async function* generateCloner( } `; } + yield generateValidatedArrayCopy( + property.pluralName, + typeNames, + typeGuards, + ); yield ` - if (Array.isArray(values.${property.pluralName}) && - values.${property.pluralName}.every(v => ${typeGuards})) { // @ts-ignore: type is checked above. - clone.${fieldName} = values.${property.pluralName}.slice(); + clone.${fieldName} = copied; `; if (!allScalarTypes) { yield ` clone.${trustFieldName} = new Set(); - for (let i = 0; i < values.${property.pluralName}.length; i++) { - clone.${trustFieldName}.add(i); - } + vocabSetTrustPrefix(clone.${trustFieldName}, clone.${fieldName}.length); `; } yield ` @@ -360,5 +400,65 @@ export async function* generateCloner( yield ` return clone; } + `.trimEnd() + "\n"; +} + +export async function* generateDeepCloner( + typeUri: string, + types: Record, +): AsyncIterable { + const type = types[typeUri]; + yield ` + /** + * Copies this instance and its nested vocabulary objects, optionally + * replacing property values. Replacement values are copied too. + * + * Property arrays, URLs and byte arrays are independent of the source. + * Repeated references remain shared within the copy. References to this + * source in replacement values receive a separate copy of its pre-update + * values, rather than referring back to the updated root. + * Other scalar values, including opaque cryptographic keys, are shared. + * + * Each copied object retains its own default loaders, tracer, verifier + * and base URL. Options override defaults only on the root instance. + * This method does not fetch or serialize objects. Cached JSON-LD and + * retained signed representations are not copied; unknown JSON-LD + * properties and original formatting are not preserved. Sign the copy + * again if it needs a valid proof. + * + * Trust and portable provenance follow clone() rules at every level. + * Historical referrers within the graph are copied without replacements; + * referrers outside the graph still point at the original external objects. + * Custom clone() overrides must return fresh, compatible instances and + * remain responsible for their own constructor and cloning side effects. + * Large sparse property arrays with ordinary data entries are copied using + * a snapshot of their length and present indices. Entries added after a + * snapshot are not visited; deleted entries are skipped, and values changed + * after the snapshot are read when reached. Custom + * clone() overrides must avoid structurally changing a field being copied + * if they need all its nested objects to be independent of the source. + * + * @param values The values to replace before copying the graph. + * @param options Root loader and verifier overrides. Undefined options + * retain the corresponding defaults. + * @returns An independent copy of the stored vocabulary graph. + * @since 2.5.0 + */ + ${emitOverride(typeUri, types)} deepClone(values: `; + for await (const code of generateParametersType(typeUri, types)) yield code; + yield `= {}, options: { + documentLoader?: DocumentLoader, + contextLoader?: DocumentLoader, + verifyPortableObject?: PortableObjectVerifier, + } = {}): ${type.name} { + const cloneOptions = { + documentLoader: options.documentLoader ?? this._documentLoader, + contextLoader: options.contextLoader ?? this._contextLoader, + verifyPortableObject: options.verifyPortableObject ?? this._verifyPortableObject, + tracerProvider: this._tracerProvider, + baseUrl: this._baseUrl, + }; + return deepCloneGraph(this, this.clone(values, cloneOptions)); + }\n`; } diff --git a/packages/vocab-tools/src/deep-clone.ts b/packages/vocab-tools/src/deep-clone.ts new file mode 100644 index 000000000..508aae063 --- /dev/null +++ b/packages/vocab-tools/src/deep-clone.ts @@ -0,0 +1,175 @@ +import { getFieldName } from "./field.ts"; +import type { PropertySchema, TypeSchema } from "./schema.ts"; +import { getTypeName } from "./type.ts"; + +function needsCopy( + property: PropertySchema, + types: Record, +): boolean { + return property.range.some((uri) => + uri in types || ["URL", "Uint8Array"].includes(getTypeName(uri, types)) + ); +} + +/** Emits module-private graph-copy support, shared by all generated classes. */ +export function generateDeepCloneHelpers(): string { + return ` +interface DeepCloneContext { + value(value: T): T; +} + +interface DeepCloneDescriptor { + create(source: object): object; + copy(destination: object, context: DeepCloneContext): void; +} + +const deepCloneDescriptors = new Map(); + +function getDeepCloneDescriptor(value: object): DeepCloneDescriptor | undefined { + let prototype: object | null = globalThis.Object.getPrototypeOf(value); + while (prototype != null) { + const descriptor = deepCloneDescriptors.get(prototype); + if (descriptor != null) return descriptor; + prototype = globalThis.Object.getPrototypeOf(prototype); + } + return undefined; +} + +function deepCloneGraph(source: object, root: T): T { + const memo = new Map(); + const destinations = new Set(); + const shells: object[] = []; + let next = 0; + + function enqueue(original: object, destination: object): void { + if (destination == null || typeof destination !== "object" || + original === destination || destinations.has(destination) || + !globalThis.Object.prototype.isPrototypeOf.call( + globalThis.Object.getPrototypeOf(original), destination + ) || getDeepCloneDescriptor(destination) == null) { + throw new TypeError("clone() must return a fresh, compatible instance."); + } + destinations.add(destination); + shells.push(destination); + } + + const context: DeepCloneContext = { + value(value: V): V { + if (value == null || typeof value !== "object") return value; + const existing = memo.get(value); + if (existing != null) return existing as V; + if (value instanceof URL) { + const copy = new URL(value.href); + memo.set(value, copy); + return copy as V; + } + if (value instanceof Uint8Array) { + const copy = new Uint8Array(value); + memo.set(value, copy); + return copy as V; + } + const descriptor = getDeepCloneDescriptor(value); + // Other supported scalars (Temporal, LanguageString, Intl.Locale, + // CryptoKey and class constructors) are shared as immutable values. + if (descriptor == null) return value; + const copy = descriptor.create(value); + enqueue(value, copy); + memo.set(value, copy); + return copy as V; + }, + }; + + function drain(): void { + while (next < shells.length) { + const shell = shells[next++]; + getDeepCloneDescriptor(shell)!.copy(shell, context); + } + } + + // The effective root includes replacements. References to the source root + // instead receive a separate copy of its pre-update values. + enqueue(source, root); + drain(); + + // Discover historical root ancestry without substituting replacement values + // into it. The resolver deliberately returns undefined in this first pass. + const count = shells.length; + for (let i = 0; i < count; i++) { + retargetPortableReferrer(shells[i], (original) => { + if (original === source) context.value(source); + return undefined; + }); + } + drain(); + for (const shell of shells) { + retargetPortableReferrer(shell, (original) => memo.get(original)); + } + return root; +} +`; +} + +/** Emits private-field copiers inside static blocks, keeping them out of d.ts. */ +export async function* generateDeepCloneDescriptor( + typeUri: string, + types: Record, +): AsyncIterable { + const type = types[typeUri]; + const properties = type.properties.filter((p) => needsCopy(p, types)); + if (type.extends != null && properties.length < 1) return; + yield `static {\n`; + if (type.extends == null) { + yield `deepCloneDescriptors.set(this.prototype, { + create(value: object): object { + const source = value as ${type.name}; + const options = { + documentLoader: source.#documentLoader, + contextLoader: source.#contextLoader, + tracerProvider: source.#tracerProvider, + verifyPortableObject: source.#verifyPortableObject, + baseUrl: source.#_baseUrl, + }; + return source.clone({}, options); + }, + copy(value: object, context: DeepCloneContext): void { + const node = value as ${type.name}; + const identified = node as { id: URL | null }; + identified.id = context.value(identified.id); + `; + } else { + yield `const base = getDeepCloneDescriptor(this.prototype)!; + deepCloneDescriptors.set(this.prototype, { + create: base.create, + copy(value: object, context: DeepCloneContext): void { + base.copy(value, context); + const node = value as ${type.name}; + `; + } + for (const property of properties) { + const field = await getFieldName(property.uri); + yield ` + { + const array = node.${field}; + const snapshot = array.length < vocabSparseArrayMinimumLength + ? undefined : vocabSparseArraySnapshot(array); + if (snapshot != null) { + for (const i of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, i)) continue; + const value = array[i]; + if (value != null && typeof value === "object") { + array[i] = context.value(value); + } + } + } else { + for (let i = 0; i < node.${field}.length; i++) { + const value = node.${field}[i]; + if (value != null && typeof value === "object") { + node.${field}[i] = context.value(value); + } + } + } + } + `; + } + yield `} }); }\n`; +} diff --git a/packages/vocab-tools/src/field.ts b/packages/vocab-tools/src/field.ts index 3bacdb3c2..27d78a2cc 100644 --- a/packages/vocab-tools/src/field.ts +++ b/packages/vocab-tools/src/field.ts @@ -30,7 +30,7 @@ export async function generateField( const trustFieldName = await getFieldName(property.uri, `${prefix}_trust`); return ` ${fieldName}: (${typeNames} | URL)[] = []; - ${trustFieldName}: Set = new Set(); + ${trustFieldName}: VocabTrustSet = new Set(); `; } } diff --git a/packages/vocab-tools/src/property-array.ts b/packages/vocab-tools/src/property-array.ts new file mode 100644 index 000000000..6794339b6 --- /dev/null +++ b/packages/vocab-tools/src/property-array.ts @@ -0,0 +1,198 @@ +/** Emits module-private sparse property-array validation and copying helpers. */ +export function generatePropertyArrayHelpers(): string { + return ` +interface VocabSparseArraySnapshot { + length: number; + indices: number[]; +} + +interface VocabArrayValidation { + valid: boolean; + sparse: boolean; +} + +type VocabArrayCopy = { ok: true; array: T[] } | { ok: false }; + +// Most fields have no trusted prefix. Keep that metadata on the existing Set +// so empty fields need neither another object nor another instance slot. +const vocabTrustPrefix: unique symbol = Symbol("vocabulary trust prefix"); +type VocabTrustSet = Set & { [vocabTrustPrefix]?: number }; + +function vocabSetTrustPrefix(trust: VocabTrustSet, prefix: number): void { + if (prefix > 0) trust[vocabTrustPrefix] = prefix; +} + +function vocabCopyTrustSet( + trust: VocabTrustSet, + destination: VocabTrustSet, +): VocabTrustSet { + // clone() already constructed the destination. Reuse its empty Set only + // when constructor defaults cannot contribute trust to the copied field. + const copy: VocabTrustSet = trust !== destination && trust.size === 0 && + destination.size === 0 && destination[vocabTrustPrefix] == null + ? destination : new Set(trust); + const prefix = trust[vocabTrustPrefix]; + if (prefix != null && prefix > 0) copy[vocabTrustPrefix] = prefix; + return copy; +} + +// These thresholds select an optimization, not a limit on property arrays. +const vocabSparseArrayMinimumLength = 4096; +const vocabSparseArrayProbeCount = 8; +const vocabSparseArrayPresentProbeLimit = 4; +const vocabArrayPrototype = Array.prototype; +const vocabObjectPrototype = globalThis.Object.prototype; +const vocabArrayDescriptors = ["constructor", "every", "slice"].map( + key => globalThis.Object.getOwnPropertyDescriptor(vocabArrayPrototype, key), +); +const vocabArraySpeciesDescriptor = globalThis.Object.getOwnPropertyDescriptor( + Array, Symbol.species, +); + +function vocabSameArrayDescriptor( + actual: PropertyDescriptor | undefined, + expected: PropertyDescriptor | undefined, +): boolean { + return actual?.value === expected?.value && actual?.get === expected?.get && + actual?.set === expected?.set && actual?.writable === expected?.writable && + actual?.enumerable === expected?.enumerable && + actual?.configurable === expected?.configurable; +} + +function vocabArrayIndex(key: string): number | undefined { + const index = Number(key); + return Number.isInteger(index) && index >= 0 && index < 0xffffffff && + String(index) === key + ? index + : undefined; +} + +function vocabSparseArraySnapshot( + array: unknown[], +): VocabSparseArraySnapshot | undefined { + if (!Array.isArray(array)) return undefined; + const length = array.length; + // Small dense fields take no prototype or key-enumeration overhead. + if (length < vocabSparseArrayMinimumLength) return undefined; + if (!Number.isInteger(length) || length > 0xffffffff || + globalThis.Object.getPrototypeOf(array) !== vocabArrayPrototype || + globalThis.Object.getPrototypeOf(vocabArrayPrototype) !== + vocabObjectPrototype || + globalThis.Object.getPrototypeOf(vocabObjectPrototype) !== null) { + return undefined; + } + const methods = ["constructor", "every", "slice"]; + for (let i = 0; i < methods.length; i++) { + const key = methods[i]; + if (globalThis.Object.hasOwn(array, key) || + !vocabSameArrayDescriptor( + globalThis.Object.getOwnPropertyDescriptor(vocabArrayPrototype, key), + vocabArrayDescriptors[i], + )) return undefined; + } + if (!vocabSameArrayDescriptor( + globalThis.Object.getOwnPropertyDescriptor(Array, Symbol.species), + vocabArraySpeciesDescriptor, + )) return undefined; + + // Descriptor probes do not invoke element getters. Plainly dense arrays + // keep native iteration without enumerating all their keys. + let present = 0; + for (let i = 0; i < vocabSparseArrayProbeCount; i++) { + const index = Math.floor(i * (length - 1) / (vocabSparseArrayProbeCount - 1)); + if (globalThis.Object.getOwnPropertyDescriptor(array, index) != null && + ++present >= vocabSparseArrayPresentProbeLimit) return undefined; + } + for (const prototype of [vocabArrayPrototype, vocabObjectPrototype]) { + for (const key of globalThis.Object.getOwnPropertyNames(prototype)) { + if (vocabArrayIndex(key) != null) return undefined; + } + } + const indices: number[] = []; + for (const key of globalThis.Object.getOwnPropertyNames(array)) { + const index = vocabArrayIndex(key); + if (index != null && index < length) indices.push(index); + } + if (indices.length >= length / 2) return undefined; + for (const index of indices) { + const descriptor = globalThis.Object.getOwnPropertyDescriptor(array, index); + if (descriptor == null || !("value" in descriptor)) return undefined; + } + // Ordinary array keys already have canonical index order. This guard is + // not a Proxy detector; reflection traps and errors remain observable. + return { length, indices }; +} + +function vocabValidatePropertyArray( + array: T[], + test: (value: T) => boolean, +): VocabArrayValidation { + const snapshot = vocabSparseArraySnapshot(array); + if (snapshot == null) return { valid: array.every(test), sparse: false }; + for (const index of snapshot.indices) { + if (globalThis.Object.hasOwn(array, index) && !test(array[index])) { + return { valid: false, sparse: true }; + } + } + return { valid: true, sparse: true }; +} + +function vocabDefineArrayEntry(array: T[], index: number, value: T): void { + globalThis.Object.defineProperty(array, index, { + value, writable: true, enumerable: true, configurable: true, + }); +} + +function vocabCopySparsePropertyArray( + array: T[], + snapshot: VocabSparseArraySnapshot, + test?: (value: T) => boolean, +): VocabArrayCopy { + const copy: T[] = []; + // Seed dictionary storage before low indices or the final length can + // allocate storage for every hole. The temporary entry stays private. + if (snapshot.indices[snapshot.indices.length - 1] !== snapshot.length - 1) { + globalThis.Object.defineProperty(copy, snapshot.length - 1, { + value: undefined, writable: true, enumerable: true, configurable: true, + }); + delete copy[snapshot.length - 1]; + } + for (const index of snapshot.indices) { + if (!globalThis.Object.hasOwn(array, index)) continue; + const value = array[index]; + if (test != null && !test(value)) return { ok: false }; + vocabDefineArrayEntry(copy, index, value); + } + // A validation callback may have deleted the last snapshot entry. + if (copy.length < snapshot.length) { + globalThis.Object.defineProperty(copy, snapshot.length - 1, { + value: undefined, writable: true, enumerable: true, configurable: true, + }); + delete copy[snapshot.length - 1]; + } + copy.length = snapshot.length; + return { ok: true, array: copy }; +} + +function vocabCopyPropertyArray(array: T[]): T[] { + const snapshot = vocabSparseArraySnapshot(array); + if (snapshot == null) return array.slice(); + const copied = vocabCopySparsePropertyArray(array, snapshot); + // Without a predicate the private copy cannot fail validation. + return (copied as { ok: true; array: T[] }).array; +} + +function vocabCopyValidatedPropertyArray( + array: T[], + test: (value: T) => boolean, + previous: VocabArrayValidation, +): VocabArrayCopy { + const snapshot = vocabSparseArraySnapshot(array); + if (snapshot != null) return vocabCopySparsePropertyArray(array, snapshot, test); + // Sparse validation may have changed the next input's density, descriptors + // or prototype. Validate that native-copy input before falling back. + if (previous.sparse && !array.every(test)) return { ok: false }; + return { ok: true, array: array.slice() }; +} +`; +} diff --git a/packages/vocab-tools/src/property.ts b/packages/vocab-tools/src/property.ts index d7adbb9da..4d2a9e7b7 100644 --- a/packages/vocab-tools/src/property.ts +++ b/packages/vocab-tools/src/property.ts @@ -442,7 +442,11 @@ async function* generateProperty( } let v = this.${await getFieldName(property.uri)}[0]; if (!(v instanceof URL) && - !this.${await getFieldName(property.uri, "#_trust")}.has(0)) { + !(0 < (this.${await getFieldName( + property.uri, + "#_trust", + )}[vocabTrustPrefix] ?? 0) || + this.${await getFieldName(property.uri, "#_trust")}.has(0))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, ${ @@ -514,7 +518,11 @@ async function* generateProperty( mustDereferencePortableObject( this, ${trustOwner}, v.id, options, )) && - !this.${await getFieldName(property.uri, "#_trust")}.has(0)) { + !(0 < (this.${await getFieldName( + property.uri, + "#_trust", + )}[vocabTrustPrefix] ?? 0) || + this.${await getFieldName(property.uri, "#_trust")}.has(0))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + @@ -611,7 +619,11 @@ async function* generateProperty( for (let i = 0; i < vs.length; i++) { let v = vs[i]; if (!(v instanceof URL) && - !this.${await getFieldName(property.uri, "#_trust")}.has(i)) { + !(i < (this.${await getFieldName( + property.uri, + "#_trust", + )}[vocabTrustPrefix] ?? 0) || + this.${await getFieldName(property.uri, "#_trust")}.has(i))) { if (v.id == null) { if (isUnsecuredPortableObject(this)) { warnUnverifiableEmbeddedObject(this, ${ @@ -689,7 +701,11 @@ async function* generateProperty( mustDereferencePortableObject( this, ${trustOwner}, v.id, options, )) && - !this.${await getFieldName(property.uri, "#_trust")}.has(i)) { + !(i < (this.${await getFieldName( + property.uri, + "#_trust", + )}[vocabTrustPrefix] ?? 0) || + this.${await getFieldName(property.uri, "#_trust")}.has(i))) { if (options.crossOrigin === "throw") { throw new Error( "The property object's @id (" + v.id.href + ") has a different " + diff --git a/packages/vocab/src/deep-clone.test.ts b/packages/vocab/src/deep-clone.test.ts new file mode 100644 index 000000000..9f07f97bd --- /dev/null +++ b/packages/vocab/src/deep-clone.test.ts @@ -0,0 +1,347 @@ +import { + createTestTracerProvider, + mockDocumentLoader, + test, +} from "@fedify/fixture"; +import { type DocumentLoader, LanguageString } from "@fedify/vocab-runtime"; +import { + deepStrictEqual, + notStrictEqual, + ok, + strictEqual, + throws, +} from "node:assert/strict"; +import { Buffer } from "node:buffer"; +import { + Accept, + Create, + DataIntegrityProof, + Endpoints, + Link, + Note, + Object as VocabularyObject, + Person, + QuoteRequest, + Reject, + Source, +} from "./vocab.ts"; + +const options = { contextLoader: mockDocumentLoader }; + +function personLoader(name: string, fetched: string[] = []): DocumentLoader { + // deno-lint-ignore require-await + return async (url) => { + fetched.push(url); + return { + contextUrl: null, + documentUrl: url, + document: { + "@context": "https://www.w3.org/ns/activitystreams", + id: url, + type: "Person", + name, + }, + }; + }; +} + +for (const hydrateOriginal of [false, true]) { + test(`deepClone() isolates embedded quote hydration (${hydrateOriginal})`, async () => { + const original = await QuoteRequest.fromJsonLd({ + "@context": ["https://www.w3.org/ns/activitystreams", { + QuoteRequest: "https://w3id.org/fep/044f#QuoteRequest", + }], + id: "https://a.example/requests/1", + type: "QuoteRequest", + instrument: { + id: "https://a.example/notes/1", + type: "Note", + attributedTo: "https://a.example/alice", + content: "Quoted", + }, + }, { ...options, documentLoader: personLoader("Alice") }); + const copy = original.deepClone(); + const sourceNote = await original.getInstrument(); + const copyNote = await copy.getInstrument(); + ok(sourceNote instanceof Note && copyNote instanceof Note); + notStrictEqual(copyNote, sourceNote); + const hydrated = hydrateOriginal ? sourceNote : copyNote; + strictEqual((await hydrated.getAttribution())?.name, "Alice"); + for (const Wrapper of [Accept, Reject]) { + const json = await new Wrapper({ + object: hydrateOriginal ? copy : original, + }).toJsonLd(options) as { + object: { instrument: { attributedTo: unknown } }; + }; + strictEqual( + json.object.instrument.attributedTo, + "https://a.example/alice", + ); + } + strictEqual(await original.getInstrument(), sourceNote); + strictEqual(await copy.getInstrument(), copyNote); + }); +} + +test("deepClone() copies replacements and preserves graph aliases", async () => { + const id = new URL("https://example.com/notes/1"); + const child = new Note({ id, url: id, content: "Child" }); + const source = new Create({ object: child, attachments: [child] }); + const copy = source.deepClone({ objects: [child, child] }); + const objects = await Array.fromAsync(copy.getObjects()); + const attachment = (await Array.fromAsync(copy.getAttachments()))[0]; + strictEqual(objects[0], objects[1]); + strictEqual(objects[0], attachment); + notStrictEqual(objects[0], child); + strictEqual(objects[0].id, objects[0].url); + notStrictEqual(objects[0].id, id); + objects[0].id!.pathname = "/changed"; + strictEqual(id.pathname, "/notes/1"); + strictEqual(await source.getObject(), child); + + const backReference = source.deepClone({ object: source }); + const snapshot = await backReference.getObject(); + ok(snapshot instanceof Create); + notStrictEqual(snapshot, source); + notStrictEqual(snapshot, backReference); + ok(await snapshot.getObject() instanceof Note); + await backReference.toJsonLd(options); +}); + +test("deepClone() copies non-entity vocabulary objects and standalone roots", () => { + const endpoint = new URL("https://example.com/inbox"); + const endpoints = new Endpoints({ sharedInbox: endpoint }); + const source = new Source({ content: "Markdown" }); + const person = new Person({ endpoints, source }); + const copy = person.deepClone(); + notStrictEqual(copy.endpoints, endpoints); + notStrictEqual(copy.source, source); + notStrictEqual(copy.endpoints!.sharedInbox, endpoint); + copy.endpoints!.sharedInbox!.pathname = "/copied"; + strictEqual(endpoint.pathname, "/inbox"); + const link = new Link({ href: endpoint }).deepClone(); + notStrictEqual(link.href, endpoint); + strictEqual(link.href!.href, endpoint.href); +}); + +test("deepClone() copies byte arrays including Buffer storage", async () => { + for (const bytes of [new Uint8Array([1, 2, 3]), Buffer.from([1, 2, 3])]) { + const proof = new DataIntegrityProof({ proofValue: bytes }); + const original = new Note({ proof }); + const copy = original.deepClone(); + const copiedProof = await copy.getProof(); + ok(copiedProof instanceof DataIntegrityProof); + notStrictEqual(copiedProof, proof); + notStrictEqual(copiedProof.proofValue, bytes); + copiedProof.proofValue![0] = 9; + strictEqual(bytes[0], 1); + bytes[1] = 8; + strictEqual(copiedProof.proofValue![1], 2); + } +}); + +test("deepClone() shares immutable scalars and preserves sparse arrays", () => { + const content = new LanguageString("Hello", "en"); + const published = Temporal.Instant.from("2026-10-27T00:00:00Z"); + const names = new Array(3); + names[2] = "Kept"; + const source = new Note({ names, content, published }); + const copy = source.deepClone(); + strictEqual(copy.content, content); + strictEqual(copy.published, published); + deepStrictEqual(copy.names, source.names); + strictEqual(0 in copy.names, false); + copy.names.push("Copy only"); + strictEqual(source.names.length, 3); +}); + +test("deepClone() retains node defaults and overrides only the root", async () => { + const fetched: string[] = []; + const [rootTracer, rootSpans] = createTestTracerProvider(); + const [childTracer, childSpans] = createTestTracerProvider(); + const child = new Note({ + attribution: new URL("https://example.com/child-actor"), + }, { + ...options, + documentLoader: personLoader("Child", fetched), + tracerProvider: childTracer, + }); + const source = new Create({ + actor: new URL("https://example.com/root-actor"), + object: child, + }, { + ...options, + documentLoader: personLoader("Root", fetched), + tracerProvider: rootTracer, + }); + const copy = source.deepClone({}, { + documentLoader: personLoader("Override"), + }); + strictEqual((await copy.getActor())?.name, "Override"); + const copiedChild = await copy.getObject(); + ok(copiedChild instanceof Note); + strictEqual((await copiedChild.getAttribution())?.name, "Child"); + strictEqual((await source.getActor())?.name, "Root"); + deepStrictEqual(fetched, [ + "https://example.com/child-actor", + "https://example.com/root-actor", + ]); + strictEqual(rootSpans.getSpans("activitypub.lookup_object").length, 2); + strictEqual(childSpans.getSpans("activitypub.lookup_object").length, 1); +}); + +test("deepClone() preserves origin checks and isolates hydrated trust", async () => { + let fetches = 0; + const original = await Create.fromJsonLd({ + "@context": "https://www.w3.org/ns/activitystreams", + id: "https://a.example/create", + type: "Create", + object: { + id: "https://b.example/note", + type: "Note", + content: "Embedded", + }, + }, { + ...options, + // deno-lint-ignore require-await + documentLoader: async (url) => { + fetches++; + return { + contextUrl: null, + documentUrl: url, + document: { + "@context": "https://www.w3.org/ns/activitystreams", + id: url, + type: "Note", + content: "Fetched", + }, + }; + }, + }); + const copy = original.deepClone(); + strictEqual((await copy.getObject())?.content, "Fetched"); + strictEqual(fetches, 1); + strictEqual( + (await original.getObject({ crossOrigin: "trust" }))?.content, + "Embedded", + ); + strictEqual((await original.getObject())?.content, "Fetched"); + strictEqual(fetches, 2); +}); + +test("deepClone() keeps base URLs and discards cached JSON-LD", async () => { + const source = await Note.fromJsonLd({ + "@context": ["https://www.w3.org/ns/activitystreams", { + extension: "https://example.com/extension", + }], + type: "Note", + id: "./note", + attributedTo: "./alice", + extension: "received only", + }, { + ...options, + baseUrl: new URL("https://example.com/posts/"), + documentLoader: personLoader("Alice"), + }); + const copy = source.deepClone({ content: "Copy" }); + strictEqual(copy.id!.href, "https://example.com/posts/note"); + strictEqual( + (await copy.getAttribution())?.id?.href, + "https://example.com/posts/alice", + ); + const json = await copy.toJsonLd(options) as Record; + strictEqual(json.content, "Copy"); + strictEqual(json.extension, undefined); + strictEqual( + (await source.toJsonLd() as Record).extension, + "received only", + ); +}); + +test("deepClone() validates replacements through clone() only", () => { + const source = new Note({ content: "Source" }); + for ( + const values of [ + { id: 42 }, + { name: "one", names: ["two"] }, + { names: [42] }, + ] + ) { + throws(() => source.deepClone(values as never), TypeError); + } + function values(counter: { reads: number }) { + return Object.create({ + get content() { + counter.reads++; + return "Inherited"; + }, + }) as { content: string }; + } + const shallowReads = { reads: 0 }; + const deepReads = { reads: 0 }; + strictEqual(source.clone(values(shallowReads)).content, "Inherited"); + strictEqual(source.deepClone(values(deepReads)).content, "Inherited"); + strictEqual(deepReads.reads, shallowReads.reads); +}); + +test("deepClone() preserves user subclasses and handles deep graphs", async () => { + class CustomNote extends Note {} + const child = new CustomNote({ content: "Child" }); + const copiedChild = await new Create({ object: child }).deepClone() + .getObject(); + ok(copiedChild instanceof CustomNote); + notStrictEqual(copiedChild, child); + let source = new Note({ content: "End" }); + for (let i = 0; i < 3000; i++) source = new Note({ replyTarget: source }); + let copy = source.deepClone(); + for (let i = 0; i < 3000; i++) { + const next = await copy.getReplyTarget(); + ok(next instanceof Note); + copy = next; + } + strictEqual(copy.content, "End"); +}); + +test("deepClone() rejects broken subclass clone results", () => { + class ReturnsSelf extends Note { + override clone(): this { + return this; + } + } + const source = new ReturnsSelf({ id: new URL("https://example.com/note") }); + const id = source.id; + throws(() => source.deepClone(), /fresh, compatible/); + strictEqual(source.id, id); + + class Incompatible extends Note { + override clone(): Note { + return new VocabularyObject({}) as Note; + } + } + throws(() => new Incompatible({}).deepClone(), /fresh, compatible/); + + class ReusesCopy extends Note { + static copy: Note | undefined; + override clone(): Note { + return ReusesCopy.copy ??= super.clone(); + } + } + const first = new ReusesCopy({ content: "First" }); + const second = new ReusesCopy({ content: "Second" }); + throws( + () => new Create({ objects: [first, second] }).deepClone(), + /fresh, compatible/, + ); + strictEqual(first.content, "First"); + strictEqual(second.content, "Second"); + + class Throws extends Note { + override clone(): never { + throw new Error("Copy failed"); + } + } + const child = new Throws({ content: "Unchanged" }); + const parent = new Create({ object: child }); + throws(() => parent.deepClone(), /Copy failed/); + strictEqual(child.content, "Unchanged"); +}); diff --git a/packages/vocab/src/gateway.test.ts b/packages/vocab/src/gateway.test.ts index 06e72acf4..f6d594679 100644 --- a/packages/vocab/src/gateway.test.ts +++ b/packages/vocab/src/gateway.test.ts @@ -6,6 +6,7 @@ import { import { type DocumentLoader, FetchError, + formatIri, getDocumentLoader, parseIri, type PortableObjectVerification, @@ -1062,6 +1063,81 @@ test("getFirst() passes the referrer chain and collection context", async () => ok(referrer?.referrer?.referrer?.referrer?.object === create); }); +test("deepClone() preserves historical ancestry independently of replacements", async () => { + const context = Object.freeze({}); + const documentLoader = createLoader({ + [gatewayUrl("https://gw.example", "/actor/outbox")]: portableCollection( + "/actor/outbox", + { + attributedTo: `ap://${did}/actor`, + first: { + id: `ap://${did}/actor/outbox?page=1`, + type: "OrderedCollectionPage", + // An existing mismatch must not be rewritten to match root overrides. + partOf: `ap://${did}/other/outbox`, + next: `ap://${did}/actor/outbox?page=2`, + }, + }, + ), + [gatewayUrl("https://gw.example", "/actor/outbox?page=2")]: { + "@context": "https://www.w3.org/ns/activitystreams", + id: `ap://${did}/actor/outbox?page=2`, + type: "OrderedCollectionPage", + }, + [gatewayUrl("https://gw.example", "/actor")]: { + "@context": "https://www.w3.org/ns/activitystreams", + id: `ap://${did}/actor`, + type: "Person", + name: "Fetched actor", + }, + }); + const verifier = createRecordingVerifier(() => ({ + verified: true, + collectionContext: context, + })); + const options = { + documentLoader, + contextLoader: mockDocumentLoader, + gateways: ["https://gw.example"], + verifyPortableObject: verifier, + }; + const actor = await Person.fromJsonLd({ + "@context": "https://www.w3.org/ns/activitystreams", + id: `ap://${did}/actor`, + type: "Person", + outbox: `ap://${did}/actor/outbox`, + }, { contextLoader: mockDocumentLoader }); + const outbox = await actor.getOutbox(options); + assertInstanceOf(outbox, OrderedCollection); + // Record first -> outbox provenance before copying. + const first = await outbox.getFirst(options); + assertInstanceOf(first, CollectionPage); + const copy = outbox.deepClone({ + id: parseIri(`ap://${did}/other/outbox`), + attribution: parseIri(`ap://${did}/different-actor`), + }); + const copiedFirst = await copy.getFirst(options); + assertInstanceOf(copiedFirst, CollectionPage); + ok(copiedFirst !== first); + await copiedFirst.getNext(options); + const referrer = verifier.calls.at(-1)!.options.referrer; + ok(referrer?.object === copiedFirst); + const history = referrer.referrer; + ok(history?.object instanceof OrderedCollection); + ok(history.object !== copy && history.object !== outbox); + deepStrictEqual(history.id, outbox.id); + deepStrictEqual(history.acceptance, undefined); + deepStrictEqual(history.collectionContext, undefined); + deepStrictEqual(history.object.attributionId, outbox.attributionId); + deepStrictEqual(copiedFirst.partOfId, first.partOfId); + ok(copiedFirst.partOfId!.href !== history.id!.href); + // External ancestry is retained, while in-graph history can hydrate safely. + ok(history.referrer?.object === actor); + await history.object.getAttribution(options); + const originalJson = await outbox.toJsonLd() as Record; + deepStrictEqual(originalJson.attributedTo, formatIri(outbox.attributionId!)); +}); + test("accessors do not trust objects embedded in unsecured collections", async () => { const itemPath = "/objects/1"; const documentLoader = createLoader({ @@ -1116,14 +1192,14 @@ test("accessors do not trust objects embedded in unsecured collections", async ( // again (and fail here, since nothing can be fetched): const outbox3 = await (await createPerson()).getOutbox(options); assertInstanceOf(outbox3, Collection); - const items3 = await Array.fromAsync( - outbox3.clone().getItems({ + for (const copy of [outbox3.clone(), outbox3.deepClone()]) { + const items3 = await Array.fromAsync(copy.getItems({ ...options, documentLoader: createLoader({}), suppressError: true, - }), - ); - deepStrictEqual(items3, []); + })); + deepStrictEqual(items3, []); + } }); function createRedirectingLoader( diff --git a/packages/vocab/src/signed-representation.test.ts b/packages/vocab/src/signed-representation.test.ts index aa8ef5af0..1ffe0f2ce 100644 --- a/packages/vocab/src/signed-representation.test.ts +++ b/packages/vocab/src/signed-representation.test.ts @@ -193,6 +193,27 @@ test("a clone does not inherit a retained signed representation", async () => { deepStrictEqual(embedded.content, "Changed"); }); +test("deepClone() drops retained signed representations at every level", async () => { + const note = retainedNote(); + const original = new Create({ object: note }); + retainSignedRepresentation(original, { + "@context": "https://www.w3.org/ns/activitystreams", + type: "Create", + content: "Retained root only", + }); + const copied = original.deepClone(); + const json = await new Create({ object: copied }).toJsonLd(options) as { + object: { content?: unknown; object: Record }; + }; + deepStrictEqual(json.object.content, undefined); + deepStrictEqual(json.object.object.content, "Hello"); + deepStrictEqual(json.object.object.proof, undefined); + const originalJson = await new Create({ object: note }).toJsonLd(options) as { + object: unknown; + }; + deepStrictEqual(originalJson.object, securedNote); +}); + test("every generated default context keeps placeholders recoverable", async () => { interface VocabClass { new (values: { id?: URL | null }): { toJsonLd(): Promise }; diff --git a/packages/vocab/src/sparse-arrays.test.ts b/packages/vocab/src/sparse-arrays.test.ts new file mode 100644 index 000000000..bbbd9a64a --- /dev/null +++ b/packages/vocab/src/sparse-arrays.test.ts @@ -0,0 +1,507 @@ +import { mockDocumentLoader, test } from "@fedify/fixture"; +import { + deepStrictEqual, + notStrictEqual, + ok, + strictEqual, + throws, +} from "node:assert/strict"; +import { Create, Note, Translation } from "./vocab.ts"; + +const sparseLength = 8192; + +test("sparse scalar copies preserve own indices and omit metadata", () => { + const names = new Array(sparseLength); + globalThis.Object.defineProperty(names, 2, { value: "hidden" }); + names[6000] = "visible"; + globalThis.Object.assign(names, { + "01": "metadata", + "-1": "metadata", + "4294967295": "metadata", + extra: "metadata", + [Symbol("metadata")]: "metadata", + }); + const before = globalThis.Object.getOwnPropertyDescriptors(names); + const source = new Note({ names }); + for (const copy of [source, source.clone(), source.deepClone()]) { + strictEqual(copy.names.length, sparseLength); + deepStrictEqual(Reflect.ownKeys(copy.names), ["2", "6000", "length"]); + deepStrictEqual(globalThis.Object.getOwnPropertyDescriptor(copy.names, 2), { + value: "hidden", + writable: true, + enumerable: true, + configurable: true, + }); + strictEqual(copy.names[6000], "visible"); + strictEqual(0 in copy.names, false); + strictEqual((sparseLength - 1) in copy.names, false); + notStrictEqual(copy.names, names); + } + deepStrictEqual(globalThis.Object.getOwnPropertyDescriptors(names), before); +}); + +test("sparse copies preserve empty and trailing-hole arrays", () => { + for (const index of [undefined, 0, sparseLength - 1]) { + const names = new Array(sparseLength); + if (index != null) names[index] = "kept"; + const source = new Note({ names }); + for (const copy of [source, source.clone(), source.deepClone()]) { + strictEqual(copy.names.length, sparseLength); + deepStrictEqual( + globalThis.Object.getOwnPropertyNames(copy.names), + index == null ? ["length"] : [String(index), "length"], + ); + } + } +}); + +test("sparse inputs distinguish holes from explicit undefined", () => { + const names = new Array(sparseLength); + new Note({ names }); + globalThis.Object.defineProperty(names, 100, { value: undefined }); + throws(() => new Note({ names }), TypeError); + throws(() => new Note({}).clone({ names }), TypeError); +}); + +test("sparse URL copies preserve aliases and isolate mutable leaves", () => { + const url = new URL("https://example.com/license"); + const licenses = new Array(sparseLength); + licenses[0] = licenses[6000] = url; + globalThis.Object.freeze(licenses); + const source = new Note({ licenses }); + const shallow = source.clone(); + const deep = source.deepClone(); + const replaced = new Note({}).deepClone({ licenses }); + for (const copy of [source, shallow, deep, replaced]) { + strictEqual(copy.licenses.length, sparseLength); + deepStrictEqual(globalThis.Object.keys(copy.licenses), ["0", "6000"]); + notStrictEqual(copy.licenses, licenses); + strictEqual(copy.licenses[0], copy.licenses[6000]); + copy.licenses[1] = new URL("https://example.com/copy-only"); + } + strictEqual(shallow.licenses[0], url); + notStrictEqual(deep.licenses[0], url); + notStrictEqual(replaced.licenses[0], url); + deep.licenses[0].pathname = "/deep-only"; + strictEqual(url.pathname, "/license"); + strictEqual(replaced.licenses[0].pathname, "/license"); + strictEqual(1 in licenses, false); +}); + +test("sparse non-entity arrays deep-copy aliases and nested URLs", () => { + const url = new URL("https://example.com/original"); + const translation = new Translation({ original: url, basis: url }); + const translations = new Array(sparseLength); + globalThis.Object.defineProperty(translations, 0, { value: translation }); + translations[6000] = translation; + const source = new Note({ translations }); + const shallow = source.clone(); + const copy = source.deepClone(); + const replacement = source.deepClone({ translations }); + strictEqual(shallow.translations[0], translation); + for (const deep of [copy, replacement]) { + strictEqual(deep.translations.length, sparseLength); + deepStrictEqual(globalThis.Object.keys(deep.translations), ["0", "6000"]); + strictEqual(deep.translations[0], deep.translations[6000]); + notStrictEqual(deep.translations[0], translation); + strictEqual(deep.translations[0].original, deep.translations[0].basis); + notStrictEqual(deep.translations[0].original, url); + } + copy.translations[0].original!.pathname = "/copy-only"; + strictEqual(url.pathname, "/original"); + strictEqual(replacement.translations[0].original!.pathname, "/original"); + copy.translations.length = 1; + strictEqual(source.translations.length, sparseLength); +}); + +test("sparse object arrays copy embedded graphs without fetching holes", async () => { + const child = new Note({ content: "child" }); + const objects = new Array(sparseLength); + objects[0] = child; + objects[6000] = child; + const source = new Create({ objects, attachments: [child] }); + const shallow = source.clone(); + const copy = source.deepClone(); + const copiedChild = await copy.getObject(); + ok(copiedChild instanceof Note); + notStrictEqual(copiedChild, child); + strictEqual(await shallow.getObject(), child); + strictEqual((await Array.fromAsync(copy.getAttachments()))[0], copiedChild); + // Only inspect the first two positions: accessor traversal is unchanged. + const iterator = copy.getObjects()[Symbol.asyncIterator](); + strictEqual((await iterator.next()).value, copiedChild); + strictEqual((await iterator.next()).value, undefined); + await iterator.return?.(); +}); + +test("exposed scalar arrays recheck accessors, prototypes, and freezing", () => { + const source = new Note({ names: new Array(sparseLength) }); + let reads = 0; + globalThis.Object.defineProperty(source.names, 2, { + get() { + reads++; + return "getter"; + }, + configurable: true, + }); + const accessorCopy = source.clone(); + strictEqual(accessorCopy.names[2], "getter"); + strictEqual(reads, 1); + globalThis.Object.defineProperty(source.names, 2, { + value: "own", + writable: true, + configurable: true, + }); + const prototype = globalThis.Object.create(Array.prototype, { + 1: { get: () => "inherited", configurable: true }, + }); + globalThis.Object.setPrototypeOf(source.names, prototype); + const inheritedCopy = source.clone(); + strictEqual(inheritedCopy.names[1], "inherited"); + strictEqual(globalThis.Object.hasOwn(inheritedCopy.names, 1), true); + globalThis.Object.setPrototypeOf(source.names, Array.prototype); + globalThis.Object.freeze(source.names); + const frozenCopy = source.deepClone(); + frozenCopy.names[2] = "changed"; + strictEqual(source.names[2], "own"); +}); + +test("source shallow copies retain scalar getter mutations", () => { + const source = new Note({ names: new Array(sparseLength) }); + globalThis.Object.defineProperty(source.names, 2, { get: () => 123 }); + strictEqual(source.clone().names[2], 123); + strictEqual(source.deepClone().names[2], 123); + throws(() => new Note({ names: source.names }), TypeError); +}); + +test("array subclasses, species, and own methods retain native fallback", () => { + class Names extends Array { + static override get [Symbol.species](): ArrayConstructor { + return Array; + } + } + const names = new Names(sparseLength); + names[2] = "kept"; + const source = new Note({ names }); + strictEqual(globalThis.Object.getPrototypeOf(source.names), Array.prototype); + strictEqual(source.names[2], "kept"); + strictEqual(source.names.length, sparseLength); + + let everyCalls = 0; + let sliceCalls = 0; + const custom = new Array(sparseLength); + custom[2] = "kept"; + globalThis.Object.defineProperty(custom, "every", { + value( + this: string[], + callback: (value: string, index: number, array: string[]) => unknown, + thisArg?: unknown, + ): boolean { + everyCalls++; + return Array.prototype.every.call(this, callback, thisArg); + }, + configurable: true, + writable: true, + }); + custom.slice = function (start, end) { + sliceCalls++; + return Array.prototype.slice.call(this, start, end); + }; + strictEqual(new Note({ names: custom }).names[2], "kept"); + strictEqual(everyCalls, 1); + strictEqual(sliceCalls, 1); +}); + +test("sparse validation rejects invalid keys injected by element proxies", () => { + for (const replace of [false, true]) { + const licenses = new Array(sparseLength); + licenses[0] = new Proxy(new URL("https://example.com/license"), { + getPrototypeOf(target) { + licenses[6000] = 123 as unknown as URL; + return Reflect.getPrototypeOf(target); + }, + }); + throws( + () => replace ? new Note({}).clone({ licenses }) : new Note({ licenses }), + TypeError, + ); + } +}); + +test("sparse validation rejects keys injected by Symbol.hasInstance", () => { + const translations = new Array(sparseLength); + translations[0] = new Translation({}); + const previous = globalThis.Object.getOwnPropertyDescriptor( + Translation, + Symbol.hasInstance, + ); + // The hook is synchronous and restored before another test can run. + globalThis.Object.defineProperty(Translation, Symbol.hasInstance, { + configurable: true, + value(value: unknown) { + translations[6000] = 123 as unknown as Translation; + return Function.prototype[Symbol.hasInstance].call(Translation, value); + }, + }); + try { + throws(() => new Note({ translations }), TypeError); + } finally { + if (previous == null) { + Reflect.deleteProperty(Translation, Symbol.hasInstance); + } else { + globalThis.Object.defineProperty( + Translation, + Symbol.hasInstance, + previous, + ); + } + } +}); + +test("sparse validation rechecks inputs that switch to native copying", () => { + for (const transition of ["density", "accessor"] as const) { + const licenses = new Array(sparseLength); + const url = new URL("https://example.com/license"); + licenses[0] = new Proxy(url, { + getPrototypeOf(target) { + if (transition === "density") { + licenses.fill(url, 1, sparseLength / 2 + 1); + licenses[6000] = 123 as unknown as URL; + } else { + globalThis.Object.defineProperty(licenses, 6000, { + get: () => 123, + configurable: true, + }); + } + return Reflect.getPrototypeOf(target); + }, + }); + throws(() => new Note({ licenses }), TypeError); + } +}); + +test("sparse copying omits invalid keys injected after its snapshot", () => { + const licenses = new Array(sparseLength); + let checks = 0; + licenses[0] = new Proxy(new URL("https://example.com/license"), { + getPrototypeOf(target) { + if (++checks === 2) licenses[6000] = 123 as unknown as URL; + return Reflect.getPrototypeOf(target); + }, + }); + const source = new Note({ licenses }); + strictEqual(licenses[6000], 123); + strictEqual(6000 in source.licenses, false); + strictEqual(source.licenses[0], licenses[0]); +}); + +test("sparse validation propagates element reflection errors", () => { + const failure = new Error("element reflection failed"); + const licenses = new Array(sparseLength); + licenses[0] = new Proxy(new URL("https://example.com/license"), { + getPrototypeOf() { + throw failure; + }, + }); + throws(() => new Note({ licenses }), (error) => error === failure); +}); + +test("sparse deep traversal snapshots keys and reads later current values", () => { + let destination: Note | undefined; + const added = new Translation({ + original: new URL("https://example.com/new"), + }); + const updated = new Translation({ + original: new URL("https://example.com/updated"), + }); + class CapturesCopy extends Note { + override clone(): Note { + return destination = super.clone(); + } + } + class ChangesLaterEntries extends Translation { + override clone(): Translation { + destination!.translations[100] = added; + delete destination!.translations[6000]; + destination!.translations[7000] = updated; + return super.clone(); + } + } + const translations = new Array(sparseLength); + translations[0] = new ChangesLaterEntries({}); + translations[6000] = new Translation({}); + translations[7000] = new Translation({}); + const source = new CapturesCopy({ translations }); + const copy = source.deepClone(); + strictEqual(copy.translations.length, sparseLength); + strictEqual(copy.translations[100], added); + strictEqual(6000 in copy.translations, false); + notStrictEqual(copy.translations[7000], updated); + notStrictEqual(copy.translations[7000].original, updated.original); + strictEqual(copy.translations[7000].original!.href, updated.original!.href); + strictEqual(100 in source.translations, false); + strictEqual(source.translations[6000], translations[6000]); + strictEqual(source.translations[7000], translations[7000]); +}); + +test("plural getters establish trust for the array actually stored", async () => { + let reads = 0; + const first = new Array(2); + const stored = new Array(3); + stored[2] = new Note({ content: "stored" }); + const source = new Create({ + get objects() { + reads++; + return reads < 4 ? first : stored; + }, + }); + strictEqual(reads, 4); + for (const copy of [source, source.clone(), source.deepClone()]) { + const values = await Array.fromAsync(copy.getObjects()); + strictEqual(values.length, 3); + strictEqual(values[0], undefined); + strictEqual(values[1], undefined); + strictEqual(values[2].content, "stored"); + } + strictEqual(reads, 4); +}); + +test("small sparse object replacements retain trusted holes", async () => { + const child = new Note({ content: "trusted" }); + const objects = new Array(3); + objects[1] = child; + const source = new Create({ objects }); + for ( + const copy of [ + source, + source.clone(), + source.clone({ objects }), + source.deepClone({ objects }), + ] + ) { + const values = await Array.fromAsync(copy.getObjects()); + deepStrictEqual(values.map((value) => value?.content), [ + undefined, + "trusted", + undefined, + ]); + } + deepStrictEqual( + await Array.fromAsync(source.clone({ object: child }).getObjects()), + [child], + ); + deepStrictEqual( + await Array.fromAsync(source.clone({ objects: [] }).getObjects()), + [], + ); +}); + +test("decoded and warmed object trust stays local across clones", async () => { + let fetches = 0; + const original = await Create.fromJsonLd({ + "@context": "https://www.w3.org/ns/activitystreams", + id: "https://a.example/create", + type: "Create", + object: { + id: "https://b.example/note", + type: "Note", + content: "embedded", + }, + }, { contextLoader: mockDocumentLoader }); + // deno-lint-ignore require-await + const documentLoader = async (url: string) => { + fetches++; + return { + contextUrl: null, + documentUrl: url, + document: { + "@context": "https://www.w3.org/ns/activitystreams", + id: url, + type: "Note", + content: "fetched", + }, + }; + }; + const options = { documentLoader, contextLoader: mockDocumentLoader }; + const cold = original.clone(); + const fetched = await original.getObject(options); + strictEqual(fetched?.content, "fetched"); + const warmed = original.clone(); + strictEqual(await warmed.getObject(options), fetched); + strictEqual(fetches, 1); + strictEqual((await cold.getObject(options))?.content, "fetched"); + strictEqual(fetches, 2); + const replacement = new Note({ + id: new URL("https://c.example/note"), + content: "replacement", + }); + strictEqual( + await warmed.clone({ objects: [replacement] }).getObject(options), + replacement, + ); + strictEqual(fetches, 2); +}); + +for (const defaultKind of ["singular", "plural"] as const) { + test(`clone trust replaces ${defaultKind} subclass constructor defaults`, async () => { + let enableDefaults = false; + const defaultObject = new Note({ + id: new URL("https://c.example/default"), + content: "constructor default", + }); + class StatefulCreate extends Create { + constructor( + values: ConstructorParameters[0], + options: ConstructorParameters[1] = {}, + ) { + const defaults = enableDefaults && values.object == null && + values.objects == null + ? defaultKind === "singular" + ? { object: defaultObject } + : { objects: [defaultObject] } + : {}; + super({ ...defaults, ...values }, options); + } + } + const original = await StatefulCreate.fromJsonLd({ + "@context": "https://www.w3.org/ns/activitystreams", + id: "https://a.example/create", + type: "Create", + object: { + id: "https://b.example/note", + type: "Note", + content: "untrusted embedded", + }, + }, { contextLoader: mockDocumentLoader }); + ok(original instanceof StatefulCreate); + enableDefaults = true; + strictEqual(await new StatefulCreate({}).getObject(), defaultObject); + const copies = [original, original.clone(), original.deepClone()]; + let fetches = 0; + // deno-lint-ignore require-await + const documentLoader = async (url: string) => { + fetches++; + return { + contextUrl: null, + documentUrl: url, + document: { + "@context": "https://www.w3.org/ns/activitystreams", + id: url, + type: "Note", + content: "fetched", + }, + }; + }; + for (const copy of copies) { + ok(copy instanceof StatefulCreate); + strictEqual( + (await copy.getObject({ + documentLoader, + contextLoader: mockDocumentLoader, + }))?.content, + "fetched", + ); + } + strictEqual(fetches, 3); + }); +} diff --git a/packages/vocab/src/vocab.bench.ts b/packages/vocab/src/vocab.bench.ts index d8d1d6336..d9f7bf5cc 100644 --- a/packages/vocab/src/vocab.bench.ts +++ b/packages/vocab/src/vocab.bench.ts @@ -1,4 +1,4 @@ -import { Collection, Object } from "./vocab.ts"; +import { Collection, Create, Note, Object, Person } from "./vocab.ts"; const jsonLd = { "@context": [ @@ -202,3 +202,65 @@ Deno.bench("Collection.toJsonLd()", async (b) => { await collection.toJsonLd(); b.end(); }); + +const actor = new Person({ + id: new URL("https://example.com/alice"), + name: "Alice", +}); +const activity = new Create({ + id: new URL("https://example.com/activities/1"), + actor, + object: new Note({ + id: new URL("https://example.com/notes/1"), + content: "Hello, world!", + attribution: actor, + published: Temporal.Instant.from("2026-10-27T00:00:00Z"), + to: new URL("https://www.w3.org/ns/activitystreams#Public"), + }), +}); + +Deno.bench({ + name: "Create.clone()", + group: "activity copy", + baseline: true, + fn() { + activity.clone(); + }, +}); +Deno.bench({ + name: "Create.deepClone()", + group: "activity copy", + fn() { + activity.deepClone(); + }, +}); +Deno.bench({ + name: "Create JSON-LD round trip", + group: "activity copy", + async fn() { + await Create.fromJsonLd(await activity.toJsonLd()); + }, +}); + +// Low-only entries also exercise output arrays with long trailing holes. +for (const position of [0, 99_999]) { + const names = new Array(100_000); + names[position] = "Sparse"; + const note = new Note({ names }); + for (const method of ["clone", "deepClone"] as const) { + Deno.bench({ + name: `Note.${method}() sparse names at ${position}`, + group: "sparse property copy", + fn() { + note[method](); + }, + }); + } + Deno.bench({ + name: `new Note() sparse names at ${position}`, + group: "sparse property copy", + fn() { + new Note({ names }); + }, + }); +}