lynkow 1.32.22 → 1.34.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.
package/README.md CHANGED
@@ -39,7 +39,7 @@ const lynkow = createClient({
39
39
  // Fetch blog posts
40
40
  const { data: posts, meta } = await lynkow.contents.list({
41
41
  page: 1,
42
- perPage: 10,
42
+ limit: 10,
43
43
  category: 'tech',
44
44
  })
45
45
 
@@ -153,7 +153,7 @@ The SDK is isomorphic and works on both browser and server environments. Some fe
153
153
  // List contents with filters
154
154
  const { data, meta } = await lynkow.contents.list({
155
155
  page: 1,
156
- perPage: 10,
156
+ limit: 10,
157
157
  category: 'tech',
158
158
  tag: 'javascript',
159
159
  search: 'tutorial',
@@ -169,15 +169,15 @@ const content = await lynkow.contents.getBySlug('my-article')
169
169
 
170
170
  ```typescript
171
171
  // List all categories
172
- const { data } = await lynkow.categories.list()
172
+ const { categories } = await lynkow.categories.list()
173
173
 
174
174
  // Get category tree (nested)
175
- const { data: tree } = await lynkow.categories.tree()
175
+ const { tree } = await lynkow.categories.tree()
176
176
 
177
177
  // Get category with its contents
178
178
  const { category, contents } = await lynkow.categories.getBySlug('tech', {
179
179
  page: 1,
180
- perPage: 10,
180
+ limit: 10,
181
181
  })
182
182
  ```
183
183
 
@@ -248,7 +248,7 @@ const result = await lynkow.forms.submit(
248
248
  // List approved reviews
249
249
  const { data, meta } = await lynkow.reviews.list({
250
250
  minRating: 4,
251
- perPage: 10,
251
+ limit: 10,
252
252
  })
253
253
 
254
254
  // Get review settings
@@ -289,39 +289,47 @@ profiles.forEach((p) => console.log(p.slug, p.name))
289
289
  #### Browser-side instant search (⌘K, etc.)
290
290
 
291
291
  For UIs that fire a query on every keystroke, the SDK lets you talk
292
- directly to the search host instead of round-tripping through your
293
- server. Combine `getConfig()` (host + JWT tenant token + index name)
294
- with `listProfiles()` (admin-compiled scope filter + searchable /
292
+ directly to Lynkow Instant Search instead of round-tripping through
293
+ your server. Combine `getConfig()` (host + JWT tenant token + index
294
+ name) with `listProfiles()` (admin-compiled scope filter + searchable /
295
295
  displayed fields + sort) so the browser-side query mirrors the
296
296
  admin's configuration faithfully.
297
297
 
298
- This is an **advanced opt-in path**: the search backend exposes a
298
+ This is an **advanced opt-in path**: Lynkow Instant Search exposes a
299
299
  standard JSON API, and `getConfig()` returns the credentials you
300
- need to call it from any HTTP client. The example below uses the
301
- `meilisearch` npm client because that is the wire-protocol the
302
- backend speaks; install it as a peer dependency in your app
303
- (`npm install meilisearch`). Most consumers should stick to
304
- `lynkow.search.searchByProfile()` instead.
300
+ need to call it from any HTTP client. The example below uses raw
301
+ `fetch()` to keep dependencies minimal; you can swap in a typed
302
+ client compatible with the wire protocol if one fits your stack.
303
+ Most consumers should stick to `lynkow.search.searchByProfile()`
304
+ instead.
305
305
 
306
306
  ```typescript
307
- // Optional dependency — only install if you need browser-side latency.
308
- import { Meilisearch } from 'meilisearch'
309
-
310
307
  const [profiles, config] = await Promise.all([
311
308
  lynkow.search.listProfiles(),
312
309
  lynkow.search.getConfig(),
313
310
  ])
314
311
 
315
312
  const profile = profiles.find((p) => p.slug === 'api-docs')!
316
- const client = new Meilisearch({ host: config.host, apiKey: config.apiKey })
317
-
318
- const result = await client.index(config.indexName).search('pagination', {
319
- filter: profile.filter ?? undefined,
320
- attributesToSearchOn: profile.searchableFields,
321
- attributesToRetrieve: profile.displayedFields,
322
- sort: profile.sort.length > 0 ? profile.sort : undefined,
323
- hitsPerPage: profile.defaultLimit,
324
- })
313
+
314
+ const response = await fetch(
315
+ `${config.host}/indexes/${config.indexName}/search`,
316
+ {
317
+ method: 'POST',
318
+ headers: {
319
+ 'Authorization': `Bearer ${config.apiKey}`,
320
+ 'Content-Type': 'application/json',
321
+ },
322
+ body: JSON.stringify({
323
+ q: 'pagination',
324
+ filter: profile.filter ?? undefined,
325
+ attributesToSearchOn: profile.searchableFields,
326
+ attributesToRetrieve: profile.displayedFields,
327
+ sort: profile.sort.length > 0 ? profile.sort : undefined,
328
+ hitsPerPage: profile.defaultLimit,
329
+ }),
330
+ }
331
+ )
332
+ const result = await response.json()
325
333
  ```
326
334
 
327
335
  The tenant token is short-lived (1 hour) and scoped to your site's
package/dist/index.d.mts CHANGED
@@ -105,7 +105,7 @@ declare class ContentsService extends BaseService {
105
105
  * 5 minutes per unique filter combination.
106
106
  *
107
107
  * @param filters - Optional filters to narrow down results:
108
- * - `page` / `limit` pagination (defaults to page 1, 15 items)
108
+ * - `page` / `limit` - pagination (defaults to page 1, 20 items)
109
109
  * - `category` — filter by category slug (e.g. `'tech'`, `'news'`)
110
110
  * - `tag` — filter by tag slug (e.g. `'featured'`)
111
111
  * - `search` — full-text search across title and body
@@ -185,10 +185,10 @@ declare class ContentsService extends BaseService {
185
185
  * const lynkow = createClient({ siteId: '...' })
186
186
  *
187
187
  * // Flat list with content counts
188
- * const { data } = await lynkow.categories.list()
188
+ * const { categories } = await lynkow.categories.list()
189
189
  *
190
190
  * // Hierarchical tree
191
- * const { data } = await lynkow.categories.tree()
191
+ * const { tree } = await lynkow.categories.tree()
192
192
  *
193
193
  * // Category detail with paginated articles
194
194
  * const { category, contents } = await lynkow.categories.getBySlug('tech')
@@ -201,13 +201,13 @@ declare class CategoriesService extends BaseService {
201
201
  * Cached for 5 minutes per locale.
202
202
  *
203
203
  * @param options - Request options; use `locale` to fetch localized category names
204
- * @returns An object containing `data` (array of `CategoryWithCount` with name, slug, path,
204
+ * @returns An object containing `categories` (array of `CategoryWithCount` with name, slug, path,
205
205
  * contentCount, image, description), `blogUrlMode` (`'flat'` or `'nested'`), and `locale`
206
206
  *
207
207
  * @example
208
208
  * ```typescript
209
- * const { data, blogUrlMode } = await lynkow.categories.list()
210
- * data.forEach(cat => {
209
+ * const { categories, blogUrlMode } = await lynkow.categories.list()
210
+ * categories.forEach(cat => {
211
211
  * console.log(`${cat.name} (${cat.contentCount} articles)`)
212
212
  * })
213
213
  * ```
@@ -220,14 +220,14 @@ declare class CategoriesService extends BaseService {
220
220
  * hierarchical navigation or breadcrumbs. Cached for 5 minutes per locale.
221
221
  *
222
222
  * @param options - Request options; use `locale` to fetch localized category names
223
- * @returns An object containing `data` (array of `CategoryTreeNode`, each with a
223
+ * @returns An object containing `tree` (array of `CategoryTreeNode`, each with a
224
224
  * `children` array of nested subcategories), `blogUrlMode`, and `locale`
225
225
  *
226
226
  * @example
227
227
  * ```typescript
228
- * const { data } = await lynkow.categories.tree()
228
+ * const { tree } = await lynkow.categories.tree()
229
229
  * // Iterate root categories and their children
230
- * data.forEach(root => {
230
+ * tree.forEach(root => {
231
231
  * console.log(root.name)
232
232
  * root.children.forEach(child => {
233
233
  * console.log(` - ${child.name}`)
@@ -1541,10 +1541,10 @@ interface SearchOptions extends BaseRequestOptions {
1541
1541
  */
1542
1542
  interface SearchConfig {
1543
1543
  /**
1544
- * Public Lynkow search host URL (e.g. `'https://search.lynkow.com'`).
1545
- * Pass verbatim as the `host` when instantiating a search client in
1546
- * the browser (for example the `meilisearch-js` npm package, which
1547
- * speaks the same protocol). Does not include a trailing slash.
1544
+ * Public Lynkow Instant Search host URL (e.g. `'https://search.lynkow.com'`).
1545
+ * Pass verbatim as the `host` when calling the search wire protocol from
1546
+ * the browser, either via raw `fetch()` or a typed client compatible
1547
+ * with the protocol. Does not include a trailing slash.
1548
1548
  */
1549
1549
  host: string;
1550
1550
  /** Short-lived tenant token (JWT, 1-hour expiry) scoped to your site's index */
@@ -2356,10 +2356,11 @@ interface JsonLdGraphConfig {
2356
2356
  */
2357
2357
  interface Category {
2358
2358
  /**
2359
- * Unique numeric category ID. Auto-incremented.
2360
- * Use this for API calls like `GET /public/categories/:id`.
2359
+ * Unique category ID (UUID, e.g. `'550e8400-e29b-41d4-a716-446655440000'`).
2360
+ * Stable across renames and slug changes, so it is safe to use as a cache
2361
+ * or list key. Public category endpoints are addressed by slug, not by ID.
2361
2362
  */
2362
- id: number;
2363
+ id: string;
2363
2364
  /**
2364
2365
  * Category display name in the requested locale (e.g. `'Technology'`, `'Tutorials'`).
2365
2366
  * Max 255 characters.
@@ -2436,6 +2437,13 @@ interface CategoryWithCount extends Category {
2436
2437
  * Does not include content from child categories — each category counts independently.
2437
2438
  */
2438
2439
  contentCount: number;
2440
+ /**
2441
+ * Manual sort position configured in the admin. Defaults to `0`.
2442
+ * List and tree endpoints return categories sorted alphabetically by name;
2443
+ * use this value to apply the admin-defined ordering client-side
2444
+ * (lower values first).
2445
+ */
2446
+ displayOrder: number;
2439
2447
  /**
2440
2448
  * CDN-optimized image variants of the category image at multiple preset sizes.
2441
2449
  * `undefined` when no image is set or the site has no image transformations configured.
@@ -2477,11 +2485,11 @@ interface CategoryWithCount extends Category {
2477
2485
  */
2478
2486
  interface CategoryDetail extends CategoryWithCount {
2479
2487
  /**
2480
- * ID of the parent category, or `null` for root-level categories.
2488
+ * UUID of the parent category, or `null` for root-level categories.
2481
2489
  * Use this to build breadcrumbs or reconstruct the category tree.
2482
2490
  * Categories support unlimited nesting depth.
2483
2491
  */
2484
- parentId: number | null;
2492
+ parentId: string | null;
2485
2493
  /**
2486
2494
  * Category-level JSON-LD cascade nodes. Inherited by every content
2487
2495
  * attached to the category. Merged server-side into the content's
@@ -3719,7 +3727,7 @@ interface Form {
3719
3727
  * URL-friendly slug, unique within the site.
3720
3728
  * Lowercase, hyphenated (e.g. `'contact-us'`). Max 255 characters.
3721
3729
  * Used to fetch the form: `GET /public/{siteId}/forms/{slug}`.
3722
- * Also used as the submission endpoint: `POST /public/{siteId}/forms/{slug}/submit`.
3730
+ * Also used as the submission endpoint: `POST /public/{siteId}/forms/{slug}/submissions`.
3723
3731
  */
3724
3732
  slug: string;
3725
3733
  /**
@@ -4709,7 +4717,7 @@ interface CategoriesListResponse {
4709
4717
  * Flat array of all categories with their published content count.
4710
4718
  * Not paginated -- all categories are returned in a single response.
4711
4719
  */
4712
- data: CategoryWithCount[];
4720
+ categories: CategoryWithCount[];
4713
4721
  /**
4714
4722
  * How blog content URLs are constructed for this site:
4715
4723
  * - `'flat'`: URLs use slug only, e.g. `/blog/my-article`
@@ -4734,7 +4742,7 @@ interface CategoryTreeResponse {
4734
4742
  * Root-level category nodes, each containing nested `children` arrays.
4735
4743
  * Categories with a `parentId` appear as children of their parent node.
4736
4744
  */
4737
- data: CategoryTreeNode[];
4745
+ tree: CategoryTreeNode[];
4738
4746
  /**
4739
4747
  * How blog content URLs are constructed for this site:
4740
4748
  * - `'flat'`: URLs use slug only, e.g. `/blog/my-article`
package/dist/index.d.ts CHANGED
@@ -105,7 +105,7 @@ declare class ContentsService extends BaseService {
105
105
  * 5 minutes per unique filter combination.
106
106
  *
107
107
  * @param filters - Optional filters to narrow down results:
108
- * - `page` / `limit` pagination (defaults to page 1, 15 items)
108
+ * - `page` / `limit` - pagination (defaults to page 1, 20 items)
109
109
  * - `category` — filter by category slug (e.g. `'tech'`, `'news'`)
110
110
  * - `tag` — filter by tag slug (e.g. `'featured'`)
111
111
  * - `search` — full-text search across title and body
@@ -185,10 +185,10 @@ declare class ContentsService extends BaseService {
185
185
  * const lynkow = createClient({ siteId: '...' })
186
186
  *
187
187
  * // Flat list with content counts
188
- * const { data } = await lynkow.categories.list()
188
+ * const { categories } = await lynkow.categories.list()
189
189
  *
190
190
  * // Hierarchical tree
191
- * const { data } = await lynkow.categories.tree()
191
+ * const { tree } = await lynkow.categories.tree()
192
192
  *
193
193
  * // Category detail with paginated articles
194
194
  * const { category, contents } = await lynkow.categories.getBySlug('tech')
@@ -201,13 +201,13 @@ declare class CategoriesService extends BaseService {
201
201
  * Cached for 5 minutes per locale.
202
202
  *
203
203
  * @param options - Request options; use `locale` to fetch localized category names
204
- * @returns An object containing `data` (array of `CategoryWithCount` with name, slug, path,
204
+ * @returns An object containing `categories` (array of `CategoryWithCount` with name, slug, path,
205
205
  * contentCount, image, description), `blogUrlMode` (`'flat'` or `'nested'`), and `locale`
206
206
  *
207
207
  * @example
208
208
  * ```typescript
209
- * const { data, blogUrlMode } = await lynkow.categories.list()
210
- * data.forEach(cat => {
209
+ * const { categories, blogUrlMode } = await lynkow.categories.list()
210
+ * categories.forEach(cat => {
211
211
  * console.log(`${cat.name} (${cat.contentCount} articles)`)
212
212
  * })
213
213
  * ```
@@ -220,14 +220,14 @@ declare class CategoriesService extends BaseService {
220
220
  * hierarchical navigation or breadcrumbs. Cached for 5 minutes per locale.
221
221
  *
222
222
  * @param options - Request options; use `locale` to fetch localized category names
223
- * @returns An object containing `data` (array of `CategoryTreeNode`, each with a
223
+ * @returns An object containing `tree` (array of `CategoryTreeNode`, each with a
224
224
  * `children` array of nested subcategories), `blogUrlMode`, and `locale`
225
225
  *
226
226
  * @example
227
227
  * ```typescript
228
- * const { data } = await lynkow.categories.tree()
228
+ * const { tree } = await lynkow.categories.tree()
229
229
  * // Iterate root categories and their children
230
- * data.forEach(root => {
230
+ * tree.forEach(root => {
231
231
  * console.log(root.name)
232
232
  * root.children.forEach(child => {
233
233
  * console.log(` - ${child.name}`)
@@ -1541,10 +1541,10 @@ interface SearchOptions extends BaseRequestOptions {
1541
1541
  */
1542
1542
  interface SearchConfig {
1543
1543
  /**
1544
- * Public Lynkow search host URL (e.g. `'https://search.lynkow.com'`).
1545
- * Pass verbatim as the `host` when instantiating a search client in
1546
- * the browser (for example the `meilisearch-js` npm package, which
1547
- * speaks the same protocol). Does not include a trailing slash.
1544
+ * Public Lynkow Instant Search host URL (e.g. `'https://search.lynkow.com'`).
1545
+ * Pass verbatim as the `host` when calling the search wire protocol from
1546
+ * the browser, either via raw `fetch()` or a typed client compatible
1547
+ * with the protocol. Does not include a trailing slash.
1548
1548
  */
1549
1549
  host: string;
1550
1550
  /** Short-lived tenant token (JWT, 1-hour expiry) scoped to your site's index */
@@ -2356,10 +2356,11 @@ interface JsonLdGraphConfig {
2356
2356
  */
2357
2357
  interface Category {
2358
2358
  /**
2359
- * Unique numeric category ID. Auto-incremented.
2360
- * Use this for API calls like `GET /public/categories/:id`.
2359
+ * Unique category ID (UUID, e.g. `'550e8400-e29b-41d4-a716-446655440000'`).
2360
+ * Stable across renames and slug changes, so it is safe to use as a cache
2361
+ * or list key. Public category endpoints are addressed by slug, not by ID.
2361
2362
  */
2362
- id: number;
2363
+ id: string;
2363
2364
  /**
2364
2365
  * Category display name in the requested locale (e.g. `'Technology'`, `'Tutorials'`).
2365
2366
  * Max 255 characters.
@@ -2436,6 +2437,13 @@ interface CategoryWithCount extends Category {
2436
2437
  * Does not include content from child categories — each category counts independently.
2437
2438
  */
2438
2439
  contentCount: number;
2440
+ /**
2441
+ * Manual sort position configured in the admin. Defaults to `0`.
2442
+ * List and tree endpoints return categories sorted alphabetically by name;
2443
+ * use this value to apply the admin-defined ordering client-side
2444
+ * (lower values first).
2445
+ */
2446
+ displayOrder: number;
2439
2447
  /**
2440
2448
  * CDN-optimized image variants of the category image at multiple preset sizes.
2441
2449
  * `undefined` when no image is set or the site has no image transformations configured.
@@ -2477,11 +2485,11 @@ interface CategoryWithCount extends Category {
2477
2485
  */
2478
2486
  interface CategoryDetail extends CategoryWithCount {
2479
2487
  /**
2480
- * ID of the parent category, or `null` for root-level categories.
2488
+ * UUID of the parent category, or `null` for root-level categories.
2481
2489
  * Use this to build breadcrumbs or reconstruct the category tree.
2482
2490
  * Categories support unlimited nesting depth.
2483
2491
  */
2484
- parentId: number | null;
2492
+ parentId: string | null;
2485
2493
  /**
2486
2494
  * Category-level JSON-LD cascade nodes. Inherited by every content
2487
2495
  * attached to the category. Merged server-side into the content's
@@ -3719,7 +3727,7 @@ interface Form {
3719
3727
  * URL-friendly slug, unique within the site.
3720
3728
  * Lowercase, hyphenated (e.g. `'contact-us'`). Max 255 characters.
3721
3729
  * Used to fetch the form: `GET /public/{siteId}/forms/{slug}`.
3722
- * Also used as the submission endpoint: `POST /public/{siteId}/forms/{slug}/submit`.
3730
+ * Also used as the submission endpoint: `POST /public/{siteId}/forms/{slug}/submissions`.
3723
3731
  */
3724
3732
  slug: string;
3725
3733
  /**
@@ -4709,7 +4717,7 @@ interface CategoriesListResponse {
4709
4717
  * Flat array of all categories with their published content count.
4710
4718
  * Not paginated -- all categories are returned in a single response.
4711
4719
  */
4712
- data: CategoryWithCount[];
4720
+ categories: CategoryWithCount[];
4713
4721
  /**
4714
4722
  * How blog content URLs are constructed for this site:
4715
4723
  * - `'flat'`: URLs use slug only, e.g. `/blog/my-article`
@@ -4734,7 +4742,7 @@ interface CategoryTreeResponse {
4734
4742
  * Root-level category nodes, each containing nested `children` arrays.
4735
4743
  * Categories with a `parentId` appear as children of their parent node.
4736
4744
  */
4737
- data: CategoryTreeNode[];
4745
+ tree: CategoryTreeNode[];
4738
4746
  /**
4739
4747
  * How blog content URLs are constructed for this site:
4740
4748
  * - `'flat'`: URLs use slug only, e.g. `/blog/my-article`
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var v=class s extends Error{name="LynkowError";code;status;details;cause;constructor(e,t,n,o,r){super(e),this.code=t,this.status=n,this.details=o,this.cause=r,Error.captureStackTrace&&Error.captureStackTrace(this,s);}static async fromResponse(e){let t=e.status,n=`HTTP ${t}`,o;try{let i=await e.json();i.errors&&Array.isArray(i.errors)?(o=i.errors,n=i.errors[0]?.message||n):i.error?n=i.error:i.message&&(n=i.message);}catch{n=e.statusText||n;}let r=s.statusToCode(t);return new s(n,r,t,o)}static fromNetworkError(e){return e.name==="AbortError"?new s("Request timed out","TIMEOUT",void 0,void 0,e):e.name==="TypeError"?new s("Network error - please check your connection","NETWORK_ERROR",void 0,void 0,e):new s(e.message||"Unknown error","UNKNOWN",void 0,void 0,e)}static statusToCode(e){switch(e){case 400:return "VALIDATION_ERROR";case 401:return "UNAUTHORIZED";case 403:return "FORBIDDEN";case 404:return "NOT_FOUND";case 429:return "RATE_LIMITED";default:return "UNKNOWN"}}toJSON(){return {name:this.name,message:this.message,code:this.code,status:this.status,details:this.details}}};function be(s){return s instanceof v}function ke(s){switch(s){case 400:return "BAD_REQUEST";case 401:return "UNAUTHORIZED";case 403:return "FORBIDDEN";case 404:return "NOT_FOUND";case 422:return "VALIDATION_ERROR";case 429:return "TOO_MANY_REQUESTS";case 503:return "SERVICE_UNAVAILABLE";default:return "INTERNAL_ERROR"}}async function W(s,e){let t;try{t=await fetch(s,e);}catch(a){throw new v("Network error: Unable to reach the server","NETWORK_ERROR",0,[{message:a instanceof Error?a.message:"Unknown error"}])}if(t.ok)return t.json();let n={};try{n=await t.json();}catch{}let o=ke(t.status),r=n.error||n.message||`HTTP error: ${t.status}`,i=n.errors||[{message:r}];throw new v(r,o,t.status,i)}function ie(s){let e=new URLSearchParams;for(let[t,n]of Object.entries(s))n!=null&&n!==""&&e.append(t,String(n));return e.toString()}var d={SHORT:300*1e3,MEDIUM:600*1e3,LONG:1800*1e3},m=class{config;cache;constructor(e){this.config=e,this.cache=e.cache;}buildEndpointUrl(e,t){let n=`${this.config.baseUrl}/public/${this.config.siteId}${e}`;if(t&&Object.keys(t).length>0){let o=ie(t);return `${n}?${o}`}return n}async get(e,t,n){let o=n?.locale||this.config.locale,r=o?{...t,locale:o}:t,i=this.buildEndpointUrl(e,r),a=this.mergeFetchOptions(n?.fetchOptions);return W(i,{method:"GET",...a})}async getWithCache(e,t,n,o,r=d.SHORT){return this.cache?this.cache.getOrSet(e,()=>this.get(t,n,o),r):this.get(t,n,o)}invalidateCache(e){this.cache?.invalidate(e);}async post(e,t,n){let o=this.buildEndpointUrl(e),r=this.mergeFetchOptions(n?.fetchOptions);return W(o,{method:"POST",...r,headers:{"Content-Type":"application/json",...r.headers},body:JSON.stringify(t)})}async getText(e,t){let n=this.buildEndpointUrl(e),o=this.mergeFetchOptions(t?.fetchOptions),r=await fetch(n,{method:"GET",...o});if(!r.ok)throw new Error(`HTTP error: ${r.status}`);return r.text()}mergeFetchOptions(e){return {...this.config.fetchOptions,...e,headers:{...this.config.fetchOptions.headers,...e?.headers}}}};var G="contents_",b=class extends m{async list(e,t){let n={};e?.page&&(n.page=e.page),(e?.limit??e?.perPage)&&(n.limit=e?.limit??e?.perPage),e?.category&&(n.category=e.category),e?.tag&&(n.tag=e.tag),e?.search&&(n.search=e.search),e?.sort&&(n.sort=e.sort),e?.order&&(n.order=e.order),e?.locale&&(n.locale=e.locale);let o=`${G}list_${JSON.stringify(e||{})}`;return this.getWithCache(o,"/contents",n,t,d.SHORT)}async getBySlug(e,t){let n=t?.locale||this.config.locale,o=`${G}slug_${e}_${n||"default"}`;return (await this.getWithCache(o,`/contents/slug/${encodeURIComponent(e)}`,void 0,t,d.SHORT)).data}clearCache(){this.invalidateCache(G);}};var j="categories_",k=class extends m{async list(e){let t=e?.locale||this.config.locale,n=`${j}list_${t||"default"}`;return this.getWithCache(n,"/categories",void 0,e,d.SHORT)}async tree(e){let t=e?.locale||this.config.locale,n=`${j}tree_${t||"default"}`;return this.getWithCache(n,"/categories/tree",void 0,e,d.SHORT)}async getBySlug(e,t){let n={};t?.page&&(n.page=t.page),(t?.limit??t?.perPage)&&(n.limit=t?.limit??t?.perPage);let o=`${j}slug_${e}_${JSON.stringify(t||{})}`;return this.getWithCache(o,`/categories/${encodeURIComponent(e)}`,n,t,d.SHORT)}clearCache(){this.invalidateCache(j);}};var ae="tags_",x=class extends m{async list(e,t){let n={};e?.page&&(n.page=e.page),(e?.limit??e?.perPage)&&(n.limit=e?.limit??e?.perPage),e?.locale&&(n.locale=e.locale);let o=t?.locale||e?.locale||this.config.locale,r=`${ae}list_${o||"default"}_${JSON.stringify(e||{})}`;return this.getWithCache(r,"/tags",n,t,d.SHORT)}clearCache(){this.invalidateCache(ae);}};var F="pages_",R=class extends m{async list(e){let t=e?.locale||this.config.locale,n={};e?.tag&&(n.tag=e.tag);let o=`${F}list_${t||"default"}_${e?.tag||"all"}`;return this.getWithCache(o,"/pages",n,e,d.SHORT)}async getBySlug(e,t){let n=t?.locale||this.config.locale,o=`${F}slug_${e}_${n||"default"}`;return (await this.getWithCache(o,`/pages/${encodeURIComponent(e)}`,void 0,t,d.SHORT)).data}async getByPath(e,t){let n=t?.locale||this.config.locale,o=`${F}path_${e}_${n||"default"}`;return (await this.getWithCache(o,"/page-by-path",{path:e},t,d.SHORT)).data}async getJsonLd(e,t){let n=t?.locale||this.config.locale,o=`${F}jsonld_${e}_${n||"default"}`;return (await this.getWithCache(o,`/pages/${encodeURIComponent(e)}/json-ld`,void 0,t,d.SHORT)).data}clearCache(){this.invalidateCache(F);}};var J="globals_",E=class extends m{async siteConfig(e){let t=e?.locale||this.config.locale,n=`${J}siteconfig_${t||"default"}`;return this.getWithCache(n,"/site-config",void 0,e,d.MEDIUM)}async getBySlug(e,t){let n=t?.locale||this.config.locale,o=`${J}${e}_${n||"default"}`;return this.getWithCache(o,`/global/${encodeURIComponent(e)}`,void 0,t,d.MEDIUM)}async global(e,t){return this.getBySlug(e,t)}clearCache(){this.invalidateCache(J);}};function K(s){return {_hp:"",_ts:s}}var ce="forms_",S=class extends m{sessionStartTime;constructor(e){super(e),this.sessionStartTime=Date.now();}async getBySlug(e){let t=`${ce}${e}`;return (await this.getWithCache(t,`/forms/${encodeURIComponent(e)}`,void 0,void 0,d.MEDIUM)).data}async submit(e,t,n){let o=K(this.sessionStartTime),r={data:t,honeypot:o._hp,...o};return n?.recaptchaToken&&(r.recaptchaToken=n.recaptchaToken),(await this.post(`/forms/${encodeURIComponent(e)}/submit`,r,n)).data}clearCache(){this.invalidateCache(ce);}};var D="reviews_",T=class extends m{sessionStartTime;constructor(e){super(e),this.sessionStartTime=Date.now();}async list(e,t){let n={};e?.page&&(n.page=e.page),(e?.limit??e?.perPage)&&(n.limit=e?.limit??e?.perPage),e?.minRating&&(n.minRating=e.minRating),e?.maxRating&&(n.maxRating=e.maxRating),e?.sort&&(n.sort=e.sort),e?.order&&(n.order=e.order);let o=`${D}list_${JSON.stringify(e||{})}`;return this.getWithCache(o,"/reviews",n,t,d.SHORT)}async getBySlug(e){let t=`${D}slug_${e}`;return (await this.getWithCache(t,`/reviews/${encodeURIComponent(e)}`,void 0,void 0,d.SHORT)).data}async settings(){let e=`${D}settings`;return (await this.getWithCache(e,"/reviews/settings",void 0,void 0,d.MEDIUM)).data}async submit(e,t){let n=K(this.sessionStartTime),o={...e,...n};t?.recaptchaToken&&(o._recaptcha_token=t.recaptchaToken);let r=await this.post("/reviews",o,t);return this.invalidateCache(D),r.data}clearCache(){this.invalidateCache(D);}};var le="site_",L=class extends m{async getConfig(){let e=`${le}config`;return (await this.getWithCache(e,"/site",void 0,void 0,d.MEDIUM)).data}clearCache(){this.invalidateCache(le);}};var V="legal_",O=class extends m{async list(e){let t=e?.locale||this.config.locale,n=`${V}list_${t||"default"}`;return (await this.getWithCache(n,"/pages",{tag:"legal"},e,d.SHORT)).data}async getBySlug(e,t){let n=t?.locale||this.config.locale,o=`${V}slug_${e}_${n||"default"}`;return (await this.getWithCache(o,`/pages/${encodeURIComponent(e)}`,void 0,t,d.SHORT)).data}clearCache(){this.invalidateCache(V);}};var de="cookies_",I=class extends m{async getConfig(){let e=`${de}config`;return (await this.getWithCache(e,"/cookie-consent/config",void 0,void 0,d.MEDIUM)).data}async logConsent(e,t){return this.post("/cookie-consent/log",{preferences:e},t)}clearCache(){this.invalidateCache(de);}};var P=class extends m{async sitemap(e){return this.getText("/sitemap.xml",e)}async sitemapPart(e,t){return this.getText(`/sitemap-${e}.xml`,t)}async robots(e){return this.getText("/robots.txt",e)}async llmsTxt(e){let t=e?.locale,n=t?`/${t}/llms.txt`:"/llms.txt";return this.getText(n,e)}async llmsFullTxt(e){let t=e?.locale,n=t?`/${t}/llms-full.txt`:"/llms-full.txt";return this.getText(n,e)}async getMarkdown(e,t){let n=e.startsWith("/")?e:`/${e}`;return this.getText(`${n}.md`,t)}};var X="paths_",B=class extends m{async list(e){let t=e?.locale||this.config.locale,n=`${X}list_${t||"all"}`;return this.getWithCache(n,"/paths",void 0,e,d.SHORT)}async resolve(e,t){let n=t?.locale||this.config.locale,o=`${X}resolve_${e}_${n||"default"}`;return this.getWithCache(o,"/resolve",{path:e},t,d.SHORT)}async matchRedirect(e,t){try{return (await this.get("/redirects/match",{path:e},t)).data}catch(n){if(n instanceof v&&n.status===404)return null;throw n}}clearCache(){this.invalidateCache(X);}};var c=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",xe=!c;function Re(s,e){return c?s():e}async function Ee(s,e){return c?s():e}var Y="lynkow-tracker",q=class{config;enabled=true;initialized=false;loading=false;loadPromise=null;constructor(e){this.config=e;}getTrackerUrl(){return `${this.config.baseUrl}/analytics/tracker.js`}loadTracker(){return !c||window.LynkowAnalytics?Promise.resolve():this.loadPromise?this.loadPromise:(this.loading=true,this.loadPromise=new Promise((e,t)=>{if(document.getElementById(Y)){let o=setInterval(()=>{window.LynkowAnalytics&&(clearInterval(o),this.loading=false,e());},50);setTimeout(()=>{clearInterval(o),this.loading=false,t(new Error("Tracker script load timeout"));},1e4);return}let n=document.createElement("script");n.id=Y,n.src=this.getTrackerUrl(),n.async=true,n.setAttribute("data-site-id",this.config.siteId),this.config.baseUrl&&n.setAttribute("data-api-url",this.config.baseUrl);try{let o=localStorage.getItem("_lkw_consent_mode");o&&n.setAttribute("data-consent-mode",o);}catch{}n.onload=()=>{this.loading=false,setTimeout(()=>{window.LynkowAnalytics?e():t(new Error("Tracker script loaded but LynkowAnalytics not found"));},0);},n.onerror=()=>{this.loading=false,t(new Error("Failed to load tracker script"));},document.head.appendChild(n);}),this.loadPromise)}async init(){if(!(!c||this.initialized))try{await this.loadTracker(),window.LynkowAnalytics&&!this.initialized&&(this.initialized=!0);}catch(e){console.error("[Lynkow] Failed to initialize analytics:",e);}}async trackEvent(e){!c||!this.enabled||(await this.init(),window.LynkowAnalytics&&window.LynkowAnalytics.track(e));}async trackPageview(e){!c||!this.enabled||(await this.init(),window.LynkowAnalytics&&window.LynkowAnalytics.track({type:"pageview",path:e?.path||window.location.pathname,title:e?.title||document.title,referrer:e?.referrer||document.referrer}));}enable(){this.enabled=true;}disable(){this.enabled=false;}isEnabled(){return this.enabled}isInitialized(){return this.initialized&&!!window.LynkowAnalytics}getTracker(){if(c)return window.LynkowAnalytics}destroy(){if(!c)return;document.getElementById(Y)?.remove(),this.initialized=false,this.loadPromise=null;}};function Se(s){let e=s.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);if(!e||(e[4]!==void 0?parseFloat(e[4]):1)===0)return null;let n=parseInt(e[1],10),o=parseInt(e[2],10),r=parseInt(e[3],10);return (.299*n+.587*o+.114*r)/255}function w(){if(!c)return "light";let s=document.documentElement,e=document.body;for(let t of [s,e])for(let n of ["data-theme","data-mode","data-color-scheme"]){let o=t.getAttribute(n)?.toLowerCase();if(o){if(o.includes("dark"))return "dark";if(o.includes("light"))return "light"}}if(s.classList.contains("dark")||e.classList.contains("dark"))return "dark";try{let t=getComputedStyle(s).colorScheme;if(t){let n=t.toLowerCase().trim();if(n.startsWith("dark"))return "dark";if(n.startsWith("light"))return "light"}}catch{}try{let t=getComputedStyle(e).backgroundColor,n=Se(t);if(n!==null)return n<.5?"dark":"light"}catch{}try{if(window.matchMedia("(prefers-color-scheme: dark)").matches)return "dark"}catch{}return "light"}function $(s){if(!c)return ()=>{};let e=w(),t=[],n=()=>{let i=w();i!==e&&(e=i,s(i));},o=new MutationObserver(n),r={attributes:true,attributeFilter:["data-theme","data-mode","data-color-scheme","class","style"]};o.observe(document.documentElement,r),o.observe(document.body,r),t.push(()=>o.disconnect());try{let i=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>n();i.addEventListener("change",a),t.push(()=>i.removeEventListener("change",a));}catch{}return ()=>t.forEach(i=>i())}var z="_lkw_consent",Te=365*24*60*60*1e3,pe="lkw-script-",Q={necessary:true,analytics:false,marketing:false,preferences:false},N=class{config;events;bannerElement=null;preferencesElement=null;configCache=null;injectedScriptIds=new Set;themeCleanup=null;constructor(e,t){this.config=e,this.events=t;}async getConfig(){if(this.configCache)return this.configCache;let e=`${this.config.baseUrl}/public/${this.config.siteId}/cookie-consent/config`,t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"},...this.config.fetchOptions});if(!t.ok)throw new Error(`Failed to fetch consent config: ${t.status}`);let n=await t.json();return this.configCache=n.data,this.configCache}async logConsent(e,t){let n=`${this.config.baseUrl}/public/${this.config.siteId}/cookie-consent/log`;await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({visitorId:this.getOrCreateVisitorId(),action:t||this.inferAction(e),consentGiven:e,pageUrl:c?window.location.href:void 0}),...this.config.fetchOptions}).catch(()=>{});}getOrCreateVisitorId(){if(!c)return "server";let e="_lkw_vid";try{let t=localStorage.getItem(e);return t||(t=crypto.randomUUID(),localStorage.setItem(e,t)),t}catch{return crypto.randomUUID()}}inferAction(e){let t=Object.entries(e).filter(([r])=>r!=="necessary"),n=t.every(([,r])=>r===true),o=t.every(([,r])=>r===false);return n?"accept_all":o?"reject_all":"customize"}getStoredConsent(){if(!c)return null;try{let e=localStorage.getItem(z);if(e){let t=JSON.parse(e);return t.choices?t.timestamp&&Date.now()-t.timestamp>Te?(localStorage.removeItem(z),null):t.choices:t}}catch{}return null}saveConsent(e){if(c){try{localStorage.setItem(z,JSON.stringify({choices:e,timestamp:Date.now()}));}catch{}this.events.emit("consent-changed",e),document.dispatchEvent(new CustomEvent("lynkow:consent:update",{detail:e}));}}show(){c&&this.getConfig().then(e=>{if(!e.enabled)return;try{e.consentMode&&localStorage.setItem("_lkw_consent_mode",e.consentMode);}catch{}let t=this.getStoredConsent();if(t){this.activateScripts(t);return}if(this.bannerElement)return;this.injectBannerStylesOnce();let n=document.createElement("div");n.innerHTML=this.createBannerHTML(e),this.bannerElement=n.firstElementChild,document.body.appendChild(this.bannerElement),this.attachBannerEvents(),e.theme==="auto"&&!this.themeCleanup&&(this.themeCleanup=$(o=>{this.updateConsentTheme(o);}));});}hide(){c&&(this.bannerElement?.remove(),this.bannerElement=null,this.cleanupThemeObserverIfIdle());}showPreferences(){c&&(this.preferencesElement||this.getConfig().then(e=>{let t=this.getCategories(),n=document.createElement("div");n.innerHTML=this.createPreferencesHTML(e,t),this.preferencesElement=n.firstElementChild,document.body.appendChild(this.preferencesElement),this.attachPreferencesEvents(e),e.theme==="auto"&&!this.themeCleanup&&(this.themeCleanup=$(o=>{this.updateConsentTheme(o);}));}));}getCategories(){return c?this.getStoredConsent()||{...Q}:{...Q}}hasConsented(){return c?this.getStoredConsent()!==null:false}acceptAll(){if(!c)return;let e={necessary:true,analytics:true,marketing:true,preferences:true};this.saveConsent(e),this.logConsent(e,"accept_all"),this.activateScripts(e),this.hide();}rejectAll(){if(!c)return;let e={necessary:true,analytics:false,marketing:false,preferences:false};this.saveConsent(e),this.logConsent(e,"reject_all"),this.hide();}setCategories(e){if(!c)return;let n={...this.getCategories(),...e,necessary:true};this.saveConsent(n),this.logConsent(n,"customize"),this.activateScripts(n);}reset(){if(c){this.removeInjectedScripts();try{localStorage.removeItem(z);}catch{}this.events.emit("consent-changed",{...Q}),this.show();}}activateScripts(e){if(this.configCache?.thirdPartyScripts?.length)for(let[t,n]of Object.entries(e))n&&this.injectScriptsForCategory(t,this.configCache.thirdPartyScripts);}injectScriptsForCategory(e,t){for(let n of t){if(n.category!==e||this.injectedScriptIds.has(n.id))continue;this.injectedScriptIds.add(n.id);let o=document.createElement("div");o.innerHTML=n.script;let r=Array.from(o.children);for(let i=0;i<r.length;i++){let a=r[i],p=`${pe}${n.id}-${i}`;if(a.tagName==="SCRIPT"){let g=document.createElement("script");for(let u of Array.from(a.attributes))g.setAttribute(u.name,u.value);a.textContent&&(g.textContent=a.textContent),g.id=p,document.head.appendChild(g);}else a.id=p,document.body.appendChild(a);}}}removeInjectedScripts(){for(let e of this.injectedScriptIds){let t=0,n;for(;n=document.getElementById(`${pe}${e}-${t}`);)n.remove(),t++;}this.injectedScriptIds.clear();}cleanupThemeObserverIfIdle(){!this.bannerElement&&!this.preferencesElement&&(this.themeCleanup?.(),this.themeCleanup=null);}updateConsentTheme(e){let t=this.configCache?this.resolveColors(this.configCache,e):{bgColor:e==="dark"?"#18181b":"#ffffff",textColor:e==="dark"?"#f4f4f5":"#1a1a1a"},{bgColor:n,textColor:o}=t;if(this.bannerElement&&(this.bannerElement.style.background=n,this.bannerElement.style.color=o),this.preferencesElement){let r=this.preferencesElement.querySelector(":scope > div");r&&(r.style.background=n,r.style.color=o);}}resolveTheme(e){return e==="auto"?w():e==="dark"?"dark":"light"}resolveColors(e,t){if(e.themeStyles?.[t])return e.themeStyles[t];let n=t==="dark";return {primaryColor:e.primaryColor||"#0066cc",bgColor:n?"#18181b":"#ffffff",textColor:n?"#f4f4f5":"#1a1a1a"}}contrastColor(e){let t=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),o=parseInt(e.slice(5,7),16);return (.299*t+.587*n+.114*o)/255>.5?"#000000":"#ffffff"}injectBannerStylesOnce(){if(document.getElementById("lynkow-consent-styles"))return;let e=document.createElement("style");e.id="lynkow-consent-styles",e.textContent=`
1
+ 'use strict';var v=class s extends Error{name="LynkowError";code;status;details;cause;constructor(e,t,n,o,r){super(e),this.code=t,this.status=n,this.details=o,this.cause=r,Error.captureStackTrace&&Error.captureStackTrace(this,s);}static async fromResponse(e){let t=e.status,n=`HTTP ${t}`,o;try{let i=await e.json();i.errors&&Array.isArray(i.errors)?(o=i.errors,n=i.errors[0]?.message||n):i.error?n=i.error:i.message&&(n=i.message);}catch{n=e.statusText||n;}let r=s.statusToCode(t);return new s(n,r,t,o)}static fromNetworkError(e){return e.name==="AbortError"?new s("Request timed out","TIMEOUT",void 0,void 0,e):e.name==="TypeError"?new s("Network error - please check your connection","NETWORK_ERROR",void 0,void 0,e):new s(e.message||"Unknown error","UNKNOWN",void 0,void 0,e)}static statusToCode(e){switch(e){case 400:return "VALIDATION_ERROR";case 401:return "UNAUTHORIZED";case 403:return "FORBIDDEN";case 404:return "NOT_FOUND";case 429:return "RATE_LIMITED";default:return "UNKNOWN"}}toJSON(){return {name:this.name,message:this.message,code:this.code,status:this.status,details:this.details}}};function ke(s){return s instanceof v}function Re(s){switch(s){case 400:return "BAD_REQUEST";case 401:return "UNAUTHORIZED";case 403:return "FORBIDDEN";case 404:return "NOT_FOUND";case 422:return "VALIDATION_ERROR";case 429:return "TOO_MANY_REQUESTS";case 503:return "SERVICE_UNAVAILABLE";default:return "INTERNAL_ERROR"}}async function W(s,e){let t;try{t=await fetch(s,e);}catch(a){throw new v("Network error: Unable to reach the server","NETWORK_ERROR",0,[{message:a instanceof Error?a.message:"Unknown error"}])}if(t.ok)return t.json();let n={};try{n=await t.json();}catch{}let o=Re(t.status),r=n.error||n.message||`HTTP error: ${t.status}`,i=n.errors||[{message:r}];throw new v(r,o,t.status,i)}function ae(s){let e=new URLSearchParams;for(let[t,n]of Object.entries(s))n!=null&&n!==""&&e.append(t,String(n));return e.toString()}var d={SHORT:300*1e3,MEDIUM:600*1e3,LONG:1800*1e3},m=class{config;cache;constructor(e){this.config=e,this.cache=e.cache;}buildEndpointUrl(e,t){let n=`${this.config.baseUrl}/public/${this.config.siteId}${e}`;if(t&&Object.keys(t).length>0){let o=ae(t);return `${n}?${o}`}return n}async get(e,t,n){let o=n?.locale||this.config.locale,r=o?{...t,locale:o}:t,i=this.buildEndpointUrl(e,r),a=this.mergeFetchOptions(n?.fetchOptions);return W(i,{method:"GET",...a})}async getWithCache(e,t,n,o,r=d.SHORT){return this.cache?this.cache.getOrSet(e,()=>this.get(t,n,o),r):this.get(t,n,o)}invalidateCache(e){this.cache?.invalidate(e);}async post(e,t,n){let o=this.buildEndpointUrl(e),r=this.mergeFetchOptions(n?.fetchOptions);return W(o,{method:"POST",...r,headers:{"Content-Type":"application/json",...r.headers},body:JSON.stringify(t)})}async getText(e,t){let n=this.buildEndpointUrl(e),o=this.mergeFetchOptions(t?.fetchOptions),r=await fetch(n,{method:"GET",...o});if(!r.ok)throw new Error(`HTTP error: ${r.status}`);return r.text()}mergeFetchOptions(e){return {...this.config.fetchOptions,...e,headers:{...this.config.fetchOptions.headers,...e?.headers}}}};var G="contents_",b=class extends m{async list(e,t){let n={};e?.page&&(n.page=e.page),(e?.limit??e?.perPage)&&(n.limit=e?.limit??e?.perPage),e?.category&&(n.category=e.category),e?.tag&&(n.tag=e.tag),e?.search&&(n.search=e.search),e?.sort&&(n.sort=e.sort),e?.order&&(n.order=e.order),e?.locale&&(n.locale=e.locale);let o=`${G}list_${JSON.stringify(e||{})}`;return this.getWithCache(o,"/contents",n,t,d.SHORT)}async getBySlug(e,t){let n=t?.locale||this.config.locale,o=`${G}slug_${e}_${n||"default"}`;return (await this.getWithCache(o,`/contents/slug/${encodeURIComponent(e)}`,void 0,t,d.SHORT)).data}clearCache(){this.invalidateCache(G);}};var j="categories_";function J(s){if(Array.isArray(s))return s.map(J);if(s!==null&&typeof s=="object"){let e=s,t={};for(let n of Object.keys(e).sort())t[n]=J(e[n]);return t}return s}var k=class extends m{async list(e){let t=e?.locale||this.config.locale,n=`${j}list_${t||"default"}`;return (await this.getWithCache(n,"/categories",void 0,e,d.SHORT)).data}async tree(e){let t=e?.locale||this.config.locale,n=`${j}tree_${t||"default"}`;return (await this.getWithCache(n,"/categories/tree",void 0,e,d.SHORT)).data}async getBySlug(e,t){let n={};t?.page&&(n.page=t.page),(t?.limit??t?.perPage)&&(n.limit=t?.limit??t?.perPage);let o=`${j}slug_${e}_${JSON.stringify(J(t||{}))}`;return (await this.getWithCache(o,`/categories/${encodeURIComponent(e)}`,n,t,d.SHORT)).data}clearCache(){this.invalidateCache(j);}};var ce="tags_",R=class extends m{async list(e,t){let n={};e?.page&&(n.page=e.page),(e?.limit??e?.perPage)&&(n.limit=e?.limit??e?.perPage),e?.locale&&(n.locale=e.locale);let o=t?.locale||e?.locale||this.config.locale,r=`${ce}list_${o||"default"}_${JSON.stringify(e||{})}`;return this.getWithCache(r,"/tags",n,t,d.SHORT)}clearCache(){this.invalidateCache(ce);}};var F="pages_",x=class extends m{async list(e){let t=e?.locale||this.config.locale,n={};e?.tag&&(n.tag=e.tag);let o=`${F}list_${t||"default"}_${e?.tag||"all"}`;return this.getWithCache(o,"/pages",n,e,d.SHORT)}async getBySlug(e,t){let n=t?.locale||this.config.locale,o=`${F}slug_${e}_${n||"default"}`;return (await this.getWithCache(o,`/pages/${encodeURIComponent(e)}`,void 0,t,d.SHORT)).data}async getByPath(e,t){let n=t?.locale||this.config.locale,o=`${F}path_${e}_${n||"default"}`;return (await this.getWithCache(o,"/page-by-path",{path:e},t,d.SHORT)).data}async getJsonLd(e,t){let n=t?.locale||this.config.locale,o=`${F}jsonld_${e}_${n||"default"}`;return (await this.getWithCache(o,`/pages/${encodeURIComponent(e)}/json-ld`,void 0,t,d.SHORT)).data}clearCache(){this.invalidateCache(F);}};var V="globals_",E=class extends m{async siteConfig(e){let t=e?.locale||this.config.locale,n=`${V}siteconfig_${t||"default"}`;return this.getWithCache(n,"/site-config",void 0,e,d.MEDIUM)}async getBySlug(e,t){let n=t?.locale||this.config.locale,o=`${V}${e}_${n||"default"}`;return this.getWithCache(o,`/global/${encodeURIComponent(e)}`,void 0,t,d.MEDIUM)}async global(e,t){return this.getBySlug(e,t)}clearCache(){this.invalidateCache(V);}};function K(s){return {_hp:"",_ts:s}}var le="forms_",S=class extends m{sessionStartTime;constructor(e){super(e),this.sessionStartTime=Date.now();}async getBySlug(e){let t=`${le}${e}`;return (await this.getWithCache(t,`/forms/${encodeURIComponent(e)}`,void 0,void 0,d.MEDIUM)).data}async submit(e,t,n){let o=K(this.sessionStartTime),r={data:t,honeypot:o._hp,...o};return n?.recaptchaToken&&(r.recaptchaToken=n.recaptchaToken),(await this.post(`/forms/${encodeURIComponent(e)}/submissions`,r,n)).data}clearCache(){this.invalidateCache(le);}};var D="reviews_",T=class extends m{sessionStartTime;constructor(e){super(e),this.sessionStartTime=Date.now();}async list(e,t){let n={};e?.page&&(n.page=e.page),(e?.limit??e?.perPage)&&(n.limit=e?.limit??e?.perPage),e?.minRating&&(n.minRating=e.minRating),e?.maxRating&&(n.maxRating=e.maxRating),e?.sort&&(n.sort=e.sort),e?.order&&(n.order=e.order);let o=`${D}list_${JSON.stringify(e||{})}`;return this.getWithCache(o,"/reviews",n,t,d.SHORT)}async getBySlug(e){let t=`${D}slug_${e}`;return (await this.getWithCache(t,`/reviews/${encodeURIComponent(e)}`,void 0,void 0,d.SHORT)).data}async settings(){let e=`${D}settings`;return (await this.getWithCache(e,"/reviews/settings",void 0,void 0,d.MEDIUM)).data}async submit(e,t){let n=K(this.sessionStartTime),o={...e,...n};t?.recaptchaToken&&(o._recaptcha_token=t.recaptchaToken);let r=await this.post("/reviews",o,t);return this.invalidateCache(D),r.data}clearCache(){this.invalidateCache(D);}};var de="site_",L=class extends m{async getConfig(){let e=`${de}config`;return (await this.getWithCache(e,"/site",void 0,void 0,d.MEDIUM)).data}clearCache(){this.invalidateCache(de);}};var X="legal_",O=class extends m{async list(e){let t=e?.locale||this.config.locale,n=`${X}list_${t||"default"}`;return (await this.getWithCache(n,"/pages",{tag:"legal"},e,d.SHORT)).data}async getBySlug(e,t){let n=t?.locale||this.config.locale,o=`${X}slug_${e}_${n||"default"}`;return (await this.getWithCache(o,`/pages/${encodeURIComponent(e)}`,void 0,t,d.SHORT)).data}clearCache(){this.invalidateCache(X);}};var pe="cookies_",I=class extends m{async getConfig(){let e=`${pe}config`;return (await this.getWithCache(e,"/cookie-consent/config",void 0,void 0,d.MEDIUM)).data}async logConsent(e,t){return this.post("/cookie-consent/logs",{preferences:e},t)}clearCache(){this.invalidateCache(pe);}};var P=class extends m{async sitemap(e){return this.getText("/sitemap.xml",e)}async sitemapPart(e,t){return this.getText(`/sitemap-${e}.xml`,t)}async robots(e){return this.getText("/robots.txt",e)}async llmsTxt(e){let t=e?.locale,n=t?`/${t}/llms.txt`:"/llms.txt";return this.getText(n,e)}async llmsFullTxt(e){let t=e?.locale,n=t?`/${t}/llms-full.txt`:"/llms-full.txt";return this.getText(n,e)}async getMarkdown(e,t){let n=e.startsWith("/")?e:`/${e}`;return this.getText(`${n}.md`,t)}};var Y="paths_",B=class extends m{async list(e){let t=e?.locale||this.config.locale,n=`${Y}list_${t||"all"}`;return (await this.getWithCache(n,"/paths",void 0,e,d.SHORT)).data}async resolve(e,t){let n=t?.locale||this.config.locale,o=`${Y}resolve_${e}_${n||"default"}`;return (await this.getWithCache(o,"/resolve",{path:e},t,d.SHORT)).data}async matchRedirect(e,t){try{return (await this.get("/redirects/match",{path:e},t)).data}catch(n){if(n instanceof v&&n.status===404)return null;throw n}}clearCache(){this.invalidateCache(Y);}};var c=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",xe=!c;function Ee(s,e){return c?s():e}async function Se(s,e){return c?s():e}var Q="lynkow-tracker",q=class{config;enabled=true;initialized=false;loading=false;loadPromise=null;constructor(e){this.config=e;}getTrackerUrl(){return `${this.config.baseUrl}/analytics/tracker.js`}loadTracker(){return !c||window.LynkowAnalytics?Promise.resolve():this.loadPromise?this.loadPromise:(this.loading=true,this.loadPromise=new Promise((e,t)=>{if(document.getElementById(Q)){let o=setInterval(()=>{window.LynkowAnalytics&&(clearInterval(o),this.loading=false,e());},50);setTimeout(()=>{clearInterval(o),this.loading=false,t(new Error("Tracker script load timeout"));},1e4);return}let n=document.createElement("script");n.id=Q,n.src=this.getTrackerUrl(),n.async=true,n.setAttribute("data-site-id",this.config.siteId),this.config.baseUrl&&n.setAttribute("data-api-url",this.config.baseUrl);try{let o=localStorage.getItem("_lkw_consent_mode");o&&n.setAttribute("data-consent-mode",o);}catch{}n.onload=()=>{this.loading=false,setTimeout(()=>{window.LynkowAnalytics?e():t(new Error("Tracker script loaded but LynkowAnalytics not found"));},0);},n.onerror=()=>{this.loading=false,t(new Error("Failed to load tracker script"));},document.head.appendChild(n);}),this.loadPromise)}async init(){if(!(!c||this.initialized))try{await this.loadTracker(),window.LynkowAnalytics&&!this.initialized&&(this.initialized=!0);}catch(e){console.error("[Lynkow] Failed to initialize analytics:",e);}}async trackEvent(e){!c||!this.enabled||(await this.init(),window.LynkowAnalytics&&window.LynkowAnalytics.track(e));}async trackPageview(e){!c||!this.enabled||(await this.init(),window.LynkowAnalytics&&window.LynkowAnalytics.track({type:"pageview",path:e?.path||window.location.pathname,title:e?.title||document.title,referrer:e?.referrer||document.referrer}));}enable(){this.enabled=true;}disable(){this.enabled=false;}isEnabled(){return this.enabled}isInitialized(){return this.initialized&&!!window.LynkowAnalytics}getTracker(){if(c)return window.LynkowAnalytics}destroy(){if(!c)return;document.getElementById(Q)?.remove(),this.initialized=false,this.loadPromise=null;}};function Te(s){let e=s.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);if(!e||(e[4]!==void 0?parseFloat(e[4]):1)===0)return null;let n=parseInt(e[1],10),o=parseInt(e[2],10),r=parseInt(e[3],10);return (.299*n+.587*o+.114*r)/255}function w(){if(!c)return "light";let s=document.documentElement,e=document.body;for(let t of [s,e])for(let n of ["data-theme","data-mode","data-color-scheme"]){let o=t.getAttribute(n)?.toLowerCase();if(o){if(o.includes("dark"))return "dark";if(o.includes("light"))return "light"}}if(s.classList.contains("dark")||e.classList.contains("dark"))return "dark";try{let t=getComputedStyle(s).colorScheme;if(t){let n=t.toLowerCase().trim();if(n.startsWith("dark"))return "dark";if(n.startsWith("light"))return "light"}}catch{}try{let t=getComputedStyle(e).backgroundColor,n=Te(t);if(n!==null)return n<.5?"dark":"light"}catch{}try{if(window.matchMedia("(prefers-color-scheme: dark)").matches)return "dark"}catch{}return "light"}function $(s){if(!c)return ()=>{};let e=w(),t=[],n=()=>{let i=w();i!==e&&(e=i,s(i));},o=new MutationObserver(n),r={attributes:true,attributeFilter:["data-theme","data-mode","data-color-scheme","class","style"]};o.observe(document.documentElement,r),o.observe(document.body,r),t.push(()=>o.disconnect());try{let i=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>n();i.addEventListener("change",a),t.push(()=>i.removeEventListener("change",a));}catch{}return ()=>t.forEach(i=>i())}var z="_lkw_consent",Le=365*24*60*60*1e3,me="lkw-script-",Z={necessary:true,analytics:false,marketing:false,preferences:false},N=class{config;events;bannerElement=null;preferencesElement=null;configCache=null;injectedScriptIds=new Set;themeCleanup=null;constructor(e,t){this.config=e,this.events=t;}async getConfig(){if(this.configCache)return this.configCache;let e=`${this.config.baseUrl}/public/${this.config.siteId}/cookie-consent/config`,t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"},...this.config.fetchOptions});if(!t.ok)throw new Error(`Failed to fetch consent config: ${t.status}`);let n=await t.json();return this.configCache=n.data,this.configCache}async logConsent(e,t){let n=`${this.config.baseUrl}/public/${this.config.siteId}/cookie-consent/logs`;await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({visitorId:this.getOrCreateVisitorId(),action:t||this.inferAction(e),consentGiven:e,pageUrl:c?window.location.href:void 0}),...this.config.fetchOptions}).catch(()=>{});}getOrCreateVisitorId(){if(!c)return "server";let e="_lkw_vid";try{let t=localStorage.getItem(e);return t||(t=crypto.randomUUID(),localStorage.setItem(e,t)),t}catch{return crypto.randomUUID()}}inferAction(e){let t=Object.entries(e).filter(([r])=>r!=="necessary"),n=t.every(([,r])=>r===true),o=t.every(([,r])=>r===false);return n?"accept_all":o?"reject_all":"customize"}getStoredConsent(){if(!c)return null;try{let e=localStorage.getItem(z);if(e){let t=JSON.parse(e);return t.choices?t.timestamp&&Date.now()-t.timestamp>Le?(localStorage.removeItem(z),null):t.choices:t}}catch{}return null}saveConsent(e){if(c){try{localStorage.setItem(z,JSON.stringify({choices:e,timestamp:Date.now()}));}catch{}this.events.emit("consent-changed",e),document.dispatchEvent(new CustomEvent("lynkow:consent:update",{detail:e}));}}show(){c&&this.getConfig().then(e=>{if(!e.enabled)return;try{e.consentMode&&localStorage.setItem("_lkw_consent_mode",e.consentMode);}catch{}let t=this.getStoredConsent();if(t){this.activateScripts(t);return}if(this.bannerElement)return;this.injectBannerStylesOnce();let n=document.createElement("div");n.innerHTML=this.createBannerHTML(e),this.bannerElement=n.firstElementChild,document.body.appendChild(this.bannerElement),this.attachBannerEvents(),e.theme==="auto"&&!this.themeCleanup&&(this.themeCleanup=$(o=>{this.updateConsentTheme(o);}));});}hide(){c&&(this.bannerElement?.remove(),this.bannerElement=null,this.cleanupThemeObserverIfIdle());}showPreferences(){c&&(this.preferencesElement||this.getConfig().then(e=>{let t=this.getCategories(),n=document.createElement("div");n.innerHTML=this.createPreferencesHTML(e,t),this.preferencesElement=n.firstElementChild,document.body.appendChild(this.preferencesElement),this.attachPreferencesEvents(e),e.theme==="auto"&&!this.themeCleanup&&(this.themeCleanup=$(o=>{this.updateConsentTheme(o);}));}));}getCategories(){return c?this.getStoredConsent()||{...Z}:{...Z}}hasConsented(){return c?this.getStoredConsent()!==null:false}acceptAll(){if(!c)return;let e={necessary:true,analytics:true,marketing:true,preferences:true};this.saveConsent(e),this.logConsent(e,"accept_all"),this.activateScripts(e),this.hide();}rejectAll(){if(!c)return;let e={necessary:true,analytics:false,marketing:false,preferences:false};this.saveConsent(e),this.logConsent(e,"reject_all"),this.hide();}setCategories(e){if(!c)return;let n={...this.getCategories(),...e,necessary:true};this.saveConsent(n),this.logConsent(n,"customize"),this.activateScripts(n);}reset(){if(c){this.removeInjectedScripts();try{localStorage.removeItem(z);}catch{}this.events.emit("consent-changed",{...Z}),this.show();}}activateScripts(e){if(this.configCache?.thirdPartyScripts?.length)for(let[t,n]of Object.entries(e))n&&this.injectScriptsForCategory(t,this.configCache.thirdPartyScripts);}injectScriptsForCategory(e,t){for(let n of t){if(n.category!==e||this.injectedScriptIds.has(n.id))continue;this.injectedScriptIds.add(n.id);let o=document.createElement("div");o.innerHTML=n.script;let r=Array.from(o.children);for(let i=0;i<r.length;i++){let a=r[i],p=`${me}${n.id}-${i}`;if(a.tagName==="SCRIPT"){let g=document.createElement("script");for(let u of Array.from(a.attributes))g.setAttribute(u.name,u.value);a.textContent&&(g.textContent=a.textContent),g.id=p,document.head.appendChild(g);}else a.id=p,document.body.appendChild(a);}}}removeInjectedScripts(){for(let e of this.injectedScriptIds){let t=0,n;for(;n=document.getElementById(`${me}${e}-${t}`);)n.remove(),t++;}this.injectedScriptIds.clear();}cleanupThemeObserverIfIdle(){!this.bannerElement&&!this.preferencesElement&&(this.themeCleanup?.(),this.themeCleanup=null);}updateConsentTheme(e){let t=this.configCache?this.resolveColors(this.configCache,e):{bgColor:e==="dark"?"#18181b":"#ffffff",textColor:e==="dark"?"#f4f4f5":"#1a1a1a"},{bgColor:n,textColor:o}=t;if(this.bannerElement&&(this.bannerElement.style.background=n,this.bannerElement.style.color=o),this.preferencesElement){let r=this.preferencesElement.querySelector(":scope > div");r&&(r.style.background=n,r.style.color=o);}}resolveTheme(e){return e==="auto"?w():e==="dark"?"dark":"light"}resolveColors(e,t){if(e.themeStyles?.[t])return e.themeStyles[t];let n=t==="dark";return {primaryColor:e.primaryColor||"#0066cc",bgColor:n?"#18181b":"#ffffff",textColor:n?"#f4f4f5":"#1a1a1a"}}contrastColor(e){let t=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),o=parseInt(e.slice(5,7),16);return (.299*t+.587*n+.114*o)/255>.5?"#000000":"#ffffff"}injectBannerStylesOnce(){if(document.getElementById("lynkow-consent-styles"))return;let e=document.createElement("style");e.id="lynkow-consent-styles",e.textContent=`
2
2
  #lynkow-consent-banner {
3
3
  box-sizing: border-box;
4
4
  max-height: calc(100vh - 40px);
@@ -58,7 +58,7 @@
58
58
  ">
59
59
  <div class="lynkow-consent-row" style="display: flex; align-items: center; gap: 16px; flex-wrap: wrap;">
60
60
  <p style="margin: 0; line-height: 1.5; flex: 1; min-width: 200px;">
61
- ${_.description}${(()=>{let se=e.cookiePolicyUrl||e.privacyPolicyUrl;if(!se)return "";let we=_.privacyPolicy||"En savoir plus";return ` <a href="${se}" target="_blank" rel="noopener" style="text-decoration: underline; color: inherit;">${we}</a>`})()}
61
+ ${_.description}${(()=>{let ie=e.cookiePolicyUrl||e.privacyPolicyUrl;if(!ie)return "";let be=_.privacyPolicy||"En savoir plus";return ` <a href="${ie}" target="_blank" rel="noopener" style="text-decoration: underline; color: inherit;">${be}</a>`})()}
62
62
  </p>
63
63
  <div class="lynkow-consent-actions" style="display: flex; gap: 8px; align-items: center; flex-wrap: wrap;">
64
64
  <button id="lynkow-consent-accept" style="
@@ -162,7 +162,7 @@
162
162
  </form>
163
163
  </div>
164
164
  </div>
165
- `}attachBannerEvents(){let e=document.getElementById("lynkow-consent-accept"),t=document.getElementById("lynkow-consent-reject"),n=document.getElementById("lynkow-consent-preferences");e?.addEventListener("click",()=>{this.acceptAll();}),t?.addEventListener("click",()=>{this.rejectAll();}),n?.addEventListener("click",()=>{this.showPreferences();});}attachPreferencesEvents(e){let t=document.getElementById("lynkow-consent-form"),n=document.getElementById("lynkow-consent-close"),o=document.getElementById("lynkow-consent-preferences-modal");t?.addEventListener("submit",r=>{r.preventDefault();let i=new FormData(t),a={necessary:true,analytics:i.has("analytics"),marketing:i.has("marketing"),preferences:i.has("preferences")};this.setCategories(a),this.hide(),this.preferencesElement?.remove(),this.preferencesElement=null,this.cleanupThemeObserverIfIdle();}),n?.addEventListener("click",()=>{this.preferencesElement?.remove(),this.preferencesElement=null,this.cleanupThemeObserverIfIdle();}),o?.addEventListener("click",r=>{r.target===o&&(this.preferencesElement?.remove(),this.preferencesElement=null,this.cleanupThemeObserverIfIdle());});}destroy(){this.themeCleanup?.(),this.themeCleanup=null,this.hide(),this.preferencesElement?.remove(),this.preferencesElement=null,this.removeInjectedScripts();}};var Z="lynkow-badge-container",ee="lynkow-badge-styles",H=class extends m{containerElement=null;themeCleanup=null;async inject(){if(c&&!document.getElementById(Z))try{let{data:e}=await this.getWithCache("branding:badge","/branding/badge",void 0,void 0,d.LONG);if(!document.getElementById(ee)){let n=document.createElement("style");n.id=ee,n.textContent=e.css,document.head.appendChild(n);}let t=document.createElement("div");t.id=Z,t.innerHTML=e.html,w()==="light"&&t.classList.add("lynkow-badge-light"),document.body.appendChild(t),this.containerElement=t,this.themeCleanup=$(n=>{this.containerElement&&this.containerElement.classList.toggle("lynkow-badge-light",n==="light");});}catch{}}remove(){c&&(this.themeCleanup?.(),this.themeCleanup=null,this.containerElement?.remove(),this.containerElement=null,document.getElementById(ee)?.remove());}isVisible(){return c?document.getElementById(Z)!==null:false}destroy(){this.remove();}};var te="lynkow-enhancements-styles",ne="lynkow-enhancements-code-block-styles",oe="data-lynkow-clone",Le=new Set(["","module","text/plain","text/javascript","application/javascript","application/ecmascript","text/ecmascript","application/x-javascript","application/x-ecmascript"]),Oe='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>',Ie='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>',Pe=`
165
+ `}attachBannerEvents(){let e=document.getElementById("lynkow-consent-accept"),t=document.getElementById("lynkow-consent-reject"),n=document.getElementById("lynkow-consent-preferences");e?.addEventListener("click",()=>{this.acceptAll();}),t?.addEventListener("click",()=>{this.rejectAll();}),n?.addEventListener("click",()=>{this.showPreferences();});}attachPreferencesEvents(e){let t=document.getElementById("lynkow-consent-form"),n=document.getElementById("lynkow-consent-close"),o=document.getElementById("lynkow-consent-preferences-modal");t?.addEventListener("submit",r=>{r.preventDefault();let i=new FormData(t),a={necessary:true,analytics:i.has("analytics"),marketing:i.has("marketing"),preferences:i.has("preferences")};this.setCategories(a),this.hide(),this.preferencesElement?.remove(),this.preferencesElement=null,this.cleanupThemeObserverIfIdle();}),n?.addEventListener("click",()=>{this.preferencesElement?.remove(),this.preferencesElement=null,this.cleanupThemeObserverIfIdle();}),o?.addEventListener("click",r=>{r.target===o&&(this.preferencesElement?.remove(),this.preferencesElement=null,this.cleanupThemeObserverIfIdle());});}destroy(){this.themeCleanup?.(),this.themeCleanup=null,this.hide(),this.preferencesElement?.remove(),this.preferencesElement=null,this.removeInjectedScripts();}};var ee="lynkow-badge-container",te="lynkow-badge-styles",H=class extends m{containerElement=null;themeCleanup=null;async inject(){if(c&&!document.getElementById(ee))try{let{data:e}=await this.getWithCache("branding:badge","/branding/badge",void 0,void 0,d.LONG);if(!document.getElementById(te)){let n=document.createElement("style");n.id=te,n.textContent=e.css,document.head.appendChild(n);}let t=document.createElement("div");t.id=ee,t.innerHTML=e.html,w()==="light"&&t.classList.add("lynkow-badge-light"),document.body.appendChild(t),this.containerElement=t,this.themeCleanup=$(n=>{this.containerElement&&this.containerElement.classList.toggle("lynkow-badge-light",n==="light");});}catch{}}remove(){c&&(this.themeCleanup?.(),this.themeCleanup=null,this.containerElement?.remove(),this.containerElement=null,document.getElementById(te)?.remove());}isVisible(){return c?document.getElementById(ee)!==null:false}destroy(){this.remove();}};var ne="lynkow-enhancements-styles",oe="lynkow-enhancements-code-block-styles",re="data-lynkow-clone",Oe=new Set(["","module","text/plain","text/javascript","application/javascript","application/ecmascript","text/ecmascript","application/x-javascript","application/x-ecmascript"]),Ie='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>',Pe='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>',Be=`
166
166
  /*
167
167
  * Lynkow Content Enhancements, generic CSS reset & inline-style preservation.
168
168
  * Always injected. Independent of code-block styling.
@@ -179,7 +179,7 @@
179
179
  h1, h2, h3, h4, h5, h6, p, blockquote {
180
180
  text-align: inherit;
181
181
  }
182
- `,Be=`
182
+ `,$e=`
183
183
  /*
184
184
  * Lynkow Content Enhancements, code-block styling + copy button.
185
185
  * Variable-based: consumers can override any --lynkow-code-* var without !important.
@@ -289,6 +289,6 @@
289
289
  line-height: 1.5;
290
290
  color: var(--lynkow-code-fg);
291
291
  }
292
- `,M=class{initialized=false;observer=null;pendingFrame=null;handleWidgetResize=e=>{if(!e.data||e.data.type!=="lynkow-widget-resize")return;document.querySelectorAll('iframe[src*="/widgets/calendar/"]').forEach(n=>{n.contentWindow===e.source&&(n.style.height=e.data.height+"px");});};injectGenericStyles(){if(!c||document.getElementById(te))return;let e=document.createElement("style");e.id=te,e.textContent=Pe,document.head.appendChild(e);}injectCodeBlockStyles(){if(!c||document.getElementById(ne))return;let e=document.createElement("style");e.id=ne,e.textContent=Be,document.head.appendChild(e);}async handleCopyClick(e){let t=e.closest(".code-block");if(!t)return;let n=t.querySelector("code");if(!n)return;let o=n.textContent||"";try{await navigator.clipboard.writeText(o),e.classList.add("copied"),e.innerHTML=Ie,setTimeout(()=>{e.classList.remove("copied"),e.innerHTML=Oe;},2e3);}catch(r){console.error("Lynkow SDK: Failed to copy code",r);}}bindCodeBlockCopy(){if(!c)return;document.querySelectorAll("[data-copy-code]").forEach(t=>{t.dataset.lynkowBound||(t.dataset.lynkowBound="true",t.addEventListener("click",n=>{n.preventDefault(),this.handleCopyClick(t);}));});}activateScripts(e){if(!c)return;let n=(e instanceof HTMLElement?e:document.body).querySelectorAll("script:not([data-lynkow-activated])"),o=Array.from(n).filter(r=>!r.src&&r.isConnected&&Le.has(r.type.toLowerCase()));o.length!==0&&(document.head.querySelectorAll(`script[${oe}]`).forEach(r=>r.remove()),o.forEach(r=>{r.setAttribute("data-lynkow-activated","true");let i=document.createElement("script"),a=r.attributes;for(let p=0;p<a.length;p++){let g=a[p];g&&(g.name==="type"&&g.value==="text/plain"||g.name!=="data-lynkow-activated"&&i.setAttribute(g.name,g.value));}i.textContent=r.textContent,i.setAttribute(oe,""),document.head.appendChild(i);}));}init(e={}){if(!c||this.initialized)return;let{codeBlocks:t=true}=e;this.injectGenericStyles(),this.activateScripts(),window.addEventListener("message",this.handleWidgetResize),t&&(this.injectCodeBlockStyles(),this.bindCodeBlockCopy()),this.observer||(this.observer=new MutationObserver(()=>{this.pendingFrame===null&&(this.pendingFrame=requestAnimationFrame(()=>{this.pendingFrame=null,this.activateScripts(),t&&this.bindCodeBlockCopy();}));}),this.observer.observe(document.body,{childList:true,subtree:true})),this.initialized=true;}isInitialized(){return this.initialized}destroy(){c&&(window.removeEventListener("message",this.handleWidgetResize),this.pendingFrame!==null&&(cancelAnimationFrame(this.pendingFrame),this.pendingFrame=null),this.observer&&(this.observer.disconnect(),this.observer=null),document.getElementById(te)?.remove(),document.getElementById(ne)?.remove(),document.head.querySelectorAll(`script[${oe}]`).forEach(e=>e.remove()),this.initialized=false);}};var U=class{srcset(e,t={}){if(!e)return "";let{widths:n=[400,800,1200,1920],fit:o="scale-down",quality:r=80,gravity:i}=t,a=this.parseImageUrl(e);return a?n.map(p=>{let g=[`w=${p}`,`fit=${o}`,"format=auto",`quality=${r}`,i&&`gravity=${i}`].filter(Boolean).join(",");return `${a.cdnBase}/cdn-cgi/image/${g}/${a.relativePath} ${p}w`}).join(", "):""}transform(e,t={}){if(!e)return "";let n=this.parseImageUrl(e);if(!n)return e||"";let o=[t.w&&`w=${t.w}`,t.h&&`h=${t.h}`,`fit=${t.fit||"scale-down"}`,`format=${t.format||"auto"}`,`quality=${t.quality||80}`,t.gravity&&`gravity=${t.gravity}`,t.dpr&&`dpr=${t.dpr}`].filter(Boolean).join(",");return `${n.cdnBase}/cdn-cgi/image/${o}/${n.relativePath}`}parseImageUrl(e){let t=e.indexOf("/cdn-cgi/image/");if(t!==-1){let r=e.substring(0,t),i=e.substring(t+15),a=i.indexOf("/");if(a===-1)return null;let p=i.substring(a+1);return {cdnBase:r,relativePath:p}}let n=e.indexOf("/sites/");if(n!==-1){let r=e.substring(0,n),i=e.substring(n+1);return {cdnBase:r,relativePath:i}}let o=e.indexOf("/avatars/");if(o!==-1){let r=e.substring(0,o),i=e.substring(o+1);return {cdnBase:r,relativePath:i}}return null}};var A=class extends m{async search(e,t){return this.get("/search",{q:e,locale:t?.locale,category:t?.category,tag:t?.tag,page:t?.page,limit:t?.limit},t)}async getConfig(e){return (await this.getWithCache("search-config","/search/config",void 0,e,d.MEDIUM)).data}async listProfiles(e){return (await this.getWithCache("search-profiles","/search/profiles",void 0,e,d.MEDIUM)).data}async searchByProfile(e,t,n){return this.get(`/search/${encodeURIComponent(e)}`,{q:t,locale:n?.locale,category:n?.category,tag:n?.tag,page:n?.page,limit:n?.limit},n)}};var $e=300*1e3,Ae="lynkow_cache_",C=new Map;function me(s={}){let e=s.defaultTtl??$e,t=s.prefix??Ae;function n(u){return `${t}${u}`}function o(u){return Date.now()>u.expiresAt}function r(u){let l=n(u);if(c)try{let f=localStorage.getItem(l);if(!f)return null;let y=JSON.parse(f);return o(y)?(localStorage.removeItem(l),null):y.value}catch{return null}let h=C.get(l);return h?o(h)?(C.delete(l),null):h.value:null}function i(u,l,h=e){let f=n(u),y={value:l,expiresAt:Date.now()+h};if(c){try{localStorage.setItem(f,JSON.stringify(y));}catch{}return}C.set(f,y);}function a(u){let l=n(u);if(c){try{localStorage.removeItem(l);}catch{}return}C.delete(l);}function p(u){if(c){try{let l=[];for(let h=0;h<localStorage.length;h++){let f=localStorage.key(h);f&&f.startsWith(t)&&(!u||f.includes(u))&&l.push(f);}l.forEach(h=>localStorage.removeItem(h));}catch{}return}if(u)for(let l of C.keys())l.startsWith(t)&&l.includes(u)&&C.delete(l);else for(let l of C.keys())l.startsWith(t)&&C.delete(l);}async function g(u,l,h=e){let f=r(u);if(f!==null)return f;let y=await l();return i(u,y,h),y}return {get:r,set:i,remove:a,invalidate:p,getOrSet:g}}function ue(s){let e=s.prefix||"[Lynkow]";return {debug(...t){s.debug&&console.debug(e,...t);},info(...t){console.info(e,...t);},warn(...t){console.warn(e,...t);},error(...t){console.error(e,...t);},log(t,...n){switch(t){case "debug":this.debug(...n);break;case "info":this.info(...n);break;case "warn":this.warn(...n);break;case "error":this.error(...n);break}}}}function ge(){let s=new Map;function e(i,a){return s.has(i)||s.set(i,new Set),s.get(i).add(a),()=>t(i,a)}function t(i,a){let p=s.get(i);p&&p.delete(a);}function n(i,a){let p=s.get(i);if(p)for(let g of p)try{g(a);}catch(u){console.error(`[Lynkow] Error in event listener for "${i}":`,u);}}function o(i,a){let p=(g=>{t(i,p),a(g);});return e(i,p)}function r(i){i?s.delete(i):s.clear();}return {on:e,off:t,emit:n,once:o,removeAllListeners:r}}var he="lynkow_locale";function re(s,e){let t=s.toLowerCase();return e.find(n=>n.toLowerCase()===t)??null}function fe(s,e){if(!c)return e;let t=_e();if(t&&s.includes(t))return t;let n=Fe(s);if(n)return n;let o=document.documentElement.lang;if(o){let r=re(o,s);if(r)return r;let i=o.split("-")[0]?.toLowerCase();if(i){let a=re(i,s);if(a)return a}}return e}function _e(){if(!c)return null;try{return localStorage.getItem(he)}catch{return null}}function ye(s){if(c)try{localStorage.setItem(he,s);}catch{}}function Fe(s){if(!c)return null;let t=window.location.pathname.split("/").filter(Boolean);if(t.length>0){let n=t[0];if(n){let o=re(n,s);if(o)return o}}return null}function ve(s,e){return e.includes(s)}var Ce="https://api.lynkow.com";function De(s){if(!s.siteId)throw new Error("Lynkow SDK: siteId is required");let e=s.cache===true?me():void 0,t=ue({debug:s.debug??false}),n=ge(),o=(s.baseUrl||Ce).replace(/\/$/,""),r={siteId:s.siteId,baseUrl:o,locale:s.locale,fetchOptions:s.fetchOptions||{},...e?{cache:e}:{}},i={locale:s.locale||"fr",availableLocales:["fr"],siteConfig:null,initialized:false},a={contents:new b(r),categories:new k(r),tags:new x(r),pages:new R(r),blocks:new E(r),forms:new S(r),reviews:new T(r),site:new L(r),legal:new O(r),cookies:new I(r),seo:new P(r),paths:new B(r),analytics:new q(r),consent:new N(r,n),branding:new H(r),enhancements:new M,media:new U,search:new A(r)};function p(l){r.locale=l;}async function g(){if(!i.initialized)try{let l=await a.site.getConfig();i.siteConfig=l;let h=l.defaultLocale||"fr";if(i.availableLocales=l.enabledLocales||[h],c&&!s.locale){let f=fe(i.availableLocales,h);i.locale=f,p(f);}i.initialized=!0,t.debug("Client initialized",{locale:i.locale,availableLocales:i.availableLocales}),c&&(a.analytics.init(),a.consent.hasConsented()||a.consent.show(),l.showBranding&&await a.branding.inject(),a.enhancements.init()),n.emit("ready",void 0);}catch(l){t.error("Failed to initialize client",l),n.emit("error",l);}}return c&&setTimeout(()=>{a.enhancements.init(),g();},0),{...a,globals:a.blocks,config:Object.freeze({siteId:s.siteId,baseUrl:o,debug:s.debug??false,cache:s.cache===true}),get locale(){return i.locale},get availableLocales(){return [...i.availableLocales]},setLocale(l){if(!ve(l,i.availableLocales)){t.warn(`Locale "${l}" is not available. Available: ${i.availableLocales.join(", ")}`);return}l!==i.locale&&(i.locale=l,p(l),c&&ye(l),e?.invalidate(),n.emit("locale-changed",l),t.debug("Locale changed to",l));},clearCache(){e?.invalidate(),t.debug("Cache cleared");},destroy(){a.analytics.destroy(),a.consent.destroy(),a.branding.destroy(),a.enhancements.destroy(),e?.invalidate(),n.removeAllListeners(),t.debug("Client destroyed");},on(l,h){return n.on(l,h)}}}function qe(s){if(!s.siteId)throw new Error("Lynkow SDK: siteId is required");let e={siteId:s.siteId,baseUrl:(s.baseUrl||Ce).replace(/\/$/,""),locale:s.locale,fetchOptions:s.fetchOptions||{}};return {contents:new b(e),categories:new k(e),tags:new x(e),pages:new R(e),blocks:new E(e),forms:new S(e),reviews:new T(e),site:new L(e),legal:new O(e),cookies:new I(e),seo:new P(e),paths:new B(e),search:new A(e)}}function Ne(s){return s.type==="content"}function He(s){return s.type==="category"}function Me(s){if(!s||s.length===0)return "";let e=s.map(o=>{let{["@context"]:r,...i}=o;return i});return `<script type="application/ld+json">${JSON.stringify({"@context":"https://schema.org","@graph":e}).replace(/<\/(script)/gi,"<\\/$1")}</script>`}function Ue(s,e){let t=s??[],n=e??[];if(n.length===0)return [...t];let o=new Set;for(let r of t){let i=r?.["@id"];typeof i=="string"&&o.add(i);}for(let r of n){let i=r?.["@id"];typeof i=="string"&&o.has(i)&&console.warn(`[lynkow] @id collision in mergeIntoGraph: "${i}" appears in both the server graph and your custom nodes. Google may merge them, which can duplicate properties on the rendered entity. Prefix custom @ids with the page URL to make them unique.`);}return [...t,...n]}
293
- exports.AnalyticsService=q;exports.BlocksService=E;exports.BrandingService=H;exports.CategoriesService=k;exports.ConsentService=N;exports.ContentsService=b;exports.CookiesService=I;exports.EnhancementsService=M;exports.FormsService=S;exports.LegalService=O;exports.LynkowError=v;exports.MediaHelperService=U;exports.PagesService=R;exports.PathsService=B;exports.ReviewsService=T;exports.SearchService=A;exports.SeoService=P;exports.SiteService=L;exports.TagsService=x;exports.browserOnly=Re;exports.browserOnlyAsync=Ee;exports.createClient=De;exports.createLynkowClient=qe;exports.detectSiteTheme=w;exports.isBrowser=c;exports.isCategoryResolve=He;exports.isContentResolve=Ne;exports.isLynkowError=be;exports.isServer=xe;exports.mergeIntoGraph=Ue;exports.onSiteThemeChange=$;exports.renderJsonLdGraph=Me;//# sourceMappingURL=index.js.map
292
+ `,M=class{initialized=false;observer=null;pendingFrame=null;handleWidgetResize=e=>{if(!e.data||e.data.type!=="lynkow-widget-resize")return;document.querySelectorAll('iframe[src*="/widgets/calendar/"]').forEach(n=>{n.contentWindow===e.source&&(n.style.height=e.data.height+"px");});};injectGenericStyles(){if(!c||document.getElementById(ne))return;let e=document.createElement("style");e.id=ne,e.textContent=Be,document.head.appendChild(e);}injectCodeBlockStyles(){if(!c||document.getElementById(oe))return;let e=document.createElement("style");e.id=oe,e.textContent=$e,document.head.appendChild(e);}async handleCopyClick(e){let t=e.closest(".code-block");if(!t)return;let n=t.querySelector("code");if(!n)return;let o=n.textContent||"";try{await navigator.clipboard.writeText(o),e.classList.add("copied"),e.innerHTML=Pe,setTimeout(()=>{e.classList.remove("copied"),e.innerHTML=Ie;},2e3);}catch(r){console.error("Lynkow SDK: Failed to copy code",r);}}bindCodeBlockCopy(){if(!c)return;document.querySelectorAll("[data-copy-code]").forEach(t=>{t.dataset.lynkowBound||(t.dataset.lynkowBound="true",t.addEventListener("click",n=>{n.preventDefault(),this.handleCopyClick(t);}));});}activateScripts(e){if(!c)return;let n=(e instanceof HTMLElement?e:document.body).querySelectorAll("script:not([data-lynkow-activated])"),o=Array.from(n).filter(r=>!r.src&&r.isConnected&&Oe.has(r.type.toLowerCase()));o.length!==0&&(document.head.querySelectorAll(`script[${re}]`).forEach(r=>r.remove()),o.forEach(r=>{r.setAttribute("data-lynkow-activated","true");let i=document.createElement("script"),a=r.attributes;for(let p=0;p<a.length;p++){let g=a[p];g&&(g.name==="type"&&g.value==="text/plain"||g.name!=="data-lynkow-activated"&&i.setAttribute(g.name,g.value));}i.textContent=r.textContent,i.setAttribute(re,""),document.head.appendChild(i);}));}init(e={}){if(!c||this.initialized)return;let{codeBlocks:t=true}=e;this.injectGenericStyles(),this.activateScripts(),window.addEventListener("message",this.handleWidgetResize),t&&(this.injectCodeBlockStyles(),this.bindCodeBlockCopy()),this.observer||(this.observer=new MutationObserver(()=>{this.pendingFrame===null&&(this.pendingFrame=requestAnimationFrame(()=>{this.pendingFrame=null,this.activateScripts(),t&&this.bindCodeBlockCopy();}));}),this.observer.observe(document.body,{childList:true,subtree:true})),this.initialized=true;}isInitialized(){return this.initialized}destroy(){c&&(window.removeEventListener("message",this.handleWidgetResize),this.pendingFrame!==null&&(cancelAnimationFrame(this.pendingFrame),this.pendingFrame=null),this.observer&&(this.observer.disconnect(),this.observer=null),document.getElementById(ne)?.remove(),document.getElementById(oe)?.remove(),document.head.querySelectorAll(`script[${re}]`).forEach(e=>e.remove()),this.initialized=false);}};var U=class{srcset(e,t={}){if(!e)return "";let{widths:n=[400,800,1200,1920],fit:o="scale-down",quality:r=80,gravity:i}=t,a=this.parseImageUrl(e);return a?n.map(p=>{let g=[`w=${p}`,`fit=${o}`,"format=auto",`quality=${r}`,i&&`gravity=${i}`].filter(Boolean).join(",");return `${a.cdnBase}/cdn-cgi/image/${g}/${a.relativePath} ${p}w`}).join(", "):""}transform(e,t={}){if(!e)return "";let n=this.parseImageUrl(e);if(!n)return e||"";let o=[t.w&&`w=${t.w}`,t.h&&`h=${t.h}`,`fit=${t.fit||"scale-down"}`,`format=${t.format||"auto"}`,`quality=${t.quality||80}`,t.gravity&&`gravity=${t.gravity}`,t.dpr&&`dpr=${t.dpr}`].filter(Boolean).join(",");return `${n.cdnBase}/cdn-cgi/image/${o}/${n.relativePath}`}parseImageUrl(e){let t=e.indexOf("/cdn-cgi/image/");if(t!==-1){let r=e.substring(0,t),i=e.substring(t+15),a=i.indexOf("/");if(a===-1)return null;let p=i.substring(a+1);return {cdnBase:r,relativePath:p}}let n=e.indexOf("/sites/");if(n!==-1){let r=e.substring(0,n),i=e.substring(n+1);return {cdnBase:r,relativePath:i}}let o=e.indexOf("/avatars/");if(o!==-1){let r=e.substring(0,o),i=e.substring(o+1);return {cdnBase:r,relativePath:i}}return null}};var A=class extends m{async search(e,t){return this.get("/search",{q:e,locale:t?.locale,category:t?.category,tag:t?.tag,page:t?.page,limit:t?.limit},t)}async getConfig(e){return (await this.getWithCache("search-config","/search/config",void 0,e,d.MEDIUM)).data}async listProfiles(e){return (await this.getWithCache("search-profiles","/search/profiles",void 0,e,d.MEDIUM)).data}async searchByProfile(e,t,n){return this.get(`/search/${encodeURIComponent(e)}`,{q:t,locale:n?.locale,category:n?.category,tag:n?.tag,page:n?.page,limit:n?.limit},n)}};var Ae=300*1e3,_e="lynkow_cache_",C=new Map;function ue(s={}){let e=s.defaultTtl??Ae,t=s.prefix??_e;function n(u){return `${t}${u}`}function o(u){return Date.now()>u.expiresAt}function r(u){let l=n(u);if(c)try{let f=localStorage.getItem(l);if(!f)return null;let y=JSON.parse(f);return o(y)?(localStorage.removeItem(l),null):y.value}catch{return null}let h=C.get(l);return h?o(h)?(C.delete(l),null):h.value:null}function i(u,l,h=e){let f=n(u),y={value:l,expiresAt:Date.now()+h};if(c){try{localStorage.setItem(f,JSON.stringify(y));}catch{}return}C.set(f,y);}function a(u){let l=n(u);if(c){try{localStorage.removeItem(l);}catch{}return}C.delete(l);}function p(u){if(c){try{let l=[];for(let h=0;h<localStorage.length;h++){let f=localStorage.key(h);f&&f.startsWith(t)&&(!u||f.includes(u))&&l.push(f);}l.forEach(h=>localStorage.removeItem(h));}catch{}return}if(u)for(let l of C.keys())l.startsWith(t)&&l.includes(u)&&C.delete(l);else for(let l of C.keys())l.startsWith(t)&&C.delete(l);}async function g(u,l,h=e){let f=r(u);if(f!==null)return f;let y=await l();return i(u,y,h),y}return {get:r,set:i,remove:a,invalidate:p,getOrSet:g}}function ge(s){let e=s.prefix||"[Lynkow]";return {debug(...t){s.debug&&console.debug(e,...t);},info(...t){console.info(e,...t);},warn(...t){console.warn(e,...t);},error(...t){console.error(e,...t);},log(t,...n){switch(t){case "debug":this.debug(...n);break;case "info":this.info(...n);break;case "warn":this.warn(...n);break;case "error":this.error(...n);break}}}}function he(){let s=new Map;function e(i,a){return s.has(i)||s.set(i,new Set),s.get(i).add(a),()=>t(i,a)}function t(i,a){let p=s.get(i);p&&p.delete(a);}function n(i,a){let p=s.get(i);if(p)for(let g of p)try{g(a);}catch(u){console.error(`[Lynkow] Error in event listener for "${i}":`,u);}}function o(i,a){let p=(g=>{t(i,p),a(g);});return e(i,p)}function r(i){i?s.delete(i):s.clear();}return {on:e,off:t,emit:n,once:o,removeAllListeners:r}}var fe="lynkow_locale";function se(s,e){let t=s.toLowerCase();return e.find(n=>n.toLowerCase()===t)??null}function ye(s,e){if(!c)return e;let t=Fe();if(t&&s.includes(t))return t;let n=De(s);if(n)return n;let o=document.documentElement.lang;if(o){let r=se(o,s);if(r)return r;let i=o.split("-")[0]?.toLowerCase();if(i){let a=se(i,s);if(a)return a}}return e}function Fe(){if(!c)return null;try{return localStorage.getItem(fe)}catch{return null}}function ve(s){if(c)try{localStorage.setItem(fe,s);}catch{}}function De(s){if(!c)return null;let t=window.location.pathname.split("/").filter(Boolean);if(t.length>0){let n=t[0];if(n){let o=se(n,s);if(o)return o}}return null}function Ce(s,e){return e.includes(s)}var we="https://api.lynkow.com";function qe(s){if(!s.siteId)throw new Error("Lynkow SDK: siteId is required");let e=s.cache===true?ue():void 0,t=ge({debug:s.debug??false}),n=he(),o=(s.baseUrl||we).replace(/\/$/,""),r={siteId:s.siteId,baseUrl:o,locale:s.locale,fetchOptions:s.fetchOptions||{},...e?{cache:e}:{}},i={locale:s.locale||"fr",availableLocales:["fr"],siteConfig:null,initialized:false},a={contents:new b(r),categories:new k(r),tags:new R(r),pages:new x(r),blocks:new E(r),forms:new S(r),reviews:new T(r),site:new L(r),legal:new O(r),cookies:new I(r),seo:new P(r),paths:new B(r),analytics:new q(r),consent:new N(r,n),branding:new H(r),enhancements:new M,media:new U,search:new A(r)};function p(l){r.locale=l;}async function g(){if(!i.initialized)try{let l=await a.site.getConfig();i.siteConfig=l;let h=l.defaultLocale||"fr";if(i.availableLocales=l.enabledLocales||[h],c&&!s.locale){let f=ye(i.availableLocales,h);i.locale=f,p(f);}i.initialized=!0,t.debug("Client initialized",{locale:i.locale,availableLocales:i.availableLocales}),c&&(a.analytics.init(),a.consent.hasConsented()||a.consent.show(),l.showBranding&&await a.branding.inject(),a.enhancements.init()),n.emit("ready",void 0);}catch(l){t.error("Failed to initialize client",l),n.emit("error",l);}}return c&&setTimeout(()=>{a.enhancements.init(),g();},0),{...a,globals:a.blocks,config:Object.freeze({siteId:s.siteId,baseUrl:o,debug:s.debug??false,cache:s.cache===true}),get locale(){return i.locale},get availableLocales(){return [...i.availableLocales]},setLocale(l){if(!Ce(l,i.availableLocales)){t.warn(`Locale "${l}" is not available. Available: ${i.availableLocales.join(", ")}`);return}l!==i.locale&&(i.locale=l,p(l),c&&ve(l),e?.invalidate(),n.emit("locale-changed",l),t.debug("Locale changed to",l));},clearCache(){e?.invalidate(),t.debug("Cache cleared");},destroy(){a.analytics.destroy(),a.consent.destroy(),a.branding.destroy(),a.enhancements.destroy(),e?.invalidate(),n.removeAllListeners(),t.debug("Client destroyed");},on(l,h){return n.on(l,h)}}}function Ne(s){if(!s.siteId)throw new Error("Lynkow SDK: siteId is required");let e={siteId:s.siteId,baseUrl:(s.baseUrl||we).replace(/\/$/,""),locale:s.locale,fetchOptions:s.fetchOptions||{}};return {contents:new b(e),categories:new k(e),tags:new R(e),pages:new x(e),blocks:new E(e),forms:new S(e),reviews:new T(e),site:new L(e),legal:new O(e),cookies:new I(e),seo:new P(e),paths:new B(e),search:new A(e)}}function He(s){return s.type==="content"}function Me(s){return s.type==="category"}function Ue(s){if(!s||s.length===0)return "";let e=s.map(o=>{let{["@context"]:r,...i}=o;return i});return `<script type="application/ld+json">${JSON.stringify({"@context":"https://schema.org","@graph":e}).replace(/<\/(script)/gi,"<\\/$1")}</script>`}function je(s,e){let t=s??[],n=e??[];if(n.length===0)return [...t];let o=new Set;for(let r of t){let i=r?.["@id"];typeof i=="string"&&o.add(i);}for(let r of n){let i=r?.["@id"];typeof i=="string"&&o.has(i)&&console.warn(`[lynkow] @id collision in mergeIntoGraph: "${i}" appears in both the server graph and your custom nodes. Google may merge them, which can duplicate properties on the rendered entity. Prefix custom @ids with the page URL to make them unique.`);}return [...t,...n]}
293
+ exports.AnalyticsService=q;exports.BlocksService=E;exports.BrandingService=H;exports.CategoriesService=k;exports.ConsentService=N;exports.ContentsService=b;exports.CookiesService=I;exports.EnhancementsService=M;exports.FormsService=S;exports.LegalService=O;exports.LynkowError=v;exports.MediaHelperService=U;exports.PagesService=x;exports.PathsService=B;exports.ReviewsService=T;exports.SearchService=A;exports.SeoService=P;exports.SiteService=L;exports.TagsService=R;exports.browserOnly=Ee;exports.browserOnlyAsync=Se;exports.createClient=qe;exports.createLynkowClient=Ne;exports.detectSiteTheme=w;exports.isBrowser=c;exports.isCategoryResolve=Me;exports.isContentResolve=He;exports.isLynkowError=ke;exports.isServer=xe;exports.mergeIntoGraph=je;exports.onSiteThemeChange=$;exports.renderJsonLdGraph=Ue;//# sourceMappingURL=index.js.map
294
294
  //# sourceMappingURL=index.js.map