import type { BodyObject, WebAnnotation } from './WebAnnotation.js'; import { OnlyOne } from './multiplicity-utils.js'; /** * Turn a partial annotation into a ‘well-formed’ WebAnnotation. * * It sets the following properties, if absent in the given stub: * - `@context` as required * - `type` as required, to `'Annotation'` * - `created` as recommended (to the current time) * - `target` to `'about:invalid'` * * @returns A shallow clone of the given annotation stub, with the missing * properties added. */ export declare function completeAnnotationStub(annotationStub: Partial): WebAnnotation; /** * Get the name of the creator. If there are multiple, returns the first. * Assumes the creator is a nested Agent object: if the creator a string * (presumably the URL of an Agent node), `undefined` is returned. */ export declare function getSingleCreatorName(annotationOrBody: WebAnnotation | BodyObject): string | undefined; /** * Check whether the annotation likely targets the given URL. * * The word “likely” is used because, in its comparison, this ignores the URL * scheme, fragment and query parameters. * * Note that, strictly speaking, a URL should be treated as an opaque string. * In practice, it may however be useful to consider URLs as ‘likely equivalent’ * in order to apply annotations targeting one URL to the document with the * very similar URL. Apply with caution: Especially a different query may, * depending on the website at hand, result in very different documents. */ export declare function targetsUrl(target: WebAnnotation['target'], url: string): boolean; /** * Get the URLs of the resources that the annotation targets, for all its * targets. */ export declare function getTargetUrls(target: WebAnnotation['target']): string[]; /** * Get the URL of the resource that the annotation targets, for a single * target. */ export declare function getTargetUrl(target: OnlyOne): string; /** * Get the exact quotes that the annotation targets using a TextQuoteSelector, * if any. */ export declare function getTargetQuotes(target: WebAnnotation['target']): string[]; /** * Get the exact quote that a single target of an annotation targets using a * TextQuoteSelector, if any. */ export declare function getTargetQuote(target: OnlyOne): string | undefined;