@frybynite/image-cloud 0.6.3 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{composite-CtUxtN2l.js → composite-BSJXKGwG.js} +13 -46
- package/dist/composite-BSJXKGwG.js.map +1 -0
- package/dist/{google-drive-CC-qFSV1.js → google-drive-DK2v0Xay.js} +69 -102
- package/dist/google-drive-DK2v0Xay.js.map +1 -0
- package/dist/image-cloud-CO9PMUGK.js +38 -0
- package/dist/image-cloud-CO9PMUGK.js.map +1 -0
- package/dist/image-cloud.js +1 -0
- package/dist/image-cloud.umd.js +3 -3
- package/dist/image-cloud.umd.js.map +1 -1
- package/dist/index.d.ts +29 -0
- package/dist/loaders/all.d.ts +29 -0
- package/dist/loaders/all.js +9 -42
- package/dist/loaders/all.js.map +1 -1
- package/dist/loaders/composite.d.ts +29 -0
- package/dist/loaders/composite.js +13 -46
- package/dist/loaders/composite.js.map +1 -1
- package/dist/loaders/google-drive.d.ts +29 -0
- package/dist/loaders/google-drive.js +38 -71
- package/dist/loaders/google-drive.js.map +1 -1
- package/dist/loaders/static.d.ts +29 -0
- package/dist/loaders/static.js +34 -67
- package/dist/loaders/static.js.map +1 -1
- package/dist/react.d.ts +29 -0
- package/dist/react.js +3 -3
- package/dist/static-D9YjTesh.js +186 -0
- package/dist/static-D9YjTesh.js.map +1 -0
- package/dist/vue.d.ts +29 -0
- package/dist/vue.js +3 -3
- package/dist/web-component.d.ts +29 -0
- package/dist/web-component.js +3 -3
- package/package.json +1 -1
- package/dist/composite-CtUxtN2l.js.map +0 -1
- package/dist/google-drive-CC-qFSV1.js.map +0 -1
- package/dist/static-ejylHtQ4.js +0 -219
- package/dist/static-ejylHtQ4.js.map +0 -1
package/dist/react.d.ts
CHANGED
|
@@ -1089,8 +1089,37 @@ declare interface LayoutSpacingConfig {
|
|
|
1089
1089
|
minGap: number;
|
|
1090
1090
|
}
|
|
1091
1091
|
|
|
1092
|
+
/**
|
|
1093
|
+
* Constructor signature for loader classes
|
|
1094
|
+
* Supports both simple loaders and composite loaders with their respective config types
|
|
1095
|
+
*/
|
|
1096
|
+
declare type LoaderConstructor = (new (config: StaticLoaderInnerConfig) => ImageLoader) | (new (config: GoogleDriveLoaderInnerConfig) => ImageLoader) | (new (config: any) => ImageLoader);
|
|
1097
|
+
|
|
1092
1098
|
export declare type LoaderEntry = StaticLoaderEntry | GoogleDriveLoaderEntry;
|
|
1093
1099
|
|
|
1100
|
+
export declare class LoaderRegistry {
|
|
1101
|
+
private static readonly registry;
|
|
1102
|
+
/**
|
|
1103
|
+
* Register a loader implementation with the registry
|
|
1104
|
+
* @param name - Loader identifier (e.g., 'static', 'google-drive', 'composite')
|
|
1105
|
+
* @param Loader - Loader class constructor to register
|
|
1106
|
+
*/
|
|
1107
|
+
static registerLoader(name: string, Loader: LoaderConstructor): void;
|
|
1108
|
+
/**
|
|
1109
|
+
* Get a registered loader implementation
|
|
1110
|
+
* @param name - Loader identifier
|
|
1111
|
+
* @returns Loader class constructor
|
|
1112
|
+
* @throws Error if loader is not registered
|
|
1113
|
+
*/
|
|
1114
|
+
static getLoader(name: string): LoaderConstructor;
|
|
1115
|
+
/**
|
|
1116
|
+
* Check if a loader is registered
|
|
1117
|
+
* @param name - Loader identifier
|
|
1118
|
+
* @returns True if the loader is registered, false otherwise
|
|
1119
|
+
*/
|
|
1120
|
+
static isRegistered(name: string): boolean;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1094
1123
|
declare interface NavigationInteractionConfig {
|
|
1095
1124
|
keyboard?: boolean;
|
|
1096
1125
|
swipe?: boolean;
|
package/dist/react.js
CHANGED
|
@@ -2450,7 +2450,7 @@ let Oe = class {
|
|
|
2450
2450
|
);
|
|
2451
2451
|
if (i.length === 1)
|
|
2452
2452
|
return i[0];
|
|
2453
|
-
await import("./composite-
|
|
2453
|
+
await import("./composite-BSJXKGwG.js");
|
|
2454
2454
|
const o = et.getLoader("composite");
|
|
2455
2455
|
return new o({
|
|
2456
2456
|
loaders: i,
|
|
@@ -2463,7 +2463,7 @@ let Oe = class {
|
|
|
2463
2463
|
*/
|
|
2464
2464
|
async createLoaderFromEntry(t, e) {
|
|
2465
2465
|
if ("static" in t) {
|
|
2466
|
-
await import("./static-
|
|
2466
|
+
await import("./static-D9YjTesh.js");
|
|
2467
2467
|
const i = et.getLoader("static"), o = t.static, s = {
|
|
2468
2468
|
...o,
|
|
2469
2469
|
validateUrls: o.validateUrls ?? e.validateUrls,
|
|
@@ -2474,7 +2474,7 @@ let Oe = class {
|
|
|
2474
2474
|
};
|
|
2475
2475
|
return new i(s);
|
|
2476
2476
|
} else if ("googleDrive" in t) {
|
|
2477
|
-
await import("./google-drive-
|
|
2477
|
+
await import("./google-drive-DK2v0Xay.js");
|
|
2478
2478
|
const i = et.getLoader("google-drive"), o = t.googleDrive, s = {
|
|
2479
2479
|
...o,
|
|
2480
2480
|
allowedExtensions: o.allowedExtensions ?? e.allowedExtensions,
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { e as a } from "./image-cloud-CO9PMUGK.js";
|
|
2
|
+
class n {
|
|
3
|
+
constructor(t) {
|
|
4
|
+
if (this._prepared = !1, this._discoveredUrls = [], this.validateUrls = t.validateUrls !== !1, this.validationTimeout = t.validationTimeout ?? 5e3, this.validationMethod = t.validationMethod ?? "head", this.debugLogging = t.debugLogging ?? !1, this.sources = t.sources ?? [], !this.sources || this.sources.length === 0)
|
|
5
|
+
throw new Error("StaticImageLoader requires at least one source to be configured");
|
|
6
|
+
this.log("StaticImageLoader initialized with config:", t);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Prepare the loader by discovering all images from configured sources
|
|
10
|
+
* @param filter - Filter to apply to discovered images
|
|
11
|
+
*/
|
|
12
|
+
async prepare(t) {
|
|
13
|
+
this._discoveredUrls = [], this.log(`Processing ${this.sources.length} source(s)`);
|
|
14
|
+
for (const r of this.sources)
|
|
15
|
+
try {
|
|
16
|
+
const s = await this.processSource(r, t);
|
|
17
|
+
this._discoveredUrls.push(...s);
|
|
18
|
+
} catch (s) {
|
|
19
|
+
console.warn("Failed to process source:", r, s);
|
|
20
|
+
}
|
|
21
|
+
this._prepared = !0, this.log(`Successfully loaded ${this._discoveredUrls.length} image(s)`);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get the number of discovered images
|
|
25
|
+
* @throws Error if called before prepare()
|
|
26
|
+
*/
|
|
27
|
+
imagesLength() {
|
|
28
|
+
if (!this._prepared)
|
|
29
|
+
throw new Error("StaticImageLoader.imagesLength() called before prepare()");
|
|
30
|
+
return this._discoveredUrls.length;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get the ordered list of image URLs
|
|
34
|
+
* @throws Error if called before prepare()
|
|
35
|
+
*/
|
|
36
|
+
imageURLs() {
|
|
37
|
+
if (!this._prepared)
|
|
38
|
+
throw new Error("StaticImageLoader.imageURLs() called before prepare()");
|
|
39
|
+
return [...this._discoveredUrls];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Check if the loader has been prepared
|
|
43
|
+
*/
|
|
44
|
+
isPrepared() {
|
|
45
|
+
return this._prepared;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Process a single source object using shape-based detection
|
|
49
|
+
* @param source - Source configuration detected by key presence
|
|
50
|
+
* @param filter - Filter to apply to discovered images
|
|
51
|
+
* @returns Promise resolving to array of valid URLs from this source
|
|
52
|
+
*/
|
|
53
|
+
async processSource(t, r) {
|
|
54
|
+
return t ? "urls" in t ? await this.processUrls(t.urls, r) : "path" in t ? await this.processPath(t.path, t.files, r) : "json" in t ? await this.processJson(t.json, r) : (console.warn("Unknown source shape:", t), []) : (console.warn("Invalid source object:", t), []);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Process a list of direct URLs
|
|
58
|
+
* @param urls - Array of image URLs
|
|
59
|
+
* @param filter - Filter to apply to discovered images
|
|
60
|
+
* @returns Promise resolving to array of validated URLs
|
|
61
|
+
*/
|
|
62
|
+
async processUrls(t, r) {
|
|
63
|
+
if (!Array.isArray(t))
|
|
64
|
+
return console.warn("URLs must be an array:", t), [];
|
|
65
|
+
const s = [];
|
|
66
|
+
for (const i of t) {
|
|
67
|
+
const o = i.split("/").pop() || i;
|
|
68
|
+
if (!r.isAllowed(o)) {
|
|
69
|
+
this.log(`Skipping filtered URL: ${i}`);
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
this.validateUrls ? await this.validateUrl(i) ? s.push(i) : console.warn(`Skipping invalid/missing URL: ${i}`) : s.push(i);
|
|
73
|
+
}
|
|
74
|
+
return s;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Process a path-based source
|
|
78
|
+
* @param basePath - Base path (relative or absolute)
|
|
79
|
+
* @param files - Array of filenames
|
|
80
|
+
* @param filter - Filter to apply to discovered images
|
|
81
|
+
* @returns Promise resolving to array of validated URLs
|
|
82
|
+
*/
|
|
83
|
+
async processPath(t, r, s) {
|
|
84
|
+
if (!Array.isArray(r))
|
|
85
|
+
return console.warn("files must be an array:", r), [];
|
|
86
|
+
const i = [];
|
|
87
|
+
for (const o of r) {
|
|
88
|
+
if (!s.isAllowed(o)) {
|
|
89
|
+
this.log(`Skipping filtered file: ${o}`);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const e = this.constructUrl(t, o);
|
|
93
|
+
this.validateUrls ? await this.validateUrl(e) ? i.push(e) : console.warn(`Skipping invalid/missing file: ${e}`) : i.push(e);
|
|
94
|
+
}
|
|
95
|
+
return i;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Process a JSON endpoint source
|
|
99
|
+
* Fetches a JSON endpoint that returns { images: string[] }
|
|
100
|
+
* @param url - JSON endpoint URL
|
|
101
|
+
* @param filter - Filter to apply to discovered images
|
|
102
|
+
* @returns Promise resolving to array of validated URLs
|
|
103
|
+
*/
|
|
104
|
+
async processJson(t, r) {
|
|
105
|
+
this.log(`Fetching JSON endpoint: ${t}`);
|
|
106
|
+
const s = new AbortController(), i = setTimeout(() => s.abort(), 1e4);
|
|
107
|
+
try {
|
|
108
|
+
const o = await fetch(t, { signal: s.signal });
|
|
109
|
+
if (clearTimeout(i), !o.ok)
|
|
110
|
+
throw new Error(`HTTP ${o.status} fetching ${t}`);
|
|
111
|
+
const e = await o.json();
|
|
112
|
+
if (!e || !Array.isArray(e.images))
|
|
113
|
+
throw new Error('JSON source must return JSON with shape { "images": ["url1", "url2", ...] }');
|
|
114
|
+
return this.log(`JSON endpoint returned ${e.images.length} image(s)`), await this.processUrls(e.images, r);
|
|
115
|
+
} catch (o) {
|
|
116
|
+
throw clearTimeout(i), o instanceof Error && o.name === "AbortError" ? new Error(`Timeout fetching JSON endpoint: ${t}`) : o;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Validate a single URL using HEAD request
|
|
121
|
+
* @param url - URL to validate
|
|
122
|
+
* @returns Promise resolving to true if valid and accessible
|
|
123
|
+
*/
|
|
124
|
+
async validateUrl(t) {
|
|
125
|
+
if (this.validationMethod === "none")
|
|
126
|
+
return !0;
|
|
127
|
+
if (this.validationMethod === "simple")
|
|
128
|
+
try {
|
|
129
|
+
return typeof window < "u" ? new URL(t, window.location.origin) : new URL(t), !0;
|
|
130
|
+
} catch {
|
|
131
|
+
return !1;
|
|
132
|
+
}
|
|
133
|
+
if (typeof window > "u")
|
|
134
|
+
return !0;
|
|
135
|
+
if (!(t.startsWith(window.location.origin) || t.startsWith("/")))
|
|
136
|
+
return this.log(`Skipping validation for cross-origin URL: ${t}`), !0;
|
|
137
|
+
try {
|
|
138
|
+
const r = new AbortController(), s = setTimeout(() => r.abort(), this.validationTimeout), i = await fetch(t, {
|
|
139
|
+
method: "HEAD",
|
|
140
|
+
signal: r.signal
|
|
141
|
+
});
|
|
142
|
+
return clearTimeout(s), i.ok ? !0 : (this.log(`Validation failed for ${t}: HTTP ${i.status}`), !1);
|
|
143
|
+
} catch (r) {
|
|
144
|
+
return r instanceof Error && (r.name === "AbortError" ? this.log(`Validation timeout for ${t}`) : this.log(`Validation failed for ${t}:`, r.message)), !1;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Construct full URL from basePath and filename
|
|
149
|
+
* @param basePath - Base path (relative or absolute)
|
|
150
|
+
* @param filename - Filename to append
|
|
151
|
+
* @returns Complete URL
|
|
152
|
+
*/
|
|
153
|
+
constructUrl(t, r) {
|
|
154
|
+
const s = t.replace(/\/$/, "");
|
|
155
|
+
if (this.isAbsoluteUrl(t))
|
|
156
|
+
return `${s}/${r}`;
|
|
157
|
+
if (typeof window > "u")
|
|
158
|
+
return `${s}/${r}`;
|
|
159
|
+
const i = window.location.origin, o = (t.startsWith("/") ? t : "/" + t).replace(/\/$/, "");
|
|
160
|
+
return `${i}${o}/${r}`;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Check if URL is absolute (contains protocol)
|
|
164
|
+
* @param url - URL to check
|
|
165
|
+
* @returns True if absolute URL
|
|
166
|
+
*/
|
|
167
|
+
isAbsoluteUrl(t) {
|
|
168
|
+
try {
|
|
169
|
+
return new URL(t), !0;
|
|
170
|
+
} catch {
|
|
171
|
+
return !1;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Debug logging helper
|
|
176
|
+
* @param args - Arguments to log
|
|
177
|
+
*/
|
|
178
|
+
log(...t) {
|
|
179
|
+
this.debugLogging && typeof console < "u" && console.log(...t);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
a.registerLoader("static", n);
|
|
183
|
+
export {
|
|
184
|
+
n as StaticImageLoader
|
|
185
|
+
};
|
|
186
|
+
//# sourceMappingURL=static-D9YjTesh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static-D9YjTesh.js","sources":["loaders/static.js"],"sourcesContent":["import { LoaderRegistry as n } from \"@frybynite/image-cloud\";\nclass a {\n constructor(e) {\n if (this._prepared = !1, this._discoveredUrls = [], this.validateUrls = e.validateUrls !== !1, this.validationTimeout = e.validationTimeout ?? 5e3, this.validationMethod = e.validationMethod ?? \"head\", this.debugLogging = e.debugLogging ?? !1, this.sources = e.sources ?? [], !this.sources || this.sources.length === 0)\n throw new Error(\"StaticImageLoader requires at least one source to be configured\");\n this.log(\"StaticImageLoader initialized with config:\", e);\n }\n /**\n * Prepare the loader by discovering all images from configured sources\n * @param filter - Filter to apply to discovered images\n */\n async prepare(e) {\n this._discoveredUrls = [], this.log(`Processing ${this.sources.length} source(s)`);\n for (const r of this.sources)\n try {\n const t = await this.processSource(r, e);\n this._discoveredUrls.push(...t);\n } catch (t) {\n console.warn(\"Failed to process source:\", r, t);\n }\n this._prepared = !0, this.log(`Successfully loaded ${this._discoveredUrls.length} image(s)`);\n }\n /**\n * Get the number of discovered images\n * @throws Error if called before prepare()\n */\n imagesLength() {\n if (!this._prepared)\n throw new Error(\"StaticImageLoader.imagesLength() called before prepare()\");\n return this._discoveredUrls.length;\n }\n /**\n * Get the ordered list of image URLs\n * @throws Error if called before prepare()\n */\n imageURLs() {\n if (!this._prepared)\n throw new Error(\"StaticImageLoader.imageURLs() called before prepare()\");\n return [...this._discoveredUrls];\n }\n /**\n * Check if the loader has been prepared\n */\n isPrepared() {\n return this._prepared;\n }\n /**\n * Process a single source object using shape-based detection\n * @param source - Source configuration detected by key presence\n * @param filter - Filter to apply to discovered images\n * @returns Promise resolving to array of valid URLs from this source\n */\n async processSource(e, r) {\n return e ? \"urls\" in e ? await this.processUrls(e.urls, r) : \"path\" in e ? await this.processPath(e.path, e.files, r) : \"json\" in e ? await this.processJson(e.json, r) : (console.warn(\"Unknown source shape:\", e), []) : (console.warn(\"Invalid source object:\", e), []);\n }\n /**\n * Process a list of direct URLs\n * @param urls - Array of image URLs\n * @param filter - Filter to apply to discovered images\n * @returns Promise resolving to array of validated URLs\n */\n async processUrls(e, r) {\n if (!Array.isArray(e))\n return console.warn(\"URLs must be an array:\", e), [];\n const t = [];\n for (const i of e) {\n const s = i.split(\"/\").pop() || i;\n if (!r.isAllowed(s)) {\n this.log(`Skipping filtered URL: ${i}`);\n continue;\n }\n this.validateUrls ? await this.validateUrl(i) ? t.push(i) : console.warn(`Skipping invalid/missing URL: ${i}`) : t.push(i);\n }\n return t;\n }\n /**\n * Process a path-based source\n * @param basePath - Base path (relative or absolute)\n * @param files - Array of filenames\n * @param filter - Filter to apply to discovered images\n * @returns Promise resolving to array of validated URLs\n */\n async processPath(e, r, t) {\n if (!Array.isArray(r))\n return console.warn(\"files must be an array:\", r), [];\n const i = [];\n for (const s of r) {\n if (!t.isAllowed(s)) {\n this.log(`Skipping filtered file: ${s}`);\n continue;\n }\n const o = this.constructUrl(e, s);\n this.validateUrls ? await this.validateUrl(o) ? i.push(o) : console.warn(`Skipping invalid/missing file: ${o}`) : i.push(o);\n }\n return i;\n }\n /**\n * Process a JSON endpoint source\n * Fetches a JSON endpoint that returns { images: string[] }\n * @param url - JSON endpoint URL\n * @param filter - Filter to apply to discovered images\n * @returns Promise resolving to array of validated URLs\n */\n async processJson(e, r) {\n this.log(`Fetching JSON endpoint: ${e}`);\n const t = new AbortController(), i = setTimeout(() => t.abort(), 1e4);\n try {\n const s = await fetch(e, { signal: t.signal });\n if (clearTimeout(i), !s.ok)\n throw new Error(`HTTP ${s.status} fetching ${e}`);\n const o = await s.json();\n if (!o || !Array.isArray(o.images))\n throw new Error('JSON source must return JSON with shape { \"images\": [\"url1\", \"url2\", ...] }');\n return this.log(`JSON endpoint returned ${o.images.length} image(s)`), await this.processUrls(o.images, r);\n } catch (s) {\n throw clearTimeout(i), s instanceof Error && s.name === \"AbortError\" ? new Error(`Timeout fetching JSON endpoint: ${e}`) : s;\n }\n }\n /**\n * Validate a single URL using HEAD request\n * @param url - URL to validate\n * @returns Promise resolving to true if valid and accessible\n */\n async validateUrl(e) {\n if (this.validationMethod === \"none\")\n return !0;\n if (this.validationMethod === \"simple\")\n try {\n return typeof window < \"u\" ? new URL(e, window.location.origin) : new URL(e), !0;\n } catch {\n return !1;\n }\n if (typeof window > \"u\")\n return !0;\n if (!(e.startsWith(window.location.origin) || e.startsWith(\"/\")))\n return this.log(`Skipping validation for cross-origin URL: ${e}`), !0;\n try {\n const t = new AbortController(), i = setTimeout(() => t.abort(), this.validationTimeout), s = await fetch(e, {\n method: \"HEAD\",\n signal: t.signal\n });\n return clearTimeout(i), s.ok ? !0 : (this.log(`Validation failed for ${e}: HTTP ${s.status}`), !1);\n } catch (t) {\n return t instanceof Error && (t.name === \"AbortError\" ? this.log(`Validation timeout for ${e}`) : this.log(`Validation failed for ${e}:`, t.message)), !1;\n }\n }\n /**\n * Construct full URL from basePath and filename\n * @param basePath - Base path (relative or absolute)\n * @param filename - Filename to append\n * @returns Complete URL\n */\n constructUrl(e, r) {\n const t = e.replace(/\\/$/, \"\");\n if (this.isAbsoluteUrl(e))\n return `${t}/${r}`;\n if (typeof window > \"u\")\n return `${t}/${r}`;\n const i = window.location.origin, o = (e.startsWith(\"/\") ? e : \"/\" + e).replace(/\\/$/, \"\");\n return `${i}${o}/${r}`;\n }\n /**\n * Check if URL is absolute (contains protocol)\n * @param url - URL to check\n * @returns True if absolute URL\n */\n isAbsoluteUrl(e) {\n try {\n return new URL(e), !0;\n } catch {\n return !1;\n }\n }\n /**\n * Debug logging helper\n * @param args - Arguments to log\n */\n log(...e) {\n this.debugLogging && typeof console < \"u\" && console.log(...e);\n }\n}\nn.registerLoader(\"static\", a);\nexport {\n a as StaticImageLoader\n};\n//# sourceMappingURL=static.js.map\n"],"names":["a","e","t","s","o","i","n"],"mappings":";AACA,MAAMA,EAAE;AAAA,EACN,YAAYC,GAAG;AACb,QAAI,KAAK,YAAY,IAAI,KAAK,kBAAkB,CAAA,GAAI,KAAK,eAAeA,EAAE,iBAAiB,IAAI,KAAK,oBAAoBA,EAAE,qBAAqB,KAAK,KAAK,mBAAmBA,EAAE,oBAAoB,QAAQ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|
|
|
1092
|
+
/**
|
|
1093
|
+
* Constructor signature for loader classes
|
|
1094
|
+
* Supports both simple loaders and composite loaders with their respective config types
|
|
1095
|
+
*/
|
|
1096
|
+
declare type LoaderConstructor = (new (config: StaticLoaderInnerConfig) => ImageLoader) | (new (config: GoogleDriveLoaderInnerConfig) => ImageLoader) | (new (config: any) => ImageLoader);
|
|
1097
|
+
|
|
1092
1098
|
export declare type LoaderEntry = StaticLoaderEntry | GoogleDriveLoaderEntry;
|
|
1093
1099
|
|
|
1100
|
+
export declare class LoaderRegistry {
|
|
1101
|
+
private static readonly registry;
|
|
1102
|
+
/**
|
|
1103
|
+
* Register a loader implementation with the registry
|
|
1104
|
+
* @param name - Loader identifier (e.g., 'static', 'google-drive', 'composite')
|
|
1105
|
+
* @param Loader - Loader class constructor to register
|
|
1106
|
+
*/
|
|
1107
|
+
static registerLoader(name: string, Loader: LoaderConstructor): void;
|
|
1108
|
+
/**
|
|
1109
|
+
* Get a registered loader implementation
|
|
1110
|
+
* @param name - Loader identifier
|
|
1111
|
+
* @returns Loader class constructor
|
|
1112
|
+
* @throws Error if loader is not registered
|
|
1113
|
+
*/
|
|
1114
|
+
static getLoader(name: string): LoaderConstructor;
|
|
1115
|
+
/**
|
|
1116
|
+
* Check if a loader is registered
|
|
1117
|
+
* @param name - Loader identifier
|
|
1118
|
+
* @returns True if the loader is registered, false otherwise
|
|
1119
|
+
*/
|
|
1120
|
+
static isRegistered(name: string): boolean;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1094
1123
|
declare interface NavigationInteractionConfig {
|
|
1095
1124
|
keyboard?: boolean;
|
|
1096
1125
|
swipe?: boolean;
|
package/dist/vue.js
CHANGED
|
@@ -2449,7 +2449,7 @@ let $e = class {
|
|
|
2449
2449
|
);
|
|
2450
2450
|
if (i.length === 1)
|
|
2451
2451
|
return i[0];
|
|
2452
|
-
await import("./composite-
|
|
2452
|
+
await import("./composite-BSJXKGwG.js");
|
|
2453
2453
|
const o = et.getLoader("composite");
|
|
2454
2454
|
return new o({
|
|
2455
2455
|
loaders: i,
|
|
@@ -2462,7 +2462,7 @@ let $e = class {
|
|
|
2462
2462
|
*/
|
|
2463
2463
|
async createLoaderFromEntry(t, e) {
|
|
2464
2464
|
if ("static" in t) {
|
|
2465
|
-
await import("./static-
|
|
2465
|
+
await import("./static-D9YjTesh.js");
|
|
2466
2466
|
const i = et.getLoader("static"), o = t.static, s = {
|
|
2467
2467
|
...o,
|
|
2468
2468
|
validateUrls: o.validateUrls ?? e.validateUrls,
|
|
@@ -2473,7 +2473,7 @@ let $e = class {
|
|
|
2473
2473
|
};
|
|
2474
2474
|
return new i(s);
|
|
2475
2475
|
} else if ("googleDrive" in t) {
|
|
2476
|
-
await import("./google-drive-
|
|
2476
|
+
await import("./google-drive-DK2v0Xay.js");
|
|
2477
2477
|
const i = et.getLoader("google-drive"), o = t.googleDrive, s = {
|
|
2478
2478
|
...o,
|
|
2479
2479
|
allowedExtensions: o.allowedExtensions ?? e.allowedExtensions,
|
package/dist/web-component.d.ts
CHANGED
|
@@ -1089,8 +1089,37 @@ declare interface LayoutSpacingConfig {
|
|
|
1089
1089
|
minGap: number;
|
|
1090
1090
|
}
|
|
1091
1091
|
|
|
1092
|
+
/**
|
|
1093
|
+
* Constructor signature for loader classes
|
|
1094
|
+
* Supports both simple loaders and composite loaders with their respective config types
|
|
1095
|
+
*/
|
|
1096
|
+
declare type LoaderConstructor = (new (config: StaticLoaderInnerConfig) => ImageLoader) | (new (config: GoogleDriveLoaderInnerConfig) => ImageLoader) | (new (config: any) => ImageLoader);
|
|
1097
|
+
|
|
1092
1098
|
export declare type LoaderEntry = StaticLoaderEntry | GoogleDriveLoaderEntry;
|
|
1093
1099
|
|
|
1100
|
+
export declare class LoaderRegistry {
|
|
1101
|
+
private static readonly registry;
|
|
1102
|
+
/**
|
|
1103
|
+
* Register a loader implementation with the registry
|
|
1104
|
+
* @param name - Loader identifier (e.g., 'static', 'google-drive', 'composite')
|
|
1105
|
+
* @param Loader - Loader class constructor to register
|
|
1106
|
+
*/
|
|
1107
|
+
static registerLoader(name: string, Loader: LoaderConstructor): void;
|
|
1108
|
+
/**
|
|
1109
|
+
* Get a registered loader implementation
|
|
1110
|
+
* @param name - Loader identifier
|
|
1111
|
+
* @returns Loader class constructor
|
|
1112
|
+
* @throws Error if loader is not registered
|
|
1113
|
+
*/
|
|
1114
|
+
static getLoader(name: string): LoaderConstructor;
|
|
1115
|
+
/**
|
|
1116
|
+
* Check if a loader is registered
|
|
1117
|
+
* @param name - Loader identifier
|
|
1118
|
+
* @returns True if the loader is registered, false otherwise
|
|
1119
|
+
*/
|
|
1120
|
+
static isRegistered(name: string): boolean;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1094
1123
|
declare interface NavigationInteractionConfig {
|
|
1095
1124
|
keyboard?: boolean;
|
|
1096
1125
|
swipe?: boolean;
|
package/dist/web-component.js
CHANGED
|
@@ -2448,7 +2448,7 @@ class Fe {
|
|
|
2448
2448
|
);
|
|
2449
2449
|
if (i.length === 1)
|
|
2450
2450
|
return i[0];
|
|
2451
|
-
await import("./composite-
|
|
2451
|
+
await import("./composite-BSJXKGwG.js");
|
|
2452
2452
|
const o = et.getLoader("composite");
|
|
2453
2453
|
return new o({
|
|
2454
2454
|
loaders: i,
|
|
@@ -2461,7 +2461,7 @@ class Fe {
|
|
|
2461
2461
|
*/
|
|
2462
2462
|
async createLoaderFromEntry(t, e) {
|
|
2463
2463
|
if ("static" in t) {
|
|
2464
|
-
await import("./static-
|
|
2464
|
+
await import("./static-D9YjTesh.js");
|
|
2465
2465
|
const i = et.getLoader("static"), o = t.static, s = {
|
|
2466
2466
|
...o,
|
|
2467
2467
|
validateUrls: o.validateUrls ?? e.validateUrls,
|
|
@@ -2472,7 +2472,7 @@ class Fe {
|
|
|
2472
2472
|
};
|
|
2473
2473
|
return new i(s);
|
|
2474
2474
|
} else if ("googleDrive" in t) {
|
|
2475
|
-
await import("./google-drive-
|
|
2475
|
+
await import("./google-drive-DK2v0Xay.js");
|
|
2476
2476
|
const i = et.getLoader("google-drive"), o = t.googleDrive, s = {
|
|
2477
2477
|
...o,
|
|
2478
2478
|
allowedExtensions: o.allowedExtensions ?? e.allowedExtensions,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frybynite/image-cloud",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "Javascript/TypeScript image cloud library with custom loaders, various layouts, full images styling, with animation and zoom effects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/image-cloud.umd.js",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"composite-CtUxtN2l.js","sources":["loaders/composite.js"],"sourcesContent":["const s = class s {\n /**\n * Register a loader implementation with the registry\n * @param name - Loader identifier (e.g., 'static', 'google-drive', 'composite')\n * @param Loader - Loader class constructor to register\n */\n static registerLoader(e, r) {\n s.registry.set(e, r);\n }\n /**\n * Get a registered loader implementation\n * @param name - Loader identifier\n * @returns Loader class constructor\n * @throws Error if loader is not registered\n */\n static getLoader(e) {\n const r = s.registry.get(e);\n if (!r)\n throw new Error(\n `Loader \"${e}\" is not registered. Import \"@frybynite/image-cloud/loaders/${e}\" or \"@frybynite/image-cloud/loaders/all\".`\n );\n return r;\n }\n /**\n * Check if a loader is registered\n * @param name - Loader identifier\n * @returns True if the loader is registered, false otherwise\n */\n static isRegistered(e) {\n return s.registry.has(e);\n }\n};\ns.registry = /* @__PURE__ */ new Map();\nlet i = s;\nclass d {\n constructor(e) {\n if (this._prepared = !1, this._discoveredUrls = [], this.loaders = e.loaders, this.debugLogging = e.debugLogging ?? !1, !this.loaders || this.loaders.length === 0)\n throw new Error(\"CompositeLoader requires at least one loader to be configured\");\n this.log(`CompositeLoader initialized with ${this.loaders.length} loader(s)`);\n }\n /**\n * Prepare all loaders in parallel and combine their results\n * @param filter - Filter to apply to discovered images\n */\n async prepare(e) {\n this._discoveredUrls = [], this.log(`Preparing ${this.loaders.length} loader(s) in parallel`);\n const r = this.loaders.map((t, o) => t.prepare(e).then(() => {\n this.log(`Loader ${o} prepared with ${t.imagesLength()} images`);\n }).catch((a) => {\n console.warn(`Loader ${o} failed to prepare:`, a);\n }));\n await Promise.all(r);\n for (const t of this.loaders)\n if (t.isPrepared()) {\n const o = t.imageURLs();\n this._discoveredUrls.push(...o);\n }\n this._prepared = !0, this.log(`CompositeLoader prepared with ${this._discoveredUrls.length} total images`);\n }\n /**\n * Get the combined number of discovered images\n * @throws Error if called before prepare()\n */\n imagesLength() {\n if (!this._prepared)\n throw new Error(\"CompositeLoader.imagesLength() called before prepare()\");\n return this._discoveredUrls.length;\n }\n /**\n * Get the combined ordered list of image URLs\n * @throws Error if called before prepare()\n */\n imageURLs() {\n if (!this._prepared)\n throw new Error(\"CompositeLoader.imageURLs() called before prepare()\");\n return [...this._discoveredUrls];\n }\n /**\n * Check if the loader has been prepared\n */\n isPrepared() {\n return this._prepared;\n }\n /**\n * Debug logging helper\n * @param args - Arguments to log\n */\n log(...e) {\n this.debugLogging && typeof console < \"u\" && console.log(\"[CompositeLoader]\", ...e);\n }\n}\ni.registerLoader(\"composite\", d);\nexport {\n d as CompositeLoader\n};\n//# sourceMappingURL=composite.js.map\n"],"names":["s","i","d","t"],"mappings":"AAAA,MAAMA,IAAI,MAAMA,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMhB,OAAO,eAAe,GAAG,GAAG;AAC1B,IAAAA,EAAE,SAAS,IAAI,GAAG,CAAC;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,UAAU,GAAG;AAClB,UAAM,IAAIA,EAAE,SAAS,IAAI,CAAC;AAC1B,QAAI,CAAC;AACH,YAAM,IAAI;AAAA,QACR,WAAW,CAAC,+DAA+D,CAAC;AAAA,MACpF;AACI,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,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;AACV,QAAI,CAAC,KAAK;AACR,YAAM,IAAI,MAAM,qDAAqD;AACvE,WAAO,CAAC,GAAG,KAAK,eAAe;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA,EAIA,aAAa;AACX,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,GAAG;AACR,SAAK,gBAAgB,OAAO,UAAU,OAAO,QAAQ,IAAI,qBAAqB,GAAG,CAAC;AAAA,EACpF;AACF;AACAF,EAAE,eAAe,aAAaC,CAAC;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"google-drive-CC-qFSV1.js","sources":["loaders/google-drive.js"],"sourcesContent":["const h = class h {\n /**\n * Register a loader implementation with the registry\n * @param name - Loader identifier (e.g., 'static', 'google-drive', 'composite')\n * @param Loader - Loader class constructor to register\n */\n static registerLoader(e, s) {\n h.registry.set(e, s);\n }\n /**\n * Get a registered loader implementation\n * @param name - Loader identifier\n * @returns Loader class constructor\n * @throws Error if loader is not registered\n */\n static getLoader(e) {\n const s = h.registry.get(e);\n if (!s)\n throw new Error(\n `Loader \"${e}\" is not registered. Import \"@frybynite/image-cloud/loaders/${e}\" or \"@frybynite/image-cloud/loaders/all\".`\n );\n return s;\n }\n /**\n * Check if a loader is registered\n * @param name - Loader identifier\n * @returns True if the loader is registered, false otherwise\n */\n static isRegistered(e) {\n return h.registry.has(e);\n }\n};\nh.registry = /* @__PURE__ */ new Map();\nlet g = h;\nclass f {\n constructor(e) {\n if (this._prepared = !1, this._discoveredUrls = [], this.apiKey = e.apiKey ?? \"\", this.apiEndpoint = e.apiEndpoint ?? \"https://www.googleapis.com/drive/v3/files\", this.debugLogging = e.debugLogging ?? !1, this.sources = e.sources ?? [], !this.sources || this.sources.length === 0)\n throw new Error(\"GoogleDriveLoader requires at least one source to be configured\");\n }\n /**\n * Prepare the loader by discovering all images from configured sources\n * @param filter - Filter to apply to discovered images\n */\n async prepare(e) {\n this._discoveredUrls = [];\n for (const s of this.sources)\n if (\"folders\" in s)\n for (const r of s.folders) {\n const t = s.recursive !== void 0 ? s.recursive : !0, o = await this.loadFromFolder(r, e, t);\n this._discoveredUrls.push(...o);\n }\n else if (\"files\" in s) {\n const r = await this.loadFiles(s.files, e);\n this._discoveredUrls.push(...r);\n }\n this._prepared = !0;\n }\n /**\n * Get the number of discovered images\n * @throws Error if called before prepare()\n */\n imagesLength() {\n if (!this._prepared)\n throw new Error(\"GoogleDriveLoader.imagesLength() called before prepare()\");\n return this._discoveredUrls.length;\n }\n /**\n * Get the ordered list of image URLs\n * @throws Error if called before prepare()\n */\n imageURLs() {\n if (!this._prepared)\n throw new Error(\"GoogleDriveLoader.imageURLs() called before prepare()\");\n return [...this._discoveredUrls];\n }\n /**\n * Check if the loader has been prepared\n */\n isPrepared() {\n return this._prepared;\n }\n /**\n * Extract folder ID from various Google Drive URL formats\n * @param folderUrl - Google Drive folder URL\n * @returns Folder ID or null if invalid\n */\n extractFolderId(e) {\n const s = [\n /\\/folders\\/([a-zA-Z0-9_-]+)/,\n // Standard format\n /id=([a-zA-Z0-9_-]+)/\n // Alternative format\n ];\n for (const r of s) {\n const t = e.match(r);\n if (t && t[1])\n return t[1];\n }\n return null;\n }\n /**\n * Load images from a Google Drive folder\n * @param folderUrl - Google Drive folder URL\n * @param filter - Filter to apply to discovered images\n * @param recursive - Whether to include images from subfolders\n * @returns Promise resolving to array of image URLs\n */\n async loadFromFolder(e, s, r = !0) {\n const t = this.extractFolderId(e);\n if (!t)\n throw new Error(\"Invalid Google Drive folder URL. Please check the URL format.\");\n if (!this.apiKey || this.apiKey === \"YOUR_API_KEY_HERE\")\n return this.loadImagesDirectly(t, s);\n try {\n return r ? await this.loadImagesRecursively(t, s) : await this.loadImagesFromSingleFolder(t, s);\n } catch (o) {\n return console.error(\"Error loading from Google Drive API:\", o), this.loadImagesDirectly(t, s);\n }\n }\n /**\n * Load images from a single folder (non-recursive)\n * @param folderId - Google Drive folder ID\n * @param filter - Filter to apply to discovered images\n * @returns Promise resolving to array of image URLs\n */\n async loadImagesFromSingleFolder(e, s) {\n const r = [], t = `'${e}' in parents and trashed=false`, d = `${this.apiEndpoint}?q=${encodeURIComponent(t)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, i = await fetch(d);\n if (!i.ok)\n throw new Error(`API request failed: ${i.status} ${i.statusText}`);\n const c = (await i.json()).files.filter(\n (l) => l.mimeType.startsWith(\"image/\") && s.isAllowed(l.name)\n );\n return this.log(`Found ${c.length} images in folder ${e} (non-recursive)`), c.forEach((l) => {\n r.push(`https://lh3.googleusercontent.com/d/${l.id}=s1600`), this.log(`Added file: ${l.name}`);\n }), r;\n }\n /**\n * Load specific files by their URLs or IDs\n * @param fileUrls - Array of Google Drive file URLs or IDs\n * @param filter - Filter to apply to discovered images\n * @returns Promise resolving to array of image URLs\n */\n async loadFiles(e, s) {\n const r = [];\n for (const t of e) {\n const o = this.extractFileId(t);\n if (!o) {\n this.log(`Skipping invalid file URL: ${t}`);\n continue;\n }\n if (this.apiKey && this.apiKey !== \"YOUR_API_KEY_HERE\")\n try {\n const d = `${this.apiEndpoint}/${o}?fields=name,mimeType&key=${this.apiKey}`, i = await fetch(d);\n if (i.ok) {\n const n = await i.json();\n n.mimeType.startsWith(\"image/\") && s.isAllowed(n.name) ? (r.push(`https://lh3.googleusercontent.com/d/${o}=s1600`), this.log(`Added file: ${n.name}`)) : this.log(`Skipping non-image file: ${n.name} (${n.mimeType})`);\n } else\n this.log(`Failed to fetch metadata for file ${o}: ${i.status}`);\n } catch (d) {\n this.log(`Error fetching metadata for file ${o}:`, d);\n }\n else\n r.push(`https://lh3.googleusercontent.com/d/${o}=s1600`);\n }\n return r;\n }\n /**\n * Extract file ID from Google Drive file URL\n * @param fileUrl - Google Drive file URL or file ID\n * @returns File ID or null if invalid\n */\n extractFileId(e) {\n if (!/[/:.]/.test(e))\n return e;\n const s = [\n /\\/file\\/d\\/([a-zA-Z0-9_-]+)/,\n // Standard file format\n /\\/open\\?id=([a-zA-Z0-9_-]+)/,\n // Alternative format\n /id=([a-zA-Z0-9_-]+)/\n // Generic id parameter\n ];\n for (const r of s) {\n const t = e.match(r);\n if (t && t[1])\n return t[1];\n }\n return null;\n }\n /**\n * Recursively load images from a folder and all its subfolders\n * @param folderId - Google Drive folder ID\n * @param filter - Filter to apply to discovered images\n * @returns Promise resolving to array of image URLs\n */\n async loadImagesRecursively(e, s) {\n const r = [], t = `'${e}' in parents and trashed=false`, d = `${this.apiEndpoint}?q=${encodeURIComponent(t)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, i = await fetch(d);\n if (!i.ok)\n throw new Error(`API request failed: ${i.status} ${i.statusText}`);\n const n = await i.json(), c = n.files.filter(\n (a) => a.mimeType.startsWith(\"image/\") && s.isAllowed(a.name)\n ), l = n.files.filter(\n (a) => a.mimeType === \"application/vnd.google-apps.folder\"\n );\n this.log(`Found ${n.files.length} total items in folder ${e}`), n.files.forEach((a) => this.log(` - File: ${a.name} (${a.mimeType})`)), this.log(`- ${c.length} valid files (images only)`), this.log(`- ${l.length} subfolders`), c.forEach((a) => {\n r.push(`https://lh3.googleusercontent.com/d/${a.id}=s1600`), this.log(`Added file: ${a.name}`);\n });\n for (const a of l) {\n this.log(`Loading images from subfolder: ${a.name}`);\n const m = await this.loadImagesRecursively(a.id, s);\n r.push(...m);\n }\n return r;\n }\n /**\n * Direct loading method (no API key required, but less reliable)\n * Uses embedded folder view to scrape image IDs\n * @param folderId - Google Drive folder ID\n * @param filter - Filter to apply (not used in fallback mode)\n * @returns Promise resolving to array of image URLs\n */\n async loadImagesDirectly(e, s) {\n try {\n const r = `https://drive.google.com/embeddedfolderview?id=${e}`, t = await fetch(r, { mode: \"cors\" });\n if (!t.ok)\n throw new Error(\"Cannot access folder directly (CORS or permissions issue)\");\n const o = await t.text(), d = /\\/file\\/d\\/([a-zA-Z0-9_-]+)/g, i = [...o.matchAll(d)];\n return [...new Set(i.map((l) => l[1]))].map(\n (l) => `https://drive.google.com/uc?export=view&id=${l}`\n );\n } catch (r) {\n throw console.error(\"Direct loading failed:\", r), new Error(\n `Unable to load images. Please ensure:\n1. The folder is shared publicly (Anyone with the link can view)\n2. The folder contains image files\n3. Consider adding a Google Drive API key in config.js for better reliability`\n );\n }\n }\n /**\n * Manually add image URLs (for testing or when auto-loading fails)\n * @param imageIds - Array of Google Drive file IDs\n * @returns Array of direct image URLs\n */\n manualImageUrls(e) {\n return e.map((s) => `https://drive.google.com/uc?export=view&id=${s}`);\n }\n /**\n * Debug logging helper\n * @param args - Arguments to log\n */\n log(...e) {\n this.debugLogging && typeof console < \"u\" && console.log(...e);\n }\n}\ng.registerLoader(\"google-drive\", f);\nexport {\n f as GoogleDriveLoader\n};\n//# sourceMappingURL=google-drive.js.map\n"],"names":["h","s","g","f","t","o","d","i","c","l","n","a","m"],"mappings":"AAAA,MAAM,IAAI,MAAMA,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMhB,OAAO,eAAe,GAAGC,GAAG;AAC1B,IAAAD,EAAE,SAAS,IAAI,GAAGC,CAAC;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,UAAU,GAAG;AAClB,UAAMA,IAAID,EAAE,SAAS,IAAI,CAAC;AAC1B,QAAI,CAACC;AACH,YAAM,IAAI;AAAA,QACR,WAAW,CAAC,+DAA+D,CAAC;AAAA,MACpF;AACI,WAAOA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAO,aAAa,GAAG;AACrB,WAAOD,EAAE,SAAS,IAAI,CAAC;AAAA,EACzB;AACF;AACA,EAAE,WAA2B,oBAAI,IAAG;AACpC,IAAIE,IAAI;AACR,MAAMC,EAAE;AAAA,EACN,YAAY,GAAG;AACb,QAAI,KAAK,YAAY,IAAI,KAAK,kBAAkB,CAAA,GAAI,KAAK,SAAS,EAAE,UAAU,IAAI,KAAK,cAAc,EAAE,eAAe,6CAA6C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