@behindthemusictree/app-kit 40.1.0 → 41.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/{app-error-B8IoFBhD.d.ts → app-error-ZuIP62i5.d.ts} +3 -1
  2. package/dist/auth/index.cjs.map +1 -1
  3. package/dist/auth/index.d.ts +1 -1
  4. package/dist/auth/index.js +3 -3
  5. package/dist/{chunk-G5ULARLT.js → chunk-26YBFC2L.js} +11 -1
  6. package/dist/chunk-26YBFC2L.js.map +1 -0
  7. package/dist/{chunk-I7NXFXV3.js → chunk-2TJEWD56.js} +2 -2
  8. package/dist/{chunk-WL2TKQVN.js → chunk-3Y7RT7QF.js} +2 -2
  9. package/dist/{chunk-D5UFJF4K.js → chunk-4E3YMYDH.js} +185 -181
  10. package/dist/chunk-4E3YMYDH.js.map +1 -0
  11. package/dist/{chunk-4MEK3CNF.js → chunk-MPTID5ZR.js} +3 -1
  12. package/dist/{chunk-4MEK3CNF.js.map → chunk-MPTID5ZR.js.map} +1 -1
  13. package/dist/{chunk-MF7SJIEY.js → chunk-PZHKZHQY.js} +3 -3
  14. package/dist/{chunk-AYAKFCBP.js → chunk-WHJNRJRZ.js} +23 -15
  15. package/dist/chunk-WHJNRJRZ.js.map +1 -0
  16. package/dist/chunk-X2QEQR6H.js +15 -0
  17. package/dist/{chunk-JMFEWI53.js.map → chunk-X2QEQR6H.js.map} +1 -1
  18. package/dist/genre-tree/index.cjs +202 -177
  19. package/dist/genre-tree/index.cjs.map +1 -1
  20. package/dist/genre-tree/index.d.ts +42 -27
  21. package/dist/genre-tree/index.js +10 -6
  22. package/dist/genre-tree/testing.cjs.map +1 -1
  23. package/dist/genre-tree/testing.d.ts +1 -1
  24. package/dist/genre-tree/testing.js +1 -1
  25. package/dist/{ids-D8XCErUS.d.ts → ids-D7EDBsbJ.d.ts} +3 -1
  26. package/dist/index.cjs +206 -175
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.ts +4 -4
  29. package/dist/index.js +20 -10
  30. package/dist/popup/index.cjs.map +1 -1
  31. package/dist/popup/index.js +2 -2
  32. package/dist/transport/index.cjs +24 -2
  33. package/dist/transport/index.cjs.map +1 -1
  34. package/dist/transport/index.d.ts +3 -3
  35. package/dist/transport/index.js +11 -5
  36. package/dist/useFetchWrapper-H0lO4wFO.d.ts +41 -0
  37. package/package.json +1 -1
  38. package/dist/chunk-AYAKFCBP.js.map +0 -1
  39. package/dist/chunk-D5UFJF4K.js.map +0 -1
  40. package/dist/chunk-G5ULARLT.js.map +0 -1
  41. package/dist/chunk-JMFEWI53.js +0 -10
  42. package/dist/useFetchWrapper-C5lt5fQz.d.ts +0 -15
  43. /package/dist/{chunk-I7NXFXV3.js.map → chunk-2TJEWD56.js.map} +0 -0
  44. /package/dist/{chunk-WL2TKQVN.js.map → chunk-3Y7RT7QF.js.map} +0 -0
  45. /package/dist/{chunk-MF7SJIEY.js.map → chunk-PZHKZHQY.js.map} +0 -0
@@ -2,9 +2,9 @@ import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { QueryKey, InfiniteData } from '@tanstack/react-query';
3
3
  import * as zod from 'zod';
4
4
  import { z } from 'zod';
5
- import { S as Scope, u as useFetchWrapper } from '../useFetchWrapper-C5lt5fQz.js';
6
- import { b as GenreUuid, G as GenrePlaylistUuid } from '../ids-D8XCErUS.js';
7
- export { a as GenrePlaylistUuidSchema, c as GenreUuidSchema } from '../ids-D8XCErUS.js';
5
+ import { R as ResourceResult, S as Scope, u as useFetchWrapper } from '../useFetchWrapper-H0lO4wFO.js';
6
+ import { b as GenreUuid, G as GenrePlaylistUuid } from '../ids-D7EDBsbJ.js';
7
+ export { a as GenrePlaylistUuidSchema, c as GenreUuidSchema, t as toGenreUuid } from '../ids-D7EDBsbJ.js';
8
8
  import * as react from 'react';
9
9
  import { ReactNode } from 'react';
10
10
 
