From 9157862d85a9b42ebb31a9b9e4553f04481d46a2 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 27 Nov 2026 19:10:00 -0800 Subject: [PATCH 1/2] a11y inferrence improvements, go-toolkit update, update dependencies --- CHANGELOG.MD | 22 ++ cmd/injector/main.go.old | 213 ++++++++++++ docs/manifest.md | 25 +- go.mod | 43 +-- go.sum | 97 +++--- internal/cli/manifest.go | 28 +- pkg/inspector/access_modes_inspector.go | 206 ++++++++++++ pkg/inspector/access_modes_inspector_test.go | 336 +++++++++++++++++++ pkg/serve/api_test.go | 47 ++- 9 files changed, 920 insertions(+), 97 deletions(-) create mode 100644 cmd/injector/main.go.old create mode 100644 pkg/inspector/access_modes_inspector.go create mode 100644 pkg/inspector/access_modes_inspector_test.go diff --git a/CHANGELOG.MD b/CHANGELOG.MD index ccca26b..3c6cf64 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -4,6 +4,28 @@ All notable changes to this project will be documented in this file. **Warning:** Features marked as *alpha* may change or be removed in a future release without notice. Use with caution. +## [Unreleased] + +### Added + +- The `manifest` command now infers the languages of a publication's text when `--inspect-html` is combined with `--infer-a11y=split`. The publication's (X)HTML documents are scanned through their guided navigation representation, and the languages declared in them (`lang` or `xml:lang`) are listed under `language` in the inferred accessibility object, as BCP-47 tags ordered by the number of strings found in each language, most used first. Like `metadata.language`, a single language is written as a string instead of a one-item array + - A string is a block of text, or a run of text in another language inside of one (e.g. ``). Text with no declared language is not counted, so nothing is inferred for publications that don't declare any + - Tags are normalized (`en_us` becomes `en-US`) and keep their region and script, so `en` and `en-US` are listed separately. Tags that are not valid are ignored + - This inference is never merged into the publication's own metadata: nothing is inferred with `--infer-a11y=merged` +- The `manifest` command now infers the `textual` and `visual` access modes from the content of a publication's (X)HTML documents when `--inspect-html` is combined with `--infer-a11y`. `textual` is inferred when a document contains text, and `visual` when one contains an image, an inline SVG or a video which is neither decorative (`role="presentation"` or `role="none"`) nor a cover + - Only the documents of the reading order are read, without the navigation document. Image descriptions such as `alt` are not text, so a publication made of images is not `textual`. An image with an empty `alt` is not considered decorative + - These access modes are inferred even when the publication declares its own `accessMode`: the missing ones are added to it with `--infer-a11y=merged`, or listed in the inferred accessibility object with `--infer-a11y=split` + +### Changed + +- The go-toolkit has been updated to v0.17.1. For the detailed list, refer to the [go-toolkit's changelog](https://github.com/readium/go-toolkit/blob/develop/CHANGELOG.md); the highlights as they apply to the CLI: + - Publications are handled more strictly as untrusted input. Crafted ZIP archives can no longer make the CLI allocate gigabytes of memory, and package documents (manifests, OPF, navigation documents, media overlays…) larger than 32 MiB are an error instead of being read whole + - Exploded publications no longer serve files outside of their directory through symbolic links, nor named pipes or devices. S3 and GCS publications list every object of their prefix, rather than the first 1000 + - The access mode inference changes below +- The `visual` access mode is no longer inferred from the images and videos which are only listed in a publication's `resources`, which made nearly every EPUB with a cover `visual`. Without `--inspect-html`, it is now only inferred when the reading order itself contains an image or a video. For most EPUBs, this means that `--infer-a11y` alone no longer infers `visual`: combine it with `--inspect-html` to infer it from the images the documents actually use +- With `--inspect-html`, the `references` of an image now list the places where it's used as a decorative image (`"role": ["presentation"]`) or with an empty `alt`, which were left out before, as well as the SVGs embedding it with an `` element +- With `--inspect-html`, each (X)HTML document is now converted to its guided navigation representation only once, instead of once for every inspection that reads it + ## [0.11.0] - 2026-11-15 ### Changed diff --git a/cmd/injector/main.go.old b/cmd/injector/main.go.old new file mode 100644 index 0000000..368891f --- /dev/null +++ b/cmd/injector/main.go.old @@ -0,0 +1,213 @@ +package main + +import ( + "archive/zip" + "compress/flate" + "context" + "io" + "io/fs" + "os" + "path/filepath" + "runtime" + "strings" + "time" + + "github.com/pkg/errors" + "github.com/readium/go-toolkit/pkg/archive" + "github.com/readium/go-toolkit/pkg/asset" + "github.com/readium/go-toolkit/pkg/fetcher" + "github.com/readium/go-toolkit/pkg/manifest" + "github.com/readium/go-toolkit/pkg/mediatype" + "github.com/readium/go-toolkit/pkg/parser/epub" + "github.com/readium/go-toolkit/pkg/util/url" + "golang.org/x/sync/errgroup" +) + +func main() { + args := os.Args + if len(args) < 3 { + panic("missing path arguments") + } + root := args[1] + dest := args[2] + _, err := os.Stat(root) + if err != nil { + panic(err) + } + _, err = os.Stat(dest) + if err != nil { + panic(err) + } + println("Input path:", root) + println("Output path:", dest) + dfs := os.DirFS(root) + g := new(errgroup.Group) + println("Parallelism:", runtime.NumCPU()) + g.SetLimit(runtime.NumCPU()) + + var count uint32 + fs.WalkDir(dfs, ".", func(path string, d fs.DirEntry, err error) error { + if err != nil { + panic(err) + } + if d.IsDir() { + return nil + } + if !strings.HasSuffix(d.Name(), ".epub") { + return nil + } + count++ + + g.Go(func() error { + ctx, cancel := context.WithTimeout(context.TODO(), time.Second*30) + defer cancel() + + fp := filepath.Join(root, path) + a := asset.File(url.MustURLFromString(fp)) + f, err := a.CreateFetcher(ctx, asset.Dependencies{ + ArchiveFactory: archive.NewArchiveFactory(), + }, "") + if err != nil { + return err + } + defer f.Close() + + if !a.MediaType(ctx).Equal(&mediatype.EPUB) { + return errors.New(path + " is not an EPUB!") + } + opfPath, err := epub.GetRootFilePath(ctx, f) + if err != nil { + return err + } + opfResource := f.Get(ctx, manifest.Link{Href: manifest.NewHREF(opfPath)}) + rawOPF, errx := fetcher.ReadResourceAsString(ctx, opfResource) + if errx != nil { + return errx + } + opfXmlDocument, errx := fetcher.ReadResourceAsXML(ctx, opfResource, map[string]string{ + epub.NamespaceOPF: "opf", + epub.NamespaceDC: "dc", + epub.VocabularyDCTerms: "dcterms", + "http://www.idpf.org/2013/rendition": "rendition", + }) + if errx != nil { + return errx + } + packageDocument, err := epub.ParsePackageDocument(opfXmlDocument, opfPath) + if err != nil { + return errors.Wrap(err, "invalid OPF file") + } + f.Close() // Close fetcher to free archive, simpler to operate with raw ZIP for now + + readCloser, err := zip.OpenReader(fp) + if err != nil { + return err + } + defer readCloser.Close() + + dp := filepath.Join(dest, path) + err = os.MkdirAll(filepath.Dir(dp), os.ModePerm) + if err != nil { + return err + } + outFile, err := os.Create(dp) + if err != nil { + return err + } + defer outFile.Close() + writer := zip.NewWriter(outFile) + writer.RegisterCompressor(zip.Deflate, func(out io.Writer) (io.WriteCloser, error) { + return flate.NewWriter(out, flate.BestCompression) + }) + defer writer.Close() + + for _, file := range readCloser.File { + if file.Name == opfPath.String() { + // This is the OPF + w, err := writer.CreateHeader(&zip.FileHeader{ + Name: file.Name, + Method: zip.Deflate, + Modified: time.Now(), + }) + if err != nil { + return err + } + + var lines []string + if packageDocument.EPUBVersion < 3.0 { + // EPUB 2 + lines = []string{ + ``, + ``, + ``, + } + } else { + // EPUB 3 + lines = []string{ + ``, + `1`, + `https://www.fenixx.fr/tdm`, + } + } + i := strings.LastIndex(rawOPF, "") + if i < 0 { + return errors.New("invalid OPF, missing tag") + } + + // Figure out what the indent is by looking at the last line before + + var indent string + + j := strings.LastIndex(rawOPF[:i], "\n") + if j >= 0 { + // Set i to offset of j + i = j + + k := strings.LastIndex(rawOPF[:j], "\n") + if k >= 0 { + line := rawOPF[k+1 : j] + for _, r := range line { + if r == ' ' || r == '\t' { + indent += string(r) + } else { + break + } + } + } + } + + var sb strings.Builder + for _, line := range lines { + if len(indent) > 0 { + sb.WriteRune('\n') + } + sb.WriteString(indent) + sb.WriteString(line) + } + if _, err := w.Write([]byte(rawOPF[:i])); err != nil { + return err + } + if _, err := w.Write([]byte(sb.String())); err != nil { + return err + } + if _, err := w.Write([]byte(rawOPF[i:])); err != nil { + return err + } + } else { + err = writer.Copy(file) + if err != nil { + return err + } + } + } + return nil + }) + return nil + }) + + if err := g.Wait(); err != nil { + panic(err) + } + + println("Processed", count, "EPUBs") +} diff --git a/docs/manifest.md b/docs/manifest.md index e7353d2..1fc92f2 100644 --- a/docs/manifest.md +++ b/docs/manifest.md @@ -39,7 +39,8 @@ It takes one of the following arguments: | Key | Value | Rules | | --- | ----- | ----- | | `accessMode` | `auditory` | If the publication contains a reference to an audio or video resource (inspect `resources` and `readingOrder` in RWPM). | -| `accessMode` | `visual` | If the publications contains a reference to an image or a video resource (inspect `resources` and `readingOrder` in RWPM). | +| `accessMode` | `textual` | If `textual` is inferred for `accessModeSufficient` (see below).
:warning: With the `--inspect-html` flag: also if any (X)HTML document of the reading order contains text. See [access modes inferred from documents](#access-modes-inferred-from-documents). | +| `accessMode` | `visual` | If the reading order contains an image or a video resource (inspect `readingOrder` in RWPM). The ones which are only listed in `resources` are not enough.
:warning: With the `--inspect-html` flag: also if any (X)HTML document of the reading order contains an image or a video which is neither decorative nor a cover. See [access modes inferred from documents](#access-modes-inferred-from-documents). | | `accessModeSufficient` | `textual` | If the publication is partially or fully accessible (WCAG A or above).
Or if the publication does not contain any image, audio or video resource (inspect "resources" and "readingOrder" in RWPM)
Or if the only image available can be identified as a cover. `--infer-a11y-ignore-image-` flags extend this inference by counting ignored images as non available.| | `feature` | `displayTransformability` | :warning: This rule is only used with reflowable EPUB files that conform to WCAG AA or above. | | `feature` | `pageNavigation` | If the publications contains a page list (check for the presence of a `pageList` collection in RWPM). | @@ -49,6 +50,23 @@ It takes one of the following arguments: | `feature` | `pageBreakMarkers` | :warning: This rule requires the `--inspect-html` flag. If any of the publication's (X)HTML documents contains a page break marker (`epub:type="pagebreak"` or `role="doc-pagebreak"`). | | `language` | BCP-47 language tags | :warning: This rule requires the `--inspect-html` flag, and is only used with `--infer-a11y=split`: inferred languages are never merged with the authored metadata. The languages declared in the publication's (X)HTML documents (`lang` or `xml:lang`), ordered by the number of strings found in each language, most used first. | +Unless stated otherwise, an `accessMode` is only inferred from the manifest when the publication doesn't declare any. + +#### Access modes inferred from documents + +A manifest lists the images of a publication, but doesn't tell how they're used, and says nothing of the text. Combined with `--infer-a11y`, the `--inspect-html` flag reads the (X)HTML documents to find out: + +```sh +readium manifest --inspect-html --infer-a11y=split publication.epub +``` + +- `textual` is inferred when a document contains text. The description of an image (such as its `alt`) is not text, and neither is the page number of a page break marker: a publication made of images is not `textual`, however well described they are. +- `visual` is inferred when a document contains an image, an inline SVG or a video which is: + - not decorative, which takes a `role="presentation"` or a `role="none"`. An empty `alt` is not enough: these are common on images that do convey information. + - not a cover: the image is not the cover of the publication (`rel` is `cover` in RWPM), and neither it nor any of the elements it's in is marked as a cover (`epub:type="cover"` or `role="doc-cover"`). +- Only the documents of the reading order are read, except for the navigation document if it's part of it. Documents with `linear="no"` in the spine of an EPUB are not read. +- Unlike the access modes inferred from the manifest, these are inferred even when the publication declares its own. With `--infer-a11y=merged`, the missing ones are added to them: a publication declaring `textual` which has an illustration ends up with `["textual", "visual"]`. With `--infer-a11y=split`, only the ones the publication doesn't declare are listed in the inferred accessibility object. + #### Inferred languages The inferred `language` is not part of the accessibility metadata that a publication can declare, which is why it's only available in the inferred accessibility object: @@ -59,7 +77,7 @@ readium manifest --inspect-html --infer-a11y=split publication.epub ```json "https://readium.org/webpub-manifest#inferredAccessibility": { - "accessMode": ["visual"], + "accessMode": ["textual", "visual"], "feature": ["tableOfContents"], "language": ["fr", "en-US"] } @@ -167,9 +185,6 @@ readium manifest --infer-a11y=split moby-dick.epub | jq .metadata "http://www.idpf.org/2007/opf#version": "3.0", "https://github.com/readium/go-toolkit/releases": "v0.10.1", "https://readium.org/webpub-manifest#inferredAccessibility": { - "accessMode": [ - "visual" - ], "feature": [ "tableOfContents" ] diff --git a/go.mod b/go.mod index a8d3316..219b8cd 100644 --- a/go.mod +++ b/go.mod @@ -3,13 +3,13 @@ module github.com/readium/cli go 1.26.0 require ( - cloud.google.com/go/storage v1.71.0 + cloud.google.com/go/storage v1.71.1 github.com/CAFxX/httpcompression v0.0.9 github.com/MicahParks/jwkset v0.12.0 github.com/MicahParks/keyfunc/v3 v3.9.2 github.com/airmrcr/go-problem v0.5.0 github.com/andybalholm/brotli v1.3.0 - github.com/aws/aws-sdk-go-v2 v1.48.0 + github.com/aws/aws-sdk-go-v2 v1.48.1 github.com/aws/aws-sdk-go-v2/config v1.33.21 github.com/aws/aws-sdk-go-v2/credentials v1.21.3 github.com/aws/aws-sdk-go-v2/service/s3 v1.116.0 @@ -20,26 +20,26 @@ require ( github.com/gotd/contrib v0.26.0 github.com/maypok86/otter/v2 v2.4.0 github.com/pkg/errors v0.9.1 - github.com/readium/go-toolkit v0.16.2 + github.com/readium/go-toolkit v0.17.1 github.com/spf13/cobra v1.10.2 github.com/stretchr/testify v1.12.1 github.com/vmihailenco/go-tinylfu v0.2.2 github.com/zeebo/xxh3 v1.1.0 golang.org/x/text v0.44.0 - google.golang.org/api v0.312.0 + google.golang.org/api v0.317.0 lukechampine.com/blake3 v1.5.3 ) require ( - cel.dev/expr v0.25.3 // indirect + cel.dev/expr v0.26.0 // indirect cloud.google.com/go v0.123.0 // indirect - cloud.google.com/go/auth v0.24.4 // indirect + cloud.google.com/go/auth v0.24.5 // indirect cloud.google.com/go/auth/oauth2adapt v0.3.1 // indirect cloud.google.com/go/compute/metadata v0.10.0 // indirect cloud.google.com/go/iam v1.15.1 // indirect - cloud.google.com/go/monitoring v1.30.0 // indirect - github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.62.0 // indirect - github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.62.0 // indirect + cloud.google.com/go/monitoring v1.32.1 // indirect + github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.63.0 // indirect + github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.63.0 // indirect github.com/abema/go-mp4 v1.7.4 // indirect github.com/agext/regexp v1.3.0 // indirect github.com/airmrcr/go-optional v0.2.0 // indirect @@ -59,7 +59,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/sso v1.39.5 // indirect github.com/aws/aws-sdk-go-v2/service/ssooidc v1.44.5 // indirect github.com/aws/aws-sdk-go-v2/service/sts v1.53.0 // indirect - github.com/aws/smithy-go v1.28.9 // indirect + github.com/aws/smithy-go v1.28.10 // indirect github.com/azr/gift v1.1.2 // indirect github.com/azr/phash v0.2.0 // indirect github.com/bbrks/go-blurhash v1.2.0 // indirect @@ -68,10 +68,10 @@ require ( github.com/deckarep/golang-set v1.8.0 // indirect github.com/dhowden/tag v0.0.0-20240417053706-3d75831295e8 // indirect github.com/disintegration/imaging v1.6.2 // indirect - github.com/envoyproxy/go-control-plane/envoy v1.39.1-0.20260819172001-e6e3fd93e4be // indirect + github.com/envoyproxy/go-control-plane/envoy v1.40.0 // indirect github.com/envoyproxy/protoc-gen-validate v1.3.3 // indirect github.com/felixge/httpsnoop v1.1.0 // indirect - github.com/go-jose/go-jose/v4 v4.1.6 // indirect + github.com/go-jose/go-jose/v4 v4.1.9 // indirect github.com/go-logr/logr v1.4.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-viper/mapstructure/v2 v2.5.0 // indirect @@ -82,17 +82,17 @@ require ( github.com/hhrutter/tiff v1.0.7 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/kettek/apng v0.0.0-20220823221153-ff692776a607 // indirect - github.com/klauspost/compress v1.19.2 // indirect - github.com/klauspost/cpuid/v2 v2.2.11 // indirect + github.com/klauspost/compress v1.20.5 // indirect + github.com/klauspost/cpuid/v2 v2.4.2 // indirect github.com/pdfcpu/pdfcpu v0.16.4 // indirect github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect github.com/readium/zran v0.0.0-20260525212206-dcf56adb2c0e // indirect github.com/relvacode/iso8601 v1.8.3 // indirect github.com/spf13/pflag v1.0.10 // indirect - github.com/spiffe/go-spiffe/v2 v2.8.1 // indirect + github.com/spiffe/go-spiffe/v2 v2.9.0 // indirect github.com/trimmer-io/go-xmp v1.0.0 // indirect github.com/xdg-go/stringprep v1.0.4 // indirect - go.opentelemetry.io/auto/sdk v1.2.1 // indirect + go.opentelemetry.io/auto/sdk v1.2.2 // indirect go.opentelemetry.io/contrib/detectors/gcp v1.47.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.72.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.72.0 // indirect @@ -104,18 +104,19 @@ require ( go.opentelemetry.io/otel/trace v1.47.0 // indirect go.yaml.in/yaml/v3 v3.0.5 // indirect go4.org v0.0.0-20230225012048-214862532bf5 // indirect - golang.org/x/crypto v0.58.0 // indirect + golang.org/x/crypto v0.59.0 // indirect golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect golang.org/x/image v0.48.0 // indirect - golang.org/x/net v0.62.0 // indirect + golang.org/x/net v0.63.0 // indirect golang.org/x/oauth2 v0.38.0 // indirect golang.org/x/sync v0.25.0 // indirect golang.org/x/sys v0.50.0 // indirect golang.org/x/time v0.16.0 // indirect - google.golang.org/genproto v0.0.0-20261012220534-4341edf3f941 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20261110000943-09e21b237f2c // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20261110000943-09e21b237f2c // indirect + google.golang.org/genproto v0.0.0-20261123191846-1e707ab9fbc2 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20261123191846-1e707ab9fbc2 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20261123191846-1e707ab9fbc2 // indirect google.golang.org/grpc v1.85.0 // indirect google.golang.org/protobuf v1.36.12 // indirect + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 84651d1..9dcefca 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -cel.dev/expr v0.25.3 h1:A2jO8jwOugrrovveCWfj0KEZOfqiLgAcwjpHPhzIGw0= -cel.dev/expr v0.25.3/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= +cel.dev/expr v0.26.0 h1:oLXvOF0jiYA5A/tmzU91pLEWZkKynhLJlC9Gw7PrKvs= +cel.dev/expr v0.26.0/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -11,8 +11,8 @@ cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6T cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= cloud.google.com/go v0.123.0 h1:2NAUJwPR47q+E35uaJeYoNhuNEM9kM8SjgRgdeOJUSE= cloud.google.com/go v0.123.0/go.mod h1:xBoMV08QcqUGuPW65Qfm1o9Y4zKZBpGS+7bImXLTAZU= -cloud.google.com/go/auth v0.24.4 h1:m49juFKXOaeRwmLgcrd3e4hrwqLDe1+4g8fH0EoznUU= -cloud.google.com/go/auth v0.24.4/go.mod h1:p4UXqfSXnMVUDutk9xePzI8lj8yyoJ3BLsKWv0NSvQk= +cloud.google.com/go/auth v0.24.5 h1:uJmCA/tQ66kowrFndTITFOvuInWrozxTUR0ZW7Ofo98= +cloud.google.com/go/auth v0.24.5/go.mod h1:1sKRPX9E44bRVbJwo7o8P+AhkYZkg1idTQC7Kreq+hI= cloud.google.com/go/auth/oauth2adapt v0.3.1 h1:BKLDdbWS7pafd820dsyFDF6fPEzIGqr7ny6hbTzCCgE= cloud.google.com/go/auth/oauth2adapt v0.3.1/go.mod h1:B1nM4FJDxoDqAt3PXFG4IflUoQ5kvWAOOM3R+5wAszg= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= @@ -22,31 +22,31 @@ cloud.google.com/go/compute/metadata v0.10.0/go.mod h1:rGFHRrIif570kSibjFTMbt6/4 cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/iam v1.15.1 h1:i6EXLKyIi0Sh72p+5+Fz0PfnzB63bkneVpaBCGrjlWs= cloud.google.com/go/iam v1.15.1/go.mod h1:nDJ/rfCzLKyBUY1AeiSQwOAJg/AN7zZ2QmNzRTcK2jM= -cloud.google.com/go/logging v1.20.0 h1:l7yzCB8/JSY5PHT9RsaqdT1jaBGbM6KlSJDX210HlXM= -cloud.google.com/go/logging v1.20.0/go.mod h1:ALUaJQZM691Eeujy9kFx0xREq3AMPuGd+pTRZuTYv+w= +cloud.google.com/go/logging v1.21.1 h1:fvlcl/l7d4b0f3T5Y7u37GeDEPeDEKXN/y/Xs+KluUE= +cloud.google.com/go/logging v1.21.1/go.mod h1:SntfPM/4mHzQEd/LiOO9/IUclKaucFHLemeLBk/mcsA= cloud.google.com/go/longrunning v1.5.0 h1:aGonu6LHQl38DyozLs2jxGieI4Ixk+7GTnmHVcHt8zA= cloud.google.com/go/longrunning v1.5.0/go.mod h1:vjM1U85ZQuTv8lJoUBSA44HLWvM6BBFeaSJYGFF1Q00= -cloud.google.com/go/monitoring v1.30.0 h1:r/d+JUbyKmJ8b07iznuKfzVzrIXTWxHQ3lBRm3x2LlY= -cloud.google.com/go/monitoring v1.30.0/go.mod h1:htlUR0QWVMrjFzZmN4LGnMAve9xB/eduwjmINxVZ8RM= +cloud.google.com/go/monitoring v1.32.1 h1:DzNqsbCCyMJ+Oq+McBHaR5qqqxCvdNCIgfJug/YM0Ys= +cloud.google.com/go/monitoring v1.32.1/go.mod h1:JkJhVXtTcGh6KQuvProJ9olvu2p37Ay29CinCDFKHHg= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.71.0 h1:vv4wBFygNlKtSmDMcCIz/ATVv9iIJMkZGjk17uzXMv4= -cloud.google.com/go/storage v1.71.0/go.mod h1:axUlps/Uy9usUkUNd14db8SbV7s+dNV+BU/xkvPmzrU= -cloud.google.com/go/trace v1.16.0 h1:GmQovzFc5F0CNfl0VLgL64aoTtu7xsM0YajW2GlG9+E= -cloud.google.com/go/trace v1.16.0/go.mod h1:r+bdAn16dKLSV1G2D5v3e58IlQlizfxWrUfjx7kM7X0= +cloud.google.com/go/storage v1.71.1 h1:VV+UWTHX07FLnwNi2cGL9ECRHEnA9UzIMC6D88DrQgk= +cloud.google.com/go/storage v1.71.1/go.mod h1:S4Fb7xUi2nm0TSlnl8V3Cc+Q0+g6AOBpzt57j5/jY8U= +cloud.google.com/go/trace v1.17.0 h1:7+RAkTVGq3rmO2G74BdhpP1Bvbk3rFWzGt1MfMfHBt8= +cloud.google.com/go/trace v1.17.0/go.mod h1:GTuZUt8sliPaEYVumjlXAjc4ClYld/nxWBALepV7Mx4= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/CAFxX/httpcompression v0.0.9 h1:0ue2X8dOLEpxTm8tt+OdHcgA+gbDge0OqFQWGKSqgrg= github.com/CAFxX/httpcompression v0.0.9/go.mod h1:XX8oPZA+4IDcfZ0A71Hz0mZsv/YJOgYygkFhizVPilM= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.62.0 h1:5y2LR2pripbccOte6BpZ+guv5O5W0OQIfKvUYZrGaAQ= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.62.0/go.mod h1:b3f7EifFRqkVt142USoGIP62uUeZm7ALCPrs1ZjWXYo= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.62.0 h1:tRsXhJnn0w0TNwJpVrB94wsrimzjWKFzdQlUhRdNUzc= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.62.0/go.mod h1:ifhe5teRNcbxg9p353DhOkOgczzL/IBLYFqT1cm1zpM= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.62.0 h1:aPMa5qZU9dp4fU34o+jQgVIPFIOi20oxYg8TLigmZLg= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.62.0/go.mod h1:sg6Wqbl0BKKZ5zKnQj2q0qic/3ziF894SCx1LpbX37Y= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.63.0 h1:IRqLaCkFN7i+bo7eZFIITa2HP2aXZQvU0VQBEqgUrDs= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.63.0/go.mod h1:loo9GMOLCTVFwqP+ZAZkXuPzPq3jbauUpmG565+qMNM= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.63.0 h1:o6Qfbi7RPeW0R5uhIaHVQ2Sv0KcsYcjA9I/erzqhSpY= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.63.0/go.mod h1:2YwTTZvg1Nhk8hvfr9RsA80ehY7dU4bJWWem7ailECQ= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.63.0 h1:BvrXkC8g/MqI7lyJt0Jddjuo1hm+NlNx4theSFfhfw8= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.63.0/go.mod h1:O5gqO+rsDs9p6eDe5MNSLfSIcoiw1iGqkyQbiiFCWhU= github.com/MicahParks/jwkset v0.12.0 h1:d/S70TKDneLrBhn9XvyKaKDp/UnDkU1kacVLHytECA4= github.com/MicahParks/jwkset v0.12.0/go.mod h1:U2oRhRaLgDCLjtpGL2GseNKGmZtLs/3O7p+OZaL5vo0= github.com/MicahParks/keyfunc/v3 v3.9.2 h1:yWvqmCIWMnyp8tJFR3VmNQRBGmNRJ3cMvN9bcG9Bfbc= @@ -70,8 +70,8 @@ github.com/antchfx/xmlquery v1.5.2 h1:RRKPmhm4gZOSSqDkbNVBHC+NwbE2grfPFssBI+/zkr github.com/antchfx/xmlquery v1.5.2/go.mod h1:2H6ruVAe9IVOxkuhoWR60XHc62EDYWL56IqCMZPTzac= github.com/antchfx/xpath v1.3.9 h1:muXJSod6jRzhsiUjvduNSxsRSptFZ2GOJ1oMD1QkPSA= github.com/antchfx/xpath v1.3.9/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs= -github.com/aws/aws-sdk-go-v2 v1.48.0 h1:tFU7EJVm7MfyaXLsXdYTZ0Vd6vwt9OljCyqq0gqk0Mc= -github.com/aws/aws-sdk-go-v2 v1.48.0/go.mod h1:oeKU5p+TQBnpeLmU42WZLWvzv+ORLn+74n4QVLnm/Z0= +github.com/aws/aws-sdk-go-v2 v1.48.1 h1:j6ro6IvbxUe8BCulc/6uWMrhmx6+i5HNIc1GZEJRT9k= +github.com/aws/aws-sdk-go-v2 v1.48.1/go.mod h1:HP8Jzg1FDurJomtx40YM0eiLoJrwjjZ9X+4BNpy4OXc= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.27 h1:3dMP9eEmHVosFN1QiD24IJBKVY8m6iUfVYXqRCT118Q= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.27/go.mod h1:KH4PKcqtjy1m0656eqQV2v53xE04ddJzuNloEKqlHkI= github.com/aws/aws-sdk-go-v2/config v1.33.21 h1:NY1d3yXmplUSYnUAue0sR88svD+SJiaI+YJGp8TxSNg= @@ -104,8 +104,8 @@ github.com/aws/aws-sdk-go-v2/service/ssooidc v1.44.5 h1:uIOBLMhef4N16WguadoHKuBy github.com/aws/aws-sdk-go-v2/service/ssooidc v1.44.5/go.mod h1:NwWmkFLtsTVyXQpbzPOlYLwEoANkdCFjJRtrNcbg/vY= github.com/aws/aws-sdk-go-v2/service/sts v1.53.0 h1:my9Y6lxcqvPV5k4OTqnxr8XbiTDDRos1leEh050Z93U= github.com/aws/aws-sdk-go-v2/service/sts v1.53.0/go.mod h1:MG6N8U9+lY4LqchrlHPqCOSr7hyxw70XU0Et2YR3eNA= -github.com/aws/smithy-go v1.28.9 h1:zkZ058OpNX0iGTK24b+ZUEQSMc11CBA6oO7xtKZfzkY= -github.com/aws/smithy-go v1.28.9/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= +github.com/aws/smithy-go v1.28.10 h1:SfPnj8fGCVAI/P5YC4/1JjuMsucbPp2dROnSTYNo2PE= +github.com/aws/smithy-go v1.28.10/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= github.com/azr/gift v1.1.2 h1:EbQ8/1QMtDfz5Beqg+RY5F21KbwGhE8aWSEbF1pp95A= github.com/azr/gift v1.1.2/go.mod h1:bDKvjyxgachY3zdk831G99y+VANype25eu37uhm3khI= github.com/azr/phash v0.2.0 h1:F6qkeYlwuMUMkUAJkQFElGrQzFnneJwV+L23VrEQ0cU= @@ -137,8 +137,8 @@ github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44am github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.14.0 h1:hbG2kr4RuFj222B6+7T83thSPqLjwBIfQawTkC++2HA= github.com/envoyproxy/go-control-plane v0.14.0/go.mod h1:NcS5X47pLl/hfqxU70yPwL9ZMkUlwlKxtAohpi2wBEU= -github.com/envoyproxy/go-control-plane/envoy v1.39.1-0.20260819172001-e6e3fd93e4be h1:SWe0x6yfglnxuvOiYgTTnNq7QD/yvqthOh1RBI8Bj8w= -github.com/envoyproxy/go-control-plane/envoy v1.39.1-0.20260819172001-e6e3fd93e4be/go.mod h1:PYEOlng9XcrulfyWpm49jECTPV0LT4q8cO7fLW/xwgk= +github.com/envoyproxy/go-control-plane/envoy v1.40.0 h1:G4dcl8KE/HVPnZ25BBdvGZWi8JjyeBfQSvm95U5P1Qc= +github.com/envoyproxy/go-control-plane/envoy v1.40.0/go.mod h1:UZVGjwWu2QV8PkGSlXmqWiSgqCGZe16TgIu4jDl3T5w= github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 h1:/G9QYbddjL25KvtKTv3an9lx6VBE2cnb8wp1vEGNYGI= github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= @@ -148,8 +148,8 @@ github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeO github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-jose/go-jose/v4 v4.1.6 h1:sNRkftxFJxwsILiQukqp5z83QBSmntVwmgRY7AqBDO4= -github.com/go-jose/go-jose/v4 v4.1.6/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= +github.com/go-jose/go-jose/v4 v4.1.9 h1:pKfeQkig1NmgK4hJrZYXLEYURXfoJB61Larw0uIW4gY= +github.com/go-jose/go-jose/v4 v4.1.9/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= @@ -227,12 +227,13 @@ github.com/kettek/apng v0.0.0-20220823221153-ff692776a607 h1:8tP9cdXzcGX2AvweVVG github.com/kettek/apng v0.0.0-20220823221153-ff692776a607/go.mod h1:x78/VRQYKuCftMWS0uK5e+F5RJ7S4gSlESRWI0Prl6Q= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= -github.com/klauspost/compress v1.19.2 h1:hMRETovs/pu/dVWN7zIT1PGG8t509MwT6bO7XSi26R8= -github.com/klauspost/compress v1.19.2/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= -github.com/klauspost/cpuid/v2 v2.2.11 h1:0OwqZRYI2rFrjS4kvkDnqJkKHdHaRnCm68/DY4OxRzU= -github.com/klauspost/cpuid/v2 v2.2.11/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= +github.com/klauspost/compress v1.20.5 h1:rJj5VjH4xQxbnLphg6eqUcDxRFCw1jpMdDY9qXlrwSs= +github.com/klauspost/compress v1.20.5/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= +github.com/klauspost/cpuid/v2 v2.4.2 h1:xRw7IZEsAgVCp6trS/DgWbTAqpixhmywgVgBjYGg1bQ= +github.com/klauspost/cpuid/v2 v2.4.2/go.mod h1:19jmZ9mjzoF//ddRSUsv0zfBTJWh3QJh9FNxZTMrGxU= github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -256,8 +257,8 @@ github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgm github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/readium/go-toolkit v0.16.2 h1:FCshKMoa4ze0S9qtVGl8D/EFchBvUUPYMuZ611divIQ= -github.com/readium/go-toolkit v0.16.2/go.mod h1:YxTxA0u1F+LzpGuzlbA/Jea0G+Q3mh+2hszh8m8l2LM= +github.com/readium/go-toolkit v0.17.1 h1:Bj9CDRTsqD/MAtvD1jt5K6F/qW6NNcLV9/fJCrwiKzI= +github.com/readium/go-toolkit v0.17.1/go.mod h1:YxTxA0u1F+LzpGuzlbA/Jea0G+Q3mh+2hszh8m8l2LM= github.com/readium/zran v0.0.0-20260525212206-dcf56adb2c0e h1:DQJkuzoHhmE+FGtWRanEanh2IpiXRxwmR4OgQwiD5vA= github.com/readium/zran v0.0.0-20260525212206-dcf56adb2c0e/go.mod h1:3znXhDJYPPRNT6KgvPVhTmzAiqUqzEPKUPhPXrPSdB0= github.com/relvacode/iso8601 v1.8.3 h1:8h2uX8q1kG/nioHh7WpG2ywfnM4OW6MhRGK4M5O0Odk= @@ -273,8 +274,8 @@ github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiT github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spiffe/go-spiffe/v2 v2.8.1 h1:eXZMLsu+3MLEPJyGJkolqtVrteZfQdUpOWj6LTiDl/E= -github.com/spiffe/go-spiffe/v2 v2.8.1/go.mod h1:47Q0Q9/AqGha8QLHp+kxpH4Wca7X7EnOtlIJy3mxZ3U= +github.com/spiffe/go-spiffe/v2 v2.9.0 h1:g5qTg3qIP1HXV+GzuyEfSJFVxUCpEP5Ui1OINVJHPB4= +github.com/spiffe/go-spiffe/v2 v2.9.0/go.mod h1:w2CLWKLMTX/PPYUEUPv3ltH0RXsw5S8suwNF46w9/Aw= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -306,8 +307,8 @@ go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= -go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= +go.opentelemetry.io/auto/sdk v1.2.2 h1:ErNn7NW2t1F9CFBLb9iyPMyLRbcEd07l5m/StCe9AEE= +go.opentelemetry.io/auto/sdk v1.2.2/go.mod h1:Ca3X8ec6gdTYjAirla//dnp05ECtQPfN4Ut74OJLVsQ= go.opentelemetry.io/contrib/detectors/gcp v1.47.0 h1:Ct6+aaiSO6Nk5SOb6PYcR7iWp+83YF/pL1OJcGqOmbg= go.opentelemetry.io/contrib/detectors/gcp v1.47.0/go.mod h1:3N259ss0b1AVOs+fYw7lOO0mcUwNqSIpQ+Zitpuqx00= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.72.0 h1:Tq+E65HaNbZTeqcLw6QUhsV+/EIWdkfUH2CQzcrlE5M= @@ -344,8 +345,8 @@ golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliY golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= -golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54= -golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w= +golang.org/x/crypto v0.59.0 h1:xS2jhqYbzNrpvkWP2YTDf4TJwBy3ykR03i8vFDxEc7c= +golang.org/x/crypto v0.59.0/go.mod h1:veDyUwATGs3c+vN3VfTbzViMGXeTBk3WyhBOkn+F/4U= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -403,8 +404,8 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= -golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY= -golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= +golang.org/x/net v0.63.0 h1:HCoTmNh9EpD1PpK8gBNFY4gcTY4N+KQEO8ylfIKqFJ0= +golang.org/x/net v0.63.0/go.mod h1:15JLg3IX1bLjHK264EZQEbIpTiR/KVLuo9CTRWd0pig= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -519,8 +520,8 @@ google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsb google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.312.0 h1:c6EbM0/irOk8MemsYRO3ewSQWxVk2QYQJ/rYHXwEYh0= -google.golang.org/api v0.312.0/go.mod h1:kn5kd1IMbs2x4hq99GcaTOumC0fnMYMwLNAfFxzpISU= +google.golang.org/api v0.317.0 h1:FAf4nkScNr1Zz2ng17GJFT5Cv+eJCy03T2xGcn0PJ4g= +google.golang.org/api v0.317.0/go.mod h1:4uj+S38vspRU3wb5PSAGB/syOzQVKJ6LNMmuvlr6NII= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -539,12 +540,12 @@ google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20261012220534-4341edf3f941 h1:CXq2XEi5aEyLjjPZIwqrmQH8ZY4ctUwK7uyAx3mjX/U= -google.golang.org/genproto v0.0.0-20261012220534-4341edf3f941/go.mod h1:3gK0ehnhP0V7/x3ypGoLyT3d0n6TSi/EcsphIjHrcz4= -google.golang.org/genproto/googleapis/api v0.0.0-20261110000943-09e21b237f2c h1:ofk4SEqvpf6M5VWh88xRp42IYgdVOh7gffebnDj3OqU= -google.golang.org/genproto/googleapis/api v0.0.0-20261110000943-09e21b237f2c/go.mod h1:OzYcNQzaMRKcOFRMtyLzG/cfW1SmS2eh+7UmOLLFblk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20261110000943-09e21b237f2c h1:XXChExL+Tm7Ubp0x0VXUEncPLHrkXIgoVWqnxmKNbAA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20261110000943-09e21b237f2c/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc= +google.golang.org/genproto v0.0.0-20261123191846-1e707ab9fbc2 h1:E6O8KnrpXBQr3/IqBg/5yrW1K26wJBskvKbJHKuOBRk= +google.golang.org/genproto v0.0.0-20261123191846-1e707ab9fbc2/go.mod h1:7LvCP6FlMUaDCoASNPADzlBkI9ygSiAA4GTfVhwQAkE= +google.golang.org/genproto/googleapis/api v0.0.0-20261123191846-1e707ab9fbc2 h1:TVEW5ciB4lPlyo3RBDd2JTlUY0vAzMkPlU/qAzC+rqU= +google.golang.org/genproto/googleapis/api v0.0.0-20261123191846-1e707ab9fbc2/go.mod h1:3q/FqMoaJXT/mbOLAkZaCXuOEpmvBNwYXqdJKeN0gD0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20261123191846-1e707ab9fbc2 h1:FCWn4wv5of/ooWpbWDIeOXqI3+h2MGnV7SvvcJ8f+bQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20261123191846-1e707ab9fbc2/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/internal/cli/manifest.go b/internal/cli/manifest.go index 00563d3..d81f3d1 100644 --- a/internal/cli/manifest.go +++ b/internal/cli/manifest.go @@ -176,9 +176,13 @@ Examples: if inspectHtmlFlag { // HTML inspection reads the publication's guided navigation documents. // Generate them with textref locators, so inspected objects can be - // located in their documents. + // located in their documents, and with the decorative images that are + // otherwise left out, so that all the images of a document are known. config.OnCreatePublication = func(b *pub.Builder) error { - factory := pub.HTMLGuidedNavigationServiceFactory(converter.WithTextRefLocators()) + factory := pub.HTMLGuidedNavigationServiceFactory( + converter.WithTextRefLocators(), + converter.WithDecorativeImages(), + ) b.ServicesBuilder.Set(pub.GuidedNavigationService_Name, &factory) return nil } @@ -220,12 +224,20 @@ Examples: }) // Page break markers can only be found in the documents' HTML, so - // this accessibility inference lives here rather than in the streamer + // this accessibility inference lives here rather than in the streamer. + // The same goes for telling whether the documents hold text, and + // images which are neither decorative nor a cover if config.InferA11yMetadata != streamer.InferA11yMetadataNo { - inspectors = append(inspectors, &inspector.PageBreakMarkers{ - GuidedNavigationService: service, - Mode: config.InferA11yMetadata, - }) + inspectors = append(inspectors, + &inspector.PageBreakMarkers{ + GuidedNavigationService: service, + Mode: config.InferA11yMetadata, + }, + &inspector.AccessModes{ + GuidedNavigationService: service, + Mode: config.InferA11yMetadata, + }, + ) } // So can the languages of the text. This inference is riskier than @@ -284,5 +296,5 @@ func init() { manifestCmd.Flags().BoolVar(&inspectImagesFlag, "inspect-images", false, "Inspect images in the manifest. Their links will be enhanced with size, width and height, and hashes") manifestCmd.Flags().StringSliceVar(&inferIgnoreImageHashesFlag, "infer-a11y-ignore-image-hashes", nil, "Ignore the given hashes when inferring textual accessibility. Hashes are in the format :, separated by commas.") manifestCmd.Flags().StringVar(&inferIgnoreImageDirectoryFlag, "infer-a11y-ignore-image-dir", "", "Ignore the images in a given directory when inferring textual accessibility.") - manifestCmd.Flags().BoolVar(&inspectHtmlFlag, "inspect-html", false, "When inspecting the manifest, use the (X)HTML of documents to enhance accuracy of metadata. Combined with --infer-a11y, also infers the pageBreakMarkers accessibility feature from page breaks found in the documents, and with --infer-a11y=split, the languages of their text") + manifestCmd.Flags().BoolVar(&inspectHtmlFlag, "inspect-html", false, "When inspecting the manifest, use the (X)HTML of documents to enhance accuracy of metadata. Combined with --infer-a11y, also infers the textual and visual access modes from the text and images of the documents, the pageBreakMarkers accessibility feature from their page breaks, and with --infer-a11y=split, the languages of their text") } diff --git a/pkg/inspector/access_modes_inspector.go b/pkg/inspector/access_modes_inspector.go new file mode 100644 index 0000000..3f3af6d --- /dev/null +++ b/pkg/inspector/access_modes_inspector.go @@ -0,0 +1,206 @@ +package inspector + +import ( + "context" + "slices" + "strings" + + "github.com/pkg/errors" + "github.com/readium/go-toolkit/pkg/guidednavigation" + "github.com/readium/go-toolkit/pkg/manifest" + "github.com/readium/go-toolkit/pkg/pub" + "github.com/readium/go-toolkit/pkg/streamer" +) + +// AccessModes infers the textual and visual access modes of a publication from +// the content of its (X)HTML documents, through their guided navigation +// representation: +// - textual, when a document contains text. Descriptions of images, such as +// their alt, are not text, and neither is the label of a page break marker. +// - visual, when a document contains an image or a video which is neither +// decorative nor a cover. An image is decorative when it carries the +// [guidednavigation.RolePresentation] role, which the HTML converter assigns +// to role="presentation" and role="none". An empty alt doesn't make it so. +// An image is a cover when it is the resource of a link with the cover +// relation, or when it or one of its ancestors carries the +// [guidednavigation.RoleCover] role (epub:type="cover" or role="doc-cover"). +// +// The guided navigation service has to be set up with +// [github.com/readium/go-toolkit/pkg/guidednavigation/converter.WithDecorativeImages]: +// the converter otherwise leaves out the images with an empty alt, which would +// then count as decorative. +// +// Only the documents of the reading order are read, without its navigation +// document if it has one: a navigation document always contains text, whatever +// the publication is made of. Documents out of the reading order are either not +// part of the content, or not meant to be read as part of it (linear="no"). +// +// Access modes are inferred whether or not the publication declares some of its +// own, and only the ones which are missing are added. Mode selects where, +// mirroring the streamer's own accessibility inference: merged into the +// metadata's accessibility object, or into the separate inferred accessibility +// object stored in OtherMetadata. With [streamer.InferA11yMetadataNo], the +// inspector does nothing. +type AccessModes struct { + GuidedNavigationService pub.GuidedNavigationService + Mode streamer.InferA11yMetadata +} + +// Name implements Inspector +func (n *AccessModes) Name() string { + return "access modes" +} + +// InspectHREF implements Inspector +func (n *AccessModes) InspectHREF(href manifest.HREF) (*manifest.HREF, error) { + // Identity + return nil, nil +} + +// InspectLink implements Inspector +func (n *AccessModes) InspectLink(link manifest.Link) (*manifest.Link, error) { + // Links are transformed without telling which collection they belong to, + // and only the reading order matters here: it is read from the manifest + return nil, nil +} + +// InspectMetadata implements Inspector +func (n *AccessModes) InspectMetadata(metadata manifest.Metadata) (*manifest.Metadata, error) { + // Identity + return nil, nil +} + +// InspectManifest implements Inspector +func (n *AccessModes) InspectManifest(m manifest.Manifest) (*manifest.Manifest, error) { + if n.Mode != streamer.InferA11yMetadataMerged && n.Mode != streamer.InferA11yMetadataSplit { + return nil, nil + } + + // The access modes there already are, which don't need to be looked for. + // When split, the publication's own are not repeated in the inferred ones. + var known []manifest.A11yAccessMode + if m.Metadata.Accessibility != nil { + known = slices.Clone(m.Metadata.Accessibility.AccessModes) + } + var inferred *manifest.A11y + if n.Mode == streamer.InferA11yMetadataSplit { + if inferred = m.Metadata.InferredAccessibility(); inferred != nil { + known = append(known, inferred.AccessModes...) + } + } + needTextual := !slices.Contains(known, manifest.A11yAccessModeTextual) + needVisual := !slices.Contains(known, manifest.A11yAccessModeVisual) + if !needTextual && !needVisual { + return nil, nil + } + + scan := accessModeScan{ + covers: make(map[string]struct{}), + textual: !needTextual, + visual: !needVisual, + } + for _, link := range m.LinksWithRel("cover") { + scan.covers[link.Href.String()] = struct{}{} + } + + for _, link := range m.ReadingOrder { + if scan.done() { + break + } + if link.MediaType == nil || !link.MediaType.IsHTML() || slices.Contains(link.Rels, "contents") { + continue + } + href := link.Href.String() + if !n.GuidedNavigationService.HasGuideForResource(href) { + continue + } + doc, err := n.GuidedNavigationService.GuideForResource(context.TODO(), href) + if err != nil { + return nil, errors.Wrap(err, "failed loading guide for resource "+href) + } + scan.walk(doc.Guided, false) + } + + var found []manifest.A11yAccessMode + if needTextual && scan.textual { + found = append(found, manifest.A11yAccessModeTextual) + } + if needVisual && scan.visual { + found = append(found, manifest.A11yAccessModeVisual) + } + if len(found) == 0 { + return nil, nil + } + + if n.Mode == streamer.InferA11yMetadataMerged { + // Work on a copy so the publication's own accessibility object is left untouched + var a11y manifest.A11y + if m.Metadata.Accessibility != nil { + a11y = *m.Metadata.Accessibility + } + a11y.AccessModes = append(slices.Clone(a11y.AccessModes), found...) + m.Metadata.Accessibility = &a11y + } else { + modes := found + if inferred != nil { + modes = append(slices.Clone(inferred.AccessModes), found...) + } + // Only the access modes changed, and only they are written back: the + // inferred object can hold keys that A11y doesn't model + setInferredA11y(&m.Metadata, "accessMode", jsonStrings(modes)) + } + + return &m, nil +} + +// accessModeScan looks for text and visual content in guided navigation objects. +type accessModeScan struct { + covers map[string]struct{} // HREFs of the publication's cover images + textual bool // Text was found, or doesn't need to be + visual bool // Visual content was found, or doesn't need to be +} + +// done reports whether there is nothing left to look for. +func (s *accessModeScan) done() bool { + return s.textual && s.visual +} + +// walk reads the given objects and their descendants, until there is nothing +// left to look for. inCover tells whether they are part of a cover. +func (s *accessModeScan) walk(objs []guidednavigation.GuidedNavigationObject, inCover bool) { + for i := range objs { + if s.done() { + return + } + obj := &objs[i] + cover := inCover || slices.Contains(obj.Role, guidednavigation.RoleCover) + + // The text of a page break marker is the number of the page + if !s.textual && !slices.Contains(obj.Role, guidednavigation.RolePagebreak) && + strings.TrimSpace(obj.Text.Plain) != "" { + s.textual = true + } + if !s.visual && !cover && s.isVisual(obj) { + s.visual = true + } + + s.walk(obj.Children, cover) + } +} + +// isVisual reports whether an object is an image or a video which is neither +// decorative, nor the publication's cover image. +func (s *accessModeScan) isVisual(obj *guidednavigation.GuidedNavigationObject) bool { + if slices.Contains(obj.Role, guidednavigation.RolePresentation) { + return false + } + if obj.ImgRef != nil { + _, isCover := s.covers[obj.ImgRef.RemoveFragment().String()] + return !isCover + } + // Videos, and images which are not a resource of their own, such as an + // inline SVG or an element with role="img" + return obj.VideoRef != nil || + slices.Contains(obj.Role, guidednavigation.RoleImage) || + slices.Contains(obj.Role, guidednavigation.RoleVideo) +} diff --git a/pkg/inspector/access_modes_inspector_test.go b/pkg/inspector/access_modes_inspector_test.go new file mode 100644 index 0000000..56ad2f8 --- /dev/null +++ b/pkg/inspector/access_modes_inspector_test.go @@ -0,0 +1,336 @@ +package inspector + +import ( + "testing" + + "github.com/readium/go-toolkit/pkg/guidednavigation" + "github.com/readium/go-toolkit/pkg/manifest" + "github.com/readium/go-toolkit/pkg/mediatype" + "github.com/readium/go-toolkit/pkg/streamer" + "github.com/readium/go-toolkit/pkg/util/url" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func mustURL(t *testing.T, href string) url.URL { + t.Helper() + u, err := url.URLFromString(href) + require.NoError(t, err) + return u +} + +// image is a guided navigation image object, as the HTML converter emits for an +// with the given alt. +func image(t *testing.T, href string, alt string) guidednavigation.GuidedNavigationObject { + t.Helper() + obj := guidednavigation.GuidedNavigationObject{ + ImgRef: mustURL(t, href), + Role: []guidednavigation.GuidedNavigationRole{guidednavigation.RoleImage}, + } + if alt != "" { + obj.Description = guidednavigation.NewTextDescription(alt) + } + return obj +} + +// within nests objects in an object with the given roles, as the HTML converter +// does for the content of a block. +func within(roles []guidednavigation.GuidedNavigationRole, objs ...guidednavigation.GuidedNavigationObject) guidednavigation.GuidedNavigationObject { + return guidednavigation.GuidedNavigationObject{Role: roles, Children: objs} +} + +func inspectAccessModes(t *testing.T, m manifest.Manifest, svc *stubGuideService, mode streamer.InferA11yMetadata) manifest.Manifest { + t.Helper() + run := CreateInspection([]Inspector{&AccessModes{GuidedNavigationService: svc, Mode: mode}}) + result := m.Copy(run) + require.NoError(t, run.Error()) + return result +} + +// mergedAccessModes returns the access modes inferred for a publication whose +// only document holds the given objects, merged into its accessibility metadata. +func mergedAccessModes(t *testing.T, objs ...guidednavigation.GuidedNavigationObject) []manifest.A11yAccessMode { + t.Helper() + svc, m := singleDoc(objs...) + result := inspectAccessModes(t, m, svc, streamer.InferA11yMetadataMerged) + if result.Metadata.Accessibility == nil { + return nil + } + return result.Metadata.Accessibility.AccessModes +} + +var ( + textual = manifest.A11yAccessModeTextual + visual = manifest.A11yAccessModeVisual + bodyRole = []guidednavigation.GuidedNavigationRole{guidednavigation.RoleBody} + presentationRole = []guidednavigation.GuidedNavigationRole{guidednavigation.RolePresentation} + coverSectionRoles = []guidednavigation.GuidedNavigationRole{guidednavigation.RoleSection, guidednavigation.RoleCover} +) + +func TestAccessModes_Text(t *testing.T) { + assert.Equal(t, []manifest.A11yAccessMode{textual}, mergedAccessModes(t, within(bodyRole, paragraph))) +} + +func TestAccessModes_TextAndImage(t *testing.T) { + modes := mergedAccessModes(t, within(bodyRole, + paragraph, + // Nested, as the HTML converter does for an image inside of a block + within(nil, image(t, "images/map.jpg", "A map")), + )) + assert.Equal(t, []manifest.A11yAccessMode{textual, visual}, modes) +} + +// The description of an image is not text of the publication: a publication +// made of described images is not textual. +func TestAccessModes_ImageDescriptionIsNotText(t *testing.T) { + modes := mergedAccessModes(t, within(bodyRole, image(t, "images/page1.jpg", "The first page"))) + assert.Equal(t, []manifest.A11yAccessMode{visual}, modes) +} + +func TestAccessModes_BlankTextIsNotText(t *testing.T) { + blank := guidednavigation.GuidedNavigationObject{ + // What's left of a paragraph holding only an image and a non-breaking space + Text: guidednavigation.GuidedNavigationText{Plain: "  ", SSML: ``}, + } + assert.Empty(t, mergedAccessModes(t, within(bodyRole, blank))) +} + +// The text of a page break marker is the number of its page. +func TestAccessModes_PageBreakLabelIsNotText(t *testing.T) { + assert.Empty(t, mergedAccessModes(t, within(bodyRole, pagebreak))) +} + +// An image with an empty alt is emitted without a description. That's not +// enough to tell that it's decorative. +func TestAccessModes_ImageWithoutDescriptionIsVisual(t *testing.T) { + modes := mergedAccessModes(t, within(bodyRole, image(t, "images/figure.jpg", ""))) + assert.Equal(t, []manifest.A11yAccessMode{visual}, modes) +} + +func TestAccessModes_DecorativeImageIsNotVisual(t *testing.T) { + decorative := image(t, "images/ornament.png", "") + decorative.Role = presentationRole + // A presentational