@@ -118,6 +118,13 @@ declare const CriteriaOverviewSchema: z.ZodObject<{
118
118
  summary: z.ZodNullable<z.ZodString>;
119
119
  description: z.ZodNullable<z.ZodString>;
120
120
  summarySourceUrl: z.ZodNullable<z.ZodURL>;
121
+ image: z.ZodOptional<z.ZodNullable<z.ZodObject<{
122
+ url: z.ZodURL;
123
+ pageUrl: z.ZodURL;
124
+ author: z.ZodNullable<z.ZodString>;
125
+ license: z.ZodString;
126
+ licenseUrl: z.ZodNullable<z.ZodURL>;
127
+ }, z.core.$strip>>>;
121
128
  essentialSongs: z.ZodOptional<z.ZodArray<z.ZodObject<{
122
129
  title: z.ZodString;
123
130
  uuid: z.ZodString;
@@ -151,7 +158,14 @@ declare function useListGenres(page: number | undefined, pageSize: number | stri
151
158
  totalPages: number;
152
159
  }>, Error>;
153
160
  declare function useFetchGenre(scope: Scope, getBackendBaseUrl: () => string): (id: GenreUuid) => Promise<CriteriaDetailed>;
154
- declare function useFetchGenreDetail<D extends CriteriaDetailed = CriteriaDetailed>(id: GenreUuid | null, scope: Scope, getBackendBaseUrl: () => string, schema?: z.ZodType<D, unknown>): _tanstack_react_query.UseQueryResult<NoInfer<D>, Error>;
161
+ type UseGenreResult<D extends CriteriaDetailed = CriteriaDetailed> = Exclude<ResourceResult<D>, {
162
+ status: "success";
163
+ }> | {
164
+ status: "success";
165
+ genre: D;
166
+ };
167
+ /** `id` may be a raw URL value: a malformed uuid is not found without a request. */
168
+ declare function useFetchGenreDetail<D extends CriteriaDetailed = CriteriaDetailed>(id: string | null, scope: Scope, getBackendBaseUrl: () => string, schema?: z.ZodType<D, unknown>): UseGenreResult<D>;
155
169
  /** The genre carrying a Wikidata item id: `undefined` while loading or disabled, `null` when the API has none. */
156
170
  declare function useGenreByWikidataId(qid: string | null, scope: Scope, getBackendBaseUrl: () => string): {
157
171
  data: {
@@ -3340,6 +3354,16 @@ declare const useListFullGenrePlaylists: (scope: Scope, getBackendBaseUrl: () =>
3340
3354
  declare const useFetchGenrePlaylist: <T>(uuid: GenrePlaylistUuid, getBackendBaseUrl: () => string, criteriaPlaylistDetailedSchema: z.ZodType<T, unknown>) => _tanstack_react_query.UseQueryResult<NoInfer<T>, Error>;
3341
3355
  declare const useInvalidateAllGenrePlaylistQueries: () => () => Promise<[void, void, void, void]>;
3342
3356
 
3357
+ /** A Wikimedia Commons image with the attribution its license requires. */
3358
+ declare const CommonsImageSchema: z.ZodObject<{
3359
+ url: z.ZodURL;
3360
+ pageUrl: z.ZodURL;
3361
+ author: z.ZodNullable<z.ZodString>;
3362
+ license: z.ZodString;
3363
+ licenseUrl: z.ZodNullable<z.ZodURL>;
3364
+ }, z.core.$strip>;
3365
+ type CommonsImage = z.infer<typeof CommonsImageSchema>;
3366
+
3343
3367
  declare const ARTIST_LINK_KINDS: readonly ["official", "wikipedia", "wikidata", "spotify", "youtube", "bandcamp", "soundcloud", "discogs", "social"];
3344
3368
  declare const ArtistImageSchema: z.ZodObject<{
3345
3369
  url: z.ZodURL;
@@ -3417,21 +3441,15 @@ declare const ArtistDetailedSchema: z.ZodObject<{
3417
3441
  licenseUrl: z.ZodNullable<z.ZodURL>;
3418
3442
  }, z.core.$strip>>;
3419
3443
  }, z.core.$strip>;
3420
- type ArtistImage = z.infer<typeof ArtistImageSchema>;
3444
+ type ArtistImage = CommonsImage;
3421
3445
  type ArtistDetailed = z.infer<typeof ArtistDetailedSchema>;
3422
3446
  type ArtistMembership = ArtistDetailed["members"][number];
3423
3447
  type ArtistLink = ArtistDetailed["links"][number];
3424
3448
  type ArtistAlbum = ArtistDetailed["albums"][number];
3425
3449
 
3426
- type UseArtistResult = {
3427
- status: "idle";
3428
- } | {
3429
- status: "not-found";
3430
- } | {
3431
- status: "error";
3432
- } | {
3433
- status: "loading";
3434
- } | {
3450
+ type UseArtistResult = Exclude<ResourceResult<ArtistDetailed>, {
3451
+ status: "success";
3452
+ }> | {
3435
3453
  status: "success";
3436
3454
  artist: ArtistDetailed;
3437
3455
  };
@@ -3609,15 +3627,9 @@ declare function songUnplayableReason(song: SongDetailed): string | null;
3609
3627
  /** MusicBrainz recording page URL, or null when the song has no MBID. */
3610
3628
  declare function musicBrainzRecordingUrl(song: SongDetailed): string | null;
3611
3629
 
3612
- type UseSongResult = {
3613
- status: "idle";
3614
- } | {
3615
- status: "not-found";
3616
- } | {
3617
- status: "error";
3618
- } | {
3619
- status: "loading";
3620
- } | {
3630
+ type UseSongResult = Exclude<ResourceResult<SongDetailed>, {
3631
+ status: "success";
3632
+ }> | {
3621
3633
  status: "success";
3622
3634
  song: SongDetailed;
3623
3635
  };
@@ -3965,8 +3977,11 @@ interface UseGenreTreeViewStateOptions<O extends CriteriaOverview = CriteriaOver
3965
3977
  viewMode?: GenreViewMode;
3966
3978
  /** Projects this artist onto the tree (see `useVisibleGenrePlaylists`). */
3967
3979
  artistUuid?: string | null;
3968
- /** Entity selection is independent of the visible renderer nodes. */
3969
- selectedGenreUuid?: GenreUuid | null;
3980
+ /**
3981
+ * Entity selection is independent of the visible renderer nodes. It may be a raw URL value that names no
3982
+ * genre (malformed or missing); the detail panel shows it as not found.
3983
+ */
3984
+ selectedGenreUuid?: string | null;
3970
3985
  onSelectedGenreUuidChange?: (genreUuid: GenreUuid | null) => void;
3971
3986
  criteriaOverviewSchema?: z.ZodType<O, unknown>;
3972
3987
  }
@@ -3984,7 +3999,7 @@ interface UseGenreTreeViewStateResult {
3984
3999
  /** Playlists the current view mode may show: unaccepted roots and, outside stacked/outline, criteria-less playlists are hidden. */
3985
4000
  visibleGenrePlaylists: CriteriaPlaylistSimple[];
3986
4001
  groupedGenrePlaylistsByRoot: Record<string, CriteriaPlaylistSimple[]>;
3987
- selectedGenreUuid: GenreUuid | null;
4002
+ selectedGenreUuid: string | null;
3988
4003
  selectedNodeId: string | null;
3989
4004
  selectGenre: (genreUuid: GenreUuid | null) => void;
3990
4005
  selectedGenrePlaylist: CriteriaPlaylistSimple | undefined;
@@ -5003,4 +5018,4 @@ declare const ReferenceGenrePlaylistSchema: z.ZodObject<{
5003
5018
  type ReferenceGenreDetailed = z.infer<typeof ReferenceGenreDetailedSchema>;
5004
5019
  type ReferenceGenrePlaylist = z.infer<typeof ReferenceGenrePlaylistSchema>;
5005
5020
 
5006
- export { ARTIST_LINK_KINDS, type AlbumMinimum, AlbumMinimumSchema, type ArtistAlbum, type ArtistDetailed, ArtistDetailedSchema, type ArtistGenreCount, ArtistGenreCountSchema, type ArtistGenreProjection, type ArtistImage, ArtistImageSchema, type ArtistLink, type ArtistMembership, type ArtistMinimum, ArtistMinimumSchema, ArtistNames, type ArtistSearchResult, ArtistSearchResultSchema, ArtistSearchResultsSchema, type ArtistSongsOrdering, type ArtistTrackListOriginInput, CriteriaCreationSchema, type CriteriaCreationValues, type CriteriaDetailed, CriteriaDetailedSchema, type CriteriaLineageRelWithoutAscendant, CriteriaLineageRelWithoutAscendantSchema, type CriteriaLineageRelWithoutDescendant, CriteriaLineageRelWithoutDescendantSchema, type CriteriaMinimum, CriteriaMinimumSchema, type CriteriaOverview, CriteriaOverviewSchema, type CriteriaPlaylistDetailed, CriteriaPlaylistDetailedSchema, type CriteriaPlaylistMinimum, CriteriaPlaylistMinimumSchema, type CriteriaPlaylistSimple, CriteriaPlaylistSimpleSchema, type CriteriaSimple, CriteriaSimpleSchema, CriteriaUpdateSchema, type CriteriaUpdateValues, FORM_RATING_NULL_VALUE, FUZZY_MIN_SIMILARITY, type GenreCatalogueCounts, GenreCatalogueCountsSchema, GenreCountsSchema, type GenreCoverage, GenreCoverageSchema, type GenreMusicCounts, type GenreMusicSelection, type GenrePlaylistSummary, GenrePlaylistSummarySchema, type GenrePlaylistTracksPage, GenrePlaylistUuid, type GenreSearchParams, type GenreSearchResult, GenreSearchResultSchema, GenreSearchResultsSchema, type GenreSearchTreeName, GenreSearchTreeNameSchema, GenreUuid, type GenreViewMode, MbArtistDetailedSchema, MbRecordingDetailedSchema, type MusicbrainzArtistDetailed, type MusicbrainzRecordingDetailed, NO_VIDEO_LABEL, type NameIndex, type PlayArtistOptions, type PlayGenrePlaylistOptions, type ReferenceGenreDetailed, ReferenceGenreDetailedSchema, type ReferenceGenrePlaylist, ReferenceGenrePlaylistSchema, type RegionGenreLexiconEntry, RegionGenreLexiconEntrySchema, RegionGenreLexiconSchema, type RenderArtistLink, type RenderSongLink, type ReparentCandidate, SEARCH_DEBOUNCE_MS, SEARCH_QUERY_MIN_LENGTH, type SongDetailed, SongDetailedSchema, type SongHistoryEntry, SongHistoryEntrySchema, SongHistorySchema, type SongSearchGenreFilter, type SongSearchParams, type SongSearchResult, SongSearchResultSchema, SongSearchResultsSchema, SubgenreCountsSchema, type SubgenreScope, SubgenreScopeSchema, type TrackBase, TrackBaseSchema, TrackList, TrackListFromArtist, TrackListFromCriteriaPlaylist, TrackListFromTrack, TrackListOrigin, TrackListOriginFromArtist, TrackListOriginFromCriteriaPlaylist, TrackListOriginFromGenreCatalogue, TrackListOriginFromTrack, TrackListOriginType, TrackListProvider, TrackListSidebarVisibilityProvider, type TrackMinimum, TrackMinimumSchema, type TrackPlaylistRel, TracksFailureAlreadyReportedError, type UseArtistResult, type UseArtistSearchResult, type UseGenreRemoteSearchOptions, type UseGenreRemoteSearchResult, type UseGenreSearchOptions, type UseGenreSearchResult, type UseGenreTreeViewStateOptions, type UseGenreTreeViewStateResult, type UseRemoteSearchOptions, type UseRemoteSearchResult, type UseSearchQueryStateOptions, type UseSearchQueryStateResult, type UseSongHistoryResult, type UseSongResult, type UseSongSearchResult, type UseVisibleGenrePlaylistsOptions, type UuidResource, UuidResourceSchema, YOUTUBE_UNPLAYABLE_REASON_LABELS, YoutubeAvailabilitySchema, type YoutubeUnplayableReason, artistEndpoints, artistQueryKeys, capitalizeFirstLetter, createNameIndex, defaultGenreMusicSelection, editGenreSongPages, foldSearchText, formatTime, genreEndpoints, genreMusicCount, genreMusicQueryParams, genreMusicSelectionKey, genrePlaylistEndpoints, genrePlaylistQueryKeys, genrePlaylistTrackCount, genreQueryKeys, genreSearchQueryKeys, genreUpdateMutationKey, getGenrePlaylistsGroupedByRoot, getReparentCandidates, hasMainstreamPopRoot, isSong, isSongSearchResultPlayable, libraryEndpoints, libraryQueryKeys, makeTrackPlaylistRelPageSchema, makeTrackPlaylistRelSchema, musicBrainzRecordingUrl, projectGenrePlaylistsForArtist, rankByName, rankNameIndex, searchGenrePlaylistsByName, songUnplayableReason, trigramSimilarity, useArtist, useArtistGenreCounts, useArtistSearch, useCreateGenre, useDeleteGenre, useFetchGenre, useFetchGenreDetail, useFetchGenreOverview, useFetchGenrePlaylist, useGenreByWikidataId, useGenreRemoteSearch, useGenreSearch, useGenreTreeViewState, useInvalidateAllGenrePlaylistQueries, useListFullGenrePlaylists, useListGenrePlaylists, useListGenres, useListTracks, usePrefetchGenreOverview, useRegionGenreLexicon, useRemoteSearch, useSearchQueryState, useSong, useSongHistory, useSongSearch, useTrackList, useTrackListSidebarVisibility, useUpdateGenre, useVisibleGenrePlaylists };
5021
+ export { ARTIST_LINK_KINDS, type AlbumMinimum, AlbumMinimumSchema, type ArtistAlbum, type ArtistDetailed, ArtistDetailedSchema, type ArtistGenreCount, ArtistGenreCountSchema, type ArtistGenreProjection, type ArtistImage, ArtistImageSchema, type ArtistLink, type ArtistMembership, type ArtistMinimum, ArtistMinimumSchema, ArtistNames, type ArtistSearchResult, ArtistSearchResultSchema, ArtistSearchResultsSchema, type ArtistSongsOrdering, type ArtistTrackListOriginInput, type CommonsImage, CommonsImageSchema, CriteriaCreationSchema, type CriteriaCreationValues, type CriteriaDetailed, CriteriaDetailedSchema, type CriteriaLineageRelWithoutAscendant, CriteriaLineageRelWithoutAscendantSchema, type CriteriaLineageRelWithoutDescendant, CriteriaLineageRelWithoutDescendantSchema, type CriteriaMinimum, CriteriaMinimumSchema, type CriteriaOverview, CriteriaOverviewSchema, type CriteriaPlaylistDetailed, CriteriaPlaylistDetailedSchema, type CriteriaPlaylistMinimum, CriteriaPlaylistMinimumSchema, type CriteriaPlaylistSimple, CriteriaPlaylistSimpleSchema, type CriteriaSimple, CriteriaSimpleSchema, CriteriaUpdateSchema, type CriteriaUpdateValues, FORM_RATING_NULL_VALUE, FUZZY_MIN_SIMILARITY, type GenreCatalogueCounts, GenreCatalogueCountsSchema, GenreCountsSchema, type GenreCoverage, GenreCoverageSchema, type GenreMusicCounts, type GenreMusicSelection, type GenrePlaylistSummary, GenrePlaylistSummarySchema, type GenrePlaylistTracksPage, GenrePlaylistUuid, type GenreSearchParams, type GenreSearchResult, GenreSearchResultSchema, GenreSearchResultsSchema, type GenreSearchTreeName, GenreSearchTreeNameSchema, GenreUuid, type GenreViewMode, MbArtistDetailedSchema, MbRecordingDetailedSchema, type MusicbrainzArtistDetailed, type MusicbrainzRecordingDetailed, NO_VIDEO_LABEL, type NameIndex, type PlayArtistOptions, type PlayGenrePlaylistOptions, type ReferenceGenreDetailed, ReferenceGenreDetailedSchema, type ReferenceGenrePlaylist, ReferenceGenrePlaylistSchema, type RegionGenreLexiconEntry, RegionGenreLexiconEntrySchema, RegionGenreLexiconSchema, type RenderArtistLink, type RenderSongLink, type ReparentCandidate, SEARCH_DEBOUNCE_MS, SEARCH_QUERY_MIN_LENGTH, type SongDetailed, SongDetailedSchema, type SongHistoryEntry, SongHistoryEntrySchema, SongHistorySchema, type SongSearchGenreFilter, type SongSearchParams, type SongSearchResult, SongSearchResultSchema, SongSearchResultsSchema, SubgenreCountsSchema, type SubgenreScope, SubgenreScopeSchema, type TrackBase, TrackBaseSchema, TrackList, TrackListFromArtist, TrackListFromCriteriaPlaylist, TrackListFromTrack, TrackListOrigin, TrackListOriginFromArtist, TrackListOriginFromCriteriaPlaylist, TrackListOriginFromGenreCatalogue, TrackListOriginFromTrack, TrackListOriginType, TrackListProvider, TrackListSidebarVisibilityProvider, type TrackMinimum, TrackMinimumSchema, type TrackPlaylistRel, TracksFailureAlreadyReportedError, type UseArtistResult, type UseArtistSearchResult, type UseGenreRemoteSearchOptions, type UseGenreRemoteSearchResult, type UseGenreResult, type UseGenreSearchOptions, type UseGenreSearchResult, type UseGenreTreeViewStateOptions, type UseGenreTreeViewStateResult, type UseRemoteSearchOptions, type UseRemoteSearchResult, type UseSearchQueryStateOptions, type UseSearchQueryStateResult, type UseSongHistoryResult, type UseSongResult, type UseSongSearchResult, type UseVisibleGenrePlaylistsOptions, type UuidResource, UuidResourceSchema, YOUTUBE_UNPLAYABLE_REASON_LABELS, YoutubeAvailabilitySchema, type YoutubeUnplayableReason, artistEndpoints, artistQueryKeys, capitalizeFirstLetter, createNameIndex, defaultGenreMusicSelection, editGenreSongPages, foldSearchText, formatTime, genreEndpoints, genreMusicCount, genreMusicQueryParams, genreMusicSelectionKey, genrePlaylistEndpoints, genrePlaylistQueryKeys, genrePlaylistTrackCount, genreQueryKeys, genreSearchQueryKeys, genreUpdateMutationKey, getGenrePlaylistsGroupedByRoot, getReparentCandidates, hasMainstreamPopRoot, isSong, isSongSearchResultPlayable, libraryEndpoints, libraryQueryKeys, makeTrackPlaylistRelPageSchema, makeTrackPlaylistRelSchema, musicBrainzRecordingUrl, projectGenrePlaylistsForArtist, rankByName, rankNameIndex, searchGenrePlaylistsByName, songUnplayableReason, trigramSimilarity, useArtist, useArtistGenreCounts, useArtistSearch, useCreateGenre, useDeleteGenre, useFetchGenre, useFetchGenreDetail, useFetchGenreOverview, useFetchGenrePlaylist, useGenreByWikidataId, useGenreRemoteSearch, useGenreSearch, useGenreTreeViewState, useInvalidateAllGenrePlaylistQueries, useListFullGenrePlaylists, useListGenrePlaylists, useListGenres, useListTracks, usePrefetchGenreOverview, useRegionGenreLexicon, useRemoteSearch, useSearchQueryState, useSong, useSongHistory, useSongSearch, useTrackList, useTrackListSidebarVisibility, useUpdateGenre, useVisibleGenrePlaylists };
@@ -8,6 +8,7 @@ import {
8
8
  ArtistNames,
9
9
  ArtistSearchResultSchema,
10
10
  ArtistSearchResultsSchema,
11
+ CommonsImageSchema,
11
12
  CriteriaCreationSchema,
12
13
  CriteriaDetailedSchema,
13
14
  CriteriaLineageRelWithoutAscendantSchema,
@@ -125,16 +126,17 @@ import {
125
126
  useTrackListSidebarVisibility,
126
127
  useUpdateGenre,
127
128
  useVisibleGenrePlaylists
128
- } from "../chunk-D5UFJF4K.js";
129
- import "../chunk-AYAKFCBP.js";
130
- import "../chunk-WL2TKQVN.js";
131
- import "../chunk-4MEK3CNF.js";
129
+ } from "../chunk-4E3YMYDH.js";
130
+ import "../chunk-WHJNRJRZ.js";
131
+ import "../chunk-3Y7RT7QF.js";
132
+ import "../chunk-MPTID5ZR.js";
132
133
  import "../chunk-MAKY4YBN.js";
133
134
  import "../chunk-W4QTTNNA.js";
134
135
  import {
135
136
  GenrePlaylistUuidSchema,
136
- GenreUuidSchema
137
- } from "../chunk-JMFEWI53.js";
137
+ GenreUuidSchema,
138
+ toGenreUuid
139
+ } from "../chunk-X2QEQR6H.js";
138
140
  export {
139
141
  ARTIST_LINK_KINDS,
140
142
  AlbumMinimumSchema,
@@ -145,6 +147,7 @@ export {
145
147
  ArtistNames,
146
148
  ArtistSearchResultSchema,
147
149
  ArtistSearchResultsSchema,
150
+ CommonsImageSchema,
148
151
  CriteriaCreationSchema,
149
152
  CriteriaDetailedSchema,
150
153
  CriteriaLineageRelWithoutAscendantSchema,
@@ -234,6 +237,7 @@ export {
234
237
  rankNameIndex,
235
238
  searchGenrePlaylistsByName,
236
239
  songUnplayableReason,
240
+ toGenreUuid,
237
241
  trigramSimilarity,
238
242
  useArtist,
239
243
  useArtistGenreCounts,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/genre-tree/testing.ts","../../src/genre-tree/schemas/ids.ts"],"sourcesContent":["import { GenrePlaylistUuidSchema, GenreUuidSchema, type GenrePlaylistUuid, type GenreUuid } from \"./schemas/ids\";\n\n// Test fixtures only. A readable name (\"jazz\") maps to a stable UUID, so the same name yields the same id across runs.\n// Genre and playlist names are salted apart so the two id spaces never collide.\nconst UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nfunction fnv1a(input: string, offsetBasis: number): number {\n let hash = offsetBasis;\n for (let index = 0; index < input.length; index++) {\n hash ^= input.charCodeAt(index);\n hash = Math.imul(hash, 0x01000193);\n }\n return hash >>> 0;\n}\n\nfunction nameToUuid(salt: string, name: string): string {\n const hex = [0x811c9dc5, 0x01000193, 0x5bd1e995, 0x27d4eb2f]\n .map((offsetBasis) => fnv1a(`${salt}:${name}`, offsetBasis).toString(16).padStart(8, \"0\"))\n .join(\"\");\n const variant = ((parseInt(hex[16], 16) & 0x3) | 0x8).toString(16);\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-4${hex.slice(13, 16)}-${variant}${hex.slice(17, 20)}-${hex.slice(20, 32)}`;\n}\n\nexport const makeGenreUuid = (value: string): GenreUuid =>\n GenreUuidSchema.parse(UUID_PATTERN.test(value) ? value : nameToUuid(\"genre\", value));\n\nexport const makeGenrePlaylistUuid = (value: string): GenrePlaylistUuid =>\n GenrePlaylistUuidSchema.parse(UUID_PATTERN.test(value) ? value : nameToUuid(\"genre-playlist\", value));\n","import { z } from \"zod\";\n\n// A genre (criteria) and its genre playlist are 1:1 but live in distinct UUID spaces: `genres/{uuid}/`\n// takes the former, `genre-playlists/{uuid}/` the latter. Branding makes mixing them a compile error.\nexport const GenreUuidSchema = z.string().uuid().brand<\"GenreUuid\">();\nexport const GenrePlaylistUuidSchema = z.string().uuid().brand<\"GenrePlaylistUuid\">();\n\nexport type GenreUuid = z.infer<typeof GenreUuidSchema>;\nexport type GenrePlaylistUuid = z.infer<typeof GenrePlaylistUuidSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAkB;AAIX,IAAM,kBAAkB,aAAE,OAAO,EAAE,KAAK,EAAE,MAAmB;AAC7D,IAAM,0BAA0B,aAAE,OAAO,EAAE,KAAK,EAAE,MAA2B;;;ADDpF,IAAM,eAAe;AAErB,SAAS,MAAM,OAAe,aAA6B;AACzD,MAAI,OAAO;AACX,WAAS,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS;AACjD,YAAQ,MAAM,WAAW,KAAK;AAC9B,WAAO,KAAK,KAAK,MAAM,QAAU;AAAA,EACnC;AACA,SAAO,SAAS;AAClB;AAEA,SAAS,WAAW,MAAc,MAAsB;AACtD,QAAM,MAAM,CAAC,YAAY,UAAY,YAAY,SAAU,EACxD,IAAI,CAAC,gBAAgB,MAAM,GAAG,IAAI,IAAI,IAAI,IAAI,WAAW,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,EACxF,KAAK,EAAE;AACV,QAAM,WAAY,SAAS,IAAI,EAAE,GAAG,EAAE,IAAI,IAAO,GAAK,SAAS,EAAE;AACjE,SAAO,GAAG,IAAI,MAAM,GAAG,CAAC,CAAC,IAAI,IAAI,MAAM,GAAG,EAAE,CAAC,KAAK,IAAI,MAAM,IAAI,EAAE,CAAC,IAAI,OAAO,GAAG,IAAI,MAAM,IAAI,EAAE,CAAC,IAAI,IAAI,MAAM,IAAI,EAAE,CAAC;AACzH;AAEO,IAAM,gBAAgB,CAAC,UAC5B,gBAAgB,MAAM,aAAa,KAAK,KAAK,IAAI,QAAQ,WAAW,SAAS,KAAK,CAAC;AAE9E,IAAM,wBAAwB,CAAC,UACpC,wBAAwB,MAAM,aAAa,KAAK,KAAK,IAAI,QAAQ,WAAW,kBAAkB,KAAK,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../src/genre-tree/testing.ts","../../src/genre-tree/schemas/ids.ts"],"sourcesContent":["import { GenrePlaylistUuidSchema, GenreUuidSchema, type GenrePlaylistUuid, type GenreUuid } from \"./schemas/ids\";\n\n// Test fixtures only. A readable name (\"jazz\") maps to a stable UUID, so the same name yields the same id across runs.\n// Genre and playlist names are salted apart so the two id spaces never collide.\nconst UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nfunction fnv1a(input: string, offsetBasis: number): number {\n let hash = offsetBasis;\n for (let index = 0; index < input.length; index++) {\n hash ^= input.charCodeAt(index);\n hash = Math.imul(hash, 0x01000193);\n }\n return hash >>> 0;\n}\n\nfunction nameToUuid(salt: string, name: string): string {\n const hex = [0x811c9dc5, 0x01000193, 0x5bd1e995, 0x27d4eb2f]\n .map((offsetBasis) => fnv1a(`${salt}:${name}`, offsetBasis).toString(16).padStart(8, \"0\"))\n .join(\"\");\n const variant = ((parseInt(hex[16], 16) & 0x3) | 0x8).toString(16);\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-4${hex.slice(13, 16)}-${variant}${hex.slice(17, 20)}-${hex.slice(20, 32)}`;\n}\n\nexport const makeGenreUuid = (value: string): GenreUuid =>\n GenreUuidSchema.parse(UUID_PATTERN.test(value) ? value : nameToUuid(\"genre\", value));\n\nexport const makeGenrePlaylistUuid = (value: string): GenrePlaylistUuid =>\n GenrePlaylistUuidSchema.parse(UUID_PATTERN.test(value) ? value : nameToUuid(\"genre-playlist\", value));\n","import { z } from \"zod\";\n\n// A genre (criteria) and its genre playlist are 1:1 but live in distinct UUID spaces: `genres/{uuid}/`\n// takes the former, `genre-playlists/{uuid}/` the latter. Branding makes mixing them a compile error.\nexport const GenreUuidSchema = z.string().uuid().brand<\"GenreUuid\">();\nexport const GenrePlaylistUuidSchema = z.string().uuid().brand<\"GenrePlaylistUuid\">();\n\nexport type GenreUuid = z.infer<typeof GenreUuidSchema>;\nexport type GenrePlaylistUuid = z.infer<typeof GenrePlaylistUuidSchema>;\n\n/** The id as a `GenreUuid`, or null when it is absent or malformed (e.g. a raw URL value). */\nexport function toGenreUuid(value: string | null): GenreUuid | null {\n const parsed = GenreUuidSchema.safeParse(value);\n return parsed.success ? parsed.data : null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAkB;AAIX,IAAM,kBAAkB,aAAE,OAAO,EAAE,KAAK,EAAE,MAAmB;AAC7D,IAAM,0BAA0B,aAAE,OAAO,EAAE,KAAK,EAAE,MAA2B;;;ADDpF,IAAM,eAAe;AAErB,SAAS,MAAM,OAAe,aAA6B;AACzD,MAAI,OAAO;AACX,WAAS,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS;AACjD,YAAQ,MAAM,WAAW,KAAK;AAC9B,WAAO,KAAK,KAAK,MAAM,QAAU;AAAA,EACnC;AACA,SAAO,SAAS;AAClB;AAEA,SAAS,WAAW,MAAc,MAAsB;AACtD,QAAM,MAAM,CAAC,YAAY,UAAY,YAAY,SAAU,EACxD,IAAI,CAAC,gBAAgB,MAAM,GAAG,IAAI,IAAI,IAAI,IAAI,WAAW,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,EACxF,KAAK,EAAE;AACV,QAAM,WAAY,SAAS,IAAI,EAAE,GAAG,EAAE,IAAI,IAAO,GAAK,SAAS,EAAE;AACjE,SAAO,GAAG,IAAI,MAAM,GAAG,CAAC,CAAC,IAAI,IAAI,MAAM,GAAG,EAAE,CAAC,KAAK,IAAI,MAAM,IAAI,EAAE,CAAC,IAAI,OAAO,GAAG,IAAI,MAAM,IAAI,EAAE,CAAC,IAAI,IAAI,MAAM,IAAI,EAAE,CAAC;AACzH;AAEO,IAAM,gBAAgB,CAAC,UAC5B,gBAAgB,MAAM,aAAa,KAAK,KAAK,IAAI,QAAQ,WAAW,SAAS,KAAK,CAAC;AAE9E,IAAM,wBAAwB,CAAC,UACpC,wBAAwB,MAAM,aAAa,KAAK,KAAK,IAAI,QAAQ,WAAW,kBAAkB,KAAK,CAAC;","names":[]}
@@ -1,4 +1,4 @@
1
- import { G as GenrePlaylistUuid, b as GenreUuid } from '../ids-D8XCErUS.js';
1
+ import { G as GenrePlaylistUuid, b as GenreUuid } from '../ids-D7EDBsbJ.js';
2
2
  import 'zod';
3
3
 
4
4
  declare const makeGenreUuid: (value: string) => GenreUuid;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  GenrePlaylistUuidSchema,
3
3
  GenreUuidSchema
4
- } from "../chunk-JMFEWI53.js";
4
+ } from "../chunk-X2QEQR6H.js";
5
5
 
6
6
  // src/genre-tree/testing.ts
7
7
  var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
@@ -4,5 +4,7 @@ declare const GenreUuidSchema: z.core.$ZodBranded<z.ZodString, "GenreUuid", "out
4
4
  declare const GenrePlaylistUuidSchema: z.core.$ZodBranded<z.ZodString, "GenrePlaylistUuid", "out">;
5
5
  type GenreUuid = z.infer<typeof GenreUuidSchema>;
6
6
  type GenrePlaylistUuid = z.infer<typeof GenrePlaylistUuidSchema>;
7
+ /** The id as a `GenreUuid`, or null when it is absent or malformed (e.g. a raw URL value). */
8
+ declare function toGenreUuid(value: string | null): GenreUuid | null;
7
9
 
8
- export { type GenrePlaylistUuid as G, GenrePlaylistUuidSchema as a, type GenreUuid as b, GenreUuidSchema as c };
10
+ export { type GenrePlaylistUuid as G, GenrePlaylistUuidSchema as a, type GenreUuid as b, GenreUuidSchema as c, toGenreUuid as t };