payload-live-preview 1.8.0 → 2.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/README.md +301 -93
  2. package/dist/adapters/astro/PreviewBoundary.astro +66 -0
  3. package/dist/adapters/astro/RichText.astro +6 -0
  4. package/dist/adapters/astro/index.d.ts +165 -134
  5. package/dist/adapters/astro/index.js +1 -1
  6. package/dist/adapters/astro/index.js.map +1 -1
  7. package/dist/adapters/astro/middleware-entry.d.ts +4 -9
  8. package/dist/adapters/astro/middleware-entry.js +1 -1
  9. package/dist/adapters/astro/middleware-entry.js.map +1 -1
  10. package/dist/adapters/nextjs/index.d.ts +13 -80
  11. package/dist/adapters/nextjs/index.js +1 -1
  12. package/dist/adapters/nextjs/index.js.map +1 -1
  13. package/dist/adapters/nuxt/index.d.ts +46 -106
  14. package/dist/adapters/nuxt/index.js +1 -1
  15. package/dist/adapters/nuxt/index.js.map +1 -1
  16. package/dist/adapters/sveltekit/index.d.ts +10 -75
  17. package/dist/adapters/sveltekit/index.js +1 -1
  18. package/dist/adapters/sveltekit/index.js.map +1 -1
  19. package/dist/client.cjs +2 -0
  20. package/dist/client.cjs.map +1 -0
  21. package/dist/client.d.cts +747 -0
  22. package/dist/client.d.ts +747 -0
  23. package/dist/client.js +2 -0
  24. package/dist/client.js.map +1 -0
  25. package/dist/codegen-astro.d.ts +5 -27
  26. package/dist/codegen-astro.js +1 -1
  27. package/dist/codegen-astro.js.map +1 -1
  28. package/dist/codegen-cli.d.ts +3 -16
  29. package/dist/codegen-cli.js +1 -1
  30. package/dist/codegen-cli.js.map +1 -1
  31. package/dist/codegen.cjs +1 -1
  32. package/dist/codegen.cjs.map +1 -1
  33. package/dist/codegen.d.cts +37 -124
  34. package/dist/codegen.d.ts +37 -124
  35. package/dist/codegen.js +1 -1
  36. package/dist/codegen.js.map +1 -1
  37. package/dist/core.cjs +1 -1
  38. package/dist/core.cjs.map +1 -1
  39. package/dist/core.d.cts +647 -1100
  40. package/dist/core.d.ts +647 -1100
  41. package/dist/core.js +1 -1
  42. package/dist/core.js.map +1 -1
  43. package/dist/doctor-cli.d.ts +3 -28
  44. package/dist/doctor-cli.js +1 -1
  45. package/dist/doctor-cli.js.map +1 -1
  46. package/dist/doctor.d.ts +16 -32
  47. package/dist/doctor.js +1 -1
  48. package/dist/doctor.js.map +1 -1
  49. package/dist/fragment.cjs +2 -0
  50. package/dist/fragment.cjs.map +1 -0
  51. package/dist/fragment.d.cts +333 -0
  52. package/dist/fragment.d.ts +333 -0
  53. package/dist/fragment.js +2 -0
  54. package/dist/fragment.js.map +1 -0
  55. package/dist/index.cjs +1 -1
  56. package/dist/index.cjs.map +1 -1
  57. package/dist/index.d.cts +885 -1531
  58. package/dist/index.d.ts +885 -1531
  59. package/dist/index.js +1 -1
  60. package/dist/index.js.map +1 -1
  61. package/dist/lexical.cjs +2 -0
  62. package/dist/lexical.cjs.map +1 -0
  63. package/dist/lexical.d.cts +90 -0
  64. package/dist/lexical.d.ts +90 -0
  65. package/dist/lexical.js +2 -0
  66. package/dist/lexical.js.map +1 -0
  67. package/dist/middleware-CEPsY1P7.d.ts +40 -0
  68. package/dist/migrate.d.ts +73 -0
  69. package/dist/migrate.js +2 -0
  70. package/dist/migrate.js.map +1 -0
  71. package/dist/options-CEzzfHJu.d.ts +197 -0
  72. package/dist/payload.cjs +1 -1
  73. package/dist/payload.cjs.map +1 -1
  74. package/dist/payload.d.cts +11 -80
  75. package/dist/payload.d.ts +11 -80
  76. package/dist/payload.js +1 -1
  77. package/dist/payload.js.map +1 -1
  78. package/dist/plugins.cjs +2 -0
  79. package/dist/plugins.cjs.map +1 -0
  80. package/dist/plugins.d.cts +509 -0
  81. package/dist/plugins.d.ts +509 -0
  82. package/dist/plugins.js +2 -0
  83. package/dist/plugins.js.map +1 -0
  84. package/dist/{probe-tMHdim5y.d.ts → probe-CYtvj_Lm.d.ts} +43 -77
  85. package/dist/server.cjs +2 -0
  86. package/dist/server.cjs.map +1 -0
  87. package/dist/server.d.cts +435 -0
  88. package/dist/server.d.ts +435 -0
  89. package/dist/server.js +2 -0
  90. package/dist/server.js.map +1 -0
  91. package/dist/structural.cjs +3 -0
  92. package/dist/structural.cjs.map +1 -0
  93. package/dist/structural.d.cts +243 -0
  94. package/dist/structural.d.ts +243 -0
  95. package/dist/structural.js +3 -0
  96. package/dist/structural.js.map +1 -0
  97. package/package.json +86 -7
  98. package/dist/middleware-DD4Hwomt.d.ts +0 -189
@@ -1 +1 @@
1
- {"version":3,"file":"middleware-entry.js","names":["O","Object","defineProperty","a","t","e","value","configurable","CSP_ASCII_WHITESPACE","CSP_EDGE_ASCII_WHITESPACE","asciiLowercase","replace","character","toLowerCase","generateCspNonce","bytes","Number","isInteger","RangeError","String","crypto","resolveCrypto","Error","buffer","Uint8Array","getRandomValues","base64UrlEncode","fromGlobal","globalThis","binary","byte","fromCharCode","btoa","Buffer","from","toString","replaceAll","buildFrameAncestors","options","self","origins","allowNone","seen","Set","out","length","push","add","origin","trimmed","trim","has","join","buildScriptSrcWithNonce","nonce","extra","strictDynamic","parts","mergeCspHeader","existing","additions","directives","Map","part","split","whitespaceIndex","search","name","slice","set","rawName","rawAddition","entries","addition","mode","current","get","merged","token","withoutNone","filter","__name","RUNTIME_SOURCE","generateInlineScript","config","buildConfigLiteral","compactConfig","allowedOrigins","serverURL","apiRoute","mergeDepth","debug","debounceMs","enableA11y","heartbeatMs","disableVisibilityGate","visibilityGateThreshold","intersectionRootMargin","disableReferrerDetection","disableLocalhostMatching","scopeBindingsByOwner","at","pop","map","JSON","stringify","wrapWithScriptTag","body","escapeNonce","test","DEFAULT_QUERY_PARAMS","isPreviewRequest","request","signals","queryParams","checkFetchDest","url","URL","param","searchParams","headers","adminOrigins","referer","refererOrigin","adminOrigin","HTML_CONTENT_TYPE","HEAD_INSERT","createLivePreviewMiddleware","cachedScriptBody","autoInject","injectMode","inject","manageCsp","normalizeManageCsp","shouldInject","scriptBody","async","context","next","locals","response","isPrerendered","previewQueryParams","previewSignals","outResponse","contentType","injectScript","applyCspHeaders","html","text","Headers","delete","Response","status","statusText","scriptTag","match","frameAncestorsExtra","scriptSrcExtra","onRequest","st"],"sources":["../../../src/security/csp.ts","../../../src/inline/runtime.generated.ts","../../../src/inline/generator.ts","../../../src/adapters/shared/preview-request.ts","../../../src/adapters/astro/middleware.ts","../../../src/adapters/astro/middleware-entry.ts"],"sourcesContent":["/**\n * Content-Security-Policy helpers.\n *\n * Two responsibilities:\n *\n * 1. Generate cryptographic nonces so consumers can opt into a strict\n * `script-src 'nonce-...'` policy and avoid `'unsafe-inline'`.\n * 2. Build the `frame-ancestors` directive value, restricting which\n * origins may embed the preview page in an iframe.\n *\n * Both functions are isomorphic — they work in browsers, Node, and\n * edge runtimes that expose Web Crypto via `globalThis.crypto`.\n *\n * @module @security/csp\n */\n\n/**\n * Default byte-length for nonces. 16 bytes → 22 base64url characters,\n * which exceeds the 128-bit entropy threshold recommended by OWASP.\n */\nconst DEFAULT_NONCE_BYTES = 16;\n\n/** CSP3's exact whitespace set: HTAB, LF, FF, CR, and SPACE. */\nconst CSP_ASCII_WHITESPACE = /[\\t\\n\\f\\r ]+/;\nconst CSP_EDGE_ASCII_WHITESPACE = /^[\\t\\n\\f\\r ]+|[\\t\\n\\f\\r ]+$/g;\n\n/** CSP names are ASCII strings; Unicode case folding must not create directives. */\nfunction asciiLowercase(value: string): string {\n return value.replace(/[A-Z]/g, (character) => character.toLowerCase());\n}\n\n/**\n * Minimal Web-Crypto surface area we actually call. The full `Crypto`\n * type drags in browser-only declarations that don't typecheck cleanly\n * against Node's `webcrypto` shape — this narrower interface accepts\n * both without an unsafe cast.\n */\ninterface WebCryptoLike {\n getRandomValues: <T extends ArrayBufferView | null>(array: T) => T;\n}\n\nlet cryptoOverride: WebCryptoLike | undefined;\n\n/**\n * Inject a Web Crypto implementation to use when `globalThis.crypto`\n * is unavailable.\n *\n * Node.js exposed `globalThis.crypto` globally starting with v19. On\n * Node 18 (still LTS at time of writing) consumers can flip the\n * `--experimental-global-webcrypto` flag *or* call this function once\n * at startup:\n *\n * ```ts\n * import { webcrypto } from 'node:crypto';\n * import { setCspCrypto } from 'payload-live-preview';\n * setCspCrypto(webcrypto as { getRandomValues: typeof webcrypto.getRandomValues });\n * ```\n *\n * Browser bundles never need to call this — `globalThis.crypto` is\n * always present there, and the override only matters when the global\n * is missing.\n *\n * Pass `null` to clear a previous override (mostly useful for tests).\n */\nexport function setCspCrypto(crypto: WebCryptoLike | null): void {\n cryptoOverride = crypto ?? undefined;\n}\n\n/**\n * Generate a base64url-encoded cryptographic nonce.\n *\n * Uses `crypto.getRandomValues` everywhere — falls back to throwing\n * if no Web Crypto implementation is available, because a predictable\n * nonce would silently defeat the entire CSP.\n *\n * @param bytes Number of random bytes (defaults to 16 → 128-bit entropy).\n */\nexport function generateCspNonce(bytes: number = DEFAULT_NONCE_BYTES): string {\n if (!Number.isInteger(bytes) || bytes < 8) {\n throw new RangeError(`generateCspNonce: bytes must be an integer >= 8, got ${String(bytes)}`);\n }\n const crypto = resolveCrypto();\n if (!crypto) {\n throw new Error(\n 'generateCspNonce: Web Crypto is unavailable. On Node 18 call setCspCrypto(webcrypto) ' +\n \"once at startup, or run with --experimental-global-webcrypto. We won't fabricate \" +\n 'a predictable nonce — that would silently defeat the entire CSP.',\n );\n }\n const buffer = new Uint8Array(bytes);\n crypto.getRandomValues(buffer);\n return base64UrlEncode(buffer);\n}\n\nfunction resolveCrypto(): WebCryptoLike | undefined {\n if (cryptoOverride?.getRandomValues) return cryptoOverride;\n const fromGlobal = (globalThis as { crypto?: WebCryptoLike }).crypto;\n if (fromGlobal?.getRandomValues) return fromGlobal;\n return undefined;\n}\n\nfunction base64UrlEncode(bytes: Uint8Array): string {\n let binary = '';\n for (const byte of bytes) binary += String.fromCharCode(byte);\n const base64 = typeof btoa === 'function' ? btoa(binary) : Buffer.from(bytes).toString('base64');\n return base64.replaceAll('+', '-').replaceAll('/', '_').replaceAll('=', '');\n}\n\n/**\n * Sources allowed in the `frame-ancestors` directive.\n *\n * Conceptually a union of `'self'`, `'none'`, or an explicit origin\n * string. TypeScript collapses literal-vs-string unions, so we expose\n * a `string` alias and document the special values.\n */\nexport type FrameAncestorSource = string;\n\nexport interface FrameAncestorsOptions {\n readonly self?: boolean;\n readonly origins?: readonly string[];\n readonly allowNone?: boolean;\n}\n\n/**\n * Build the value for `frame-ancestors` in a `Content-Security-Policy`\n * header.\n *\n * Returns `'none'` if `allowNone: true` and no other sources are\n * provided. Otherwise concatenates `'self'` (if requested) with the\n * given origins, deduplicating and trimming entries.\n *\n * @example\n * `frame-ancestors ${buildFrameAncestors({ self: true, origins: [adminUrl] })}`\n */\nexport function buildFrameAncestors(options: FrameAncestorsOptions = {}): string {\n const { self = true, origins = [], allowNone = false } = options;\n const seen = new Set<string>();\n const out: FrameAncestorSource[] = [];\n if (allowNone && !self && origins.length === 0) return \"'none'\";\n if (self) {\n out.push(\"'self'\");\n seen.add(\"'self'\");\n }\n for (const origin of origins) {\n const trimmed = origin.trim();\n if (trimmed.length === 0 || seen.has(trimmed)) continue;\n seen.add(trimmed);\n out.push(trimmed);\n }\n return out.length > 0 ? out.join(' ') : \"'none'\";\n}\n\n/**\n * Build a `script-src` value that permits a single nonce plus optional\n * extra sources.\n *\n * `'strict-dynamic'` is **opt-in**: under CSP 3 it makes browsers\n * ignore `'self'` and every host source in the directive, so any\n * parser-inserted script without a nonce (framework hydration scripts,\n * consumer `<script>` tags) would be blocked. Only enable it when every\n * script on the page carries the nonce.\n */\nexport function buildScriptSrcWithNonce(\n nonce: string,\n options: {\n readonly self?: boolean;\n readonly extra?: readonly string[];\n readonly strictDynamic?: boolean;\n } = {},\n): string {\n if (nonce.length === 0) throw new RangeError('buildScriptSrcWithNonce: nonce is empty');\n const { self = true, extra = [], strictDynamic = false } = options;\n const parts: string[] = [];\n if (self) parts.push(\"'self'\");\n parts.push(`'nonce-${nonce}'`);\n if (strictDynamic) parts.push(\"'strict-dynamic'\");\n for (const e of extra) {\n const trimmed = e.trim();\n if (trimmed.length > 0) parts.push(trimmed);\n }\n return parts.join(' ');\n}\n\n/**\n * How a directive is merged into an existing CSP header value.\n *\n * - `union` (default) — the new sources are added to the existing\n * directive's sources (deduplicated). An existing `'none'` is\n * dropped when real sources are added, since `'none'` may not be\n * combined with other sources.\n * - `replace` — the new value overwrites the existing directive.\n */\nexport interface CspDirectiveMerge {\n readonly value: string;\n readonly mode?: 'union' | 'replace';\n}\n\n/**\n * Merge directives into an existing `Content-Security-Policy` header\n * value without clobbering what a consumer (or another middleware)\n * already configured. Directives not mentioned in `additions` pass\n * through untouched; new directives are appended. Existing policy parsing\n * follows CSP3's ASCII-whitespace and first-duplicate-wins rules.\n *\n * This is the single CSP-merge implementation shared by every adapter.\n */\nexport function mergeCspHeader(\n existing: string,\n additions: Readonly<Record<string, string | CspDirectiveMerge>>,\n): string {\n const directives = new Map<string, string>();\n for (const part of existing.split(';')) {\n const trimmed = part.replace(CSP_EDGE_ASCII_WHITESPACE, '');\n if (trimmed.length === 0) continue;\n const whitespaceIndex = trimmed.search(CSP_ASCII_WHITESPACE);\n const name = asciiLowercase(whitespaceIndex < 0 ? trimmed : trimmed.slice(0, whitespaceIndex));\n\n // CSP3 §2.2.1 is first-wins: a user agent ignores every later\n // case-insensitive duplicate. Mirroring that rule before merging prevents a\n // later, looser duplicate from becoming the policy we serialize.\n if (directives.has(name)) continue;\n\n const value =\n whitespaceIndex < 0\n ? ''\n : trimmed.slice(whitespaceIndex).replace(CSP_EDGE_ASCII_WHITESPACE, '');\n directives.set(name, value);\n }\n\n for (const [rawName, rawAddition] of Object.entries(additions)) {\n const name = asciiLowercase(rawName);\n const addition: CspDirectiveMerge =\n typeof rawAddition === 'string' ? { value: rawAddition } : rawAddition;\n const mode = addition.mode ?? 'union';\n const current = directives.get(name);\n if (mode === 'replace' || current === undefined || current.length === 0) {\n directives.set(name, addition.value);\n continue;\n }\n const seen = new Set<string>();\n const merged: string[] = [];\n for (const token of [\n ...current.split(CSP_ASCII_WHITESPACE),\n ...addition.value.split(CSP_ASCII_WHITESPACE),\n ]) {\n if (token.length === 0 || seen.has(token)) continue;\n seen.add(token);\n merged.push(token);\n }\n // `'none'` cannot coexist with other sources.\n const withoutNone = merged.filter((token) => token !== \"'none'\");\n directives.set(name, (withoutNone.length > 0 ? withoutNone : merged).join(' '));\n }\n\n const out: string[] = [];\n for (const [name, value] of directives) {\n out.push(value.length === 0 ? name : `${name} ${value}`);\n }\n return out.join('; ');\n}\n","// Auto-generated by scripts/build-runtime.ts — do not edit.\nexport interface RuntimeBuildInfo { readonly generatedAt: string; readonly size: number }\nexport const RUNTIME_SOURCE: string = \"(()=>{function t(t){return(\\\"object\\\"==typeof t&&null!==t||\\\"function\\\"==typeof t)&&\\\"function\\\"==typeof t.then&&(Promise.resolve(t).catch(()=>{}),!0)}function e(e){return(...i)=>{try{t(e(...i))}catch{}}}function i(){}function n(){return!0}function r(t){return`global:${t}`}function l(t,e){return void 0===e||\\\"\\\"===e?`collection:${t}`:`collection:${t}:${e}`}function s(t){return\\\"string\\\"==typeof t&&t.length>0}function o(t,e){return null!==e&&void 0!==t&&e.includes(t)}function a(t){let e=t.id;return\\\"string\\\"==typeof e&&e.length>0?e:\\\"number\\\"==typeof e&&Number.isFinite(e)?String(e):void 0}function u(t){if(t.nodeType!==Ze)return!1;let e=t;return!!e.hasAttribute(ke)||null!==e.querySelector(`[${ke}]`)}function h(t){if(!Array.isArray(t))return[];let e=[];for(let i of t){let t=d(i);t&&e.push(t)}return e}function d(t){if(\\\"object\\\"!=typeof t||null===t)return;let e=t,i=e.name,n=e.type;if(\\\"string\\\"!=typeof i||0===i.length||\\\"string\\\"!=typeof n||0===n.length)return;let r=h(e.fields),l=function(t){if(!Array.isArray(t))return[];let e=[];for(let i of t){if(\\\"object\\\"!=typeof i||null===i)continue;let t=i,n=t.slug;if(\\\"string\\\"!=typeof n||0===n.length)continue;let r=h(t.fields);e.push({...t,slug:n,fields:r})}return e}(e.blocks),s={...e,name:i,type:n};return r.length>0?s.fields=r:delete s.fields,l.length>0?s.blocks=l:delete s.blocks,s}function c(t){let e=\\\"number\\\"==typeof t&&Number.isFinite(t)&&t>=1?Math.floor(t):void 0,i=Math.min(4,e??1),n=new Set;for(let[t,e]of Object.entries(ni))i>=e&&n.add(t);return{ours:4,...void 0!==e?{theirs:e}:{theirs:void 0},negotiated:i,capabilities:n}}function f(t,e){return void 0===t||e(t)}function p(t,e){return null==t||e(t)}function g(t){if(\\\"object\\\"!=typeof t||null===t)return!1;let e=Object.getPrototypeOf(t);return null===e||null===Object.getPrototypeOf(e)}function m(t){for(let e of t){let t=e.codePointAt(0);if(void 0!==t&&(t<=31||127===t))return!0}return!1}function y(t){if(void 0===t||0===t.length||t.length>128||\\\".\\\"===t||\\\"..\\\"===t||t.includes(\\\"/\\\")||t.includes(\\\"\\\\\\\\\\\")||t.includes(\\\"?\\\")||t.includes(\\\"#\\\")||m(t))return!1;try{return encodeURIComponent(t),!0}catch{return!1}}function v(t,e){return t[6]===e}function b(t){return t.aborted}function w(t){if(\\\"string\\\"!=typeof t||0===t.length)return!1;let e=t.trim();if(0===e.length||$i.test(e))return!1;if(e.startsWith(\\\"#\\\")||e.startsWith(\\\"?\\\")||e.startsWith(\\\"//\\\")||e.startsWith(\\\"/\\\"))return!0;try{let t=new URL(e);return Si.has(t.protocol)}catch{return Ai.test(e)}}function S(t){if(!w(t))return!1;let e=t.trim();return/^https?:\\\\/\\\\//i.test(e)||/^\\\\/\\\\/[^/]/.test(e)}function $(t){return Ni.add(t),t}function A(t,e){return null!==e&&t.generation===e.generation&&t.revision===e.revision}function k(t,e,i,n=!1){if(n&&void 0!==i){let n=T(t,`${e}_${i}`);if(void 0!==n)return n}let r=T(t,e);if(void 0!==r)return r;if(e.includes(\\\".\\\")){let i=t,n=!0;for(let t of e.split(\\\".\\\")){if(Fi.has(t)||null===i||\\\"object\\\"!=typeof i){n=!1;break}if(i=T(i,t),void 0===i){n=!1;break}}if(n)return i}return void 0===i?void 0:T(t,`${e}_${i}`)}function T(t,e){if(!Fi.has(e)&&Object.prototype.hasOwnProperty.call(t,e))return t[e]}function N(){let t=function(){if(typeof document>\\\"u\\\")return;let t=document.documentElement.getAttribute(\\\"lang\\\");return null===t||0===t.length?void 0:t}();if(void 0!==t)return t;let e=function(){if(typeof navigator>\\\"u\\\")return;let t=navigator.language;return\\\"string\\\"==typeof t&&t.length>0?t:void 0}();return void 0!==e?e:\\\"en\\\"}function x(t){return/^de(?:[-_]|$)/i.test(t)}function M(t){null!==t[4]&&(clearTimeout(t[4]),t[4]=null),t[2]?.remove(),t[2]=null}function C(t,e=\\\"\\\"){let i=new Map;return O(t,e,i),i}function O(t,e,i){for(let n of t){if(Vi.has(n.type)){n.fields&&O(n.fields,e,i);continue}if(\\\"group\\\"===n.type){let t=\\\"\\\"===e?n.name:`${e}.${n.name}`;i.set(t,n),n.fields&&O(n.fields,t,i);continue}let t=\\\"\\\"===e?n.name:`${e}.${n.name}`;if(i.set(t,n),\\\"array\\\"===n.type&&n.fields)O(n.fields,`${t}.*`,i);else if(\\\"blocks\\\"===n.type&&n.blocks)for(let e of n.blocks)O(e.fields,`${t}.*.${e.slug}`,i)}}function L(t){if(\\\"object\\\"!=typeof t||null===t)return;let e=t.id;return\\\"string\\\"==typeof e||\\\"number\\\"==typeof e?e:void 0}function j(t){if(\\\"object\\\"!=typeof t||null===t)return;let e=t.blockType;return\\\"string\\\"==typeof e?e:void 0}function E(t,e){return e.every(t=>void 0!==L(t))?function(t,e){let i=[],n=new Map;for(let e=0;e<t.length;e+=1){let i=L(t[e]);void 0!==i&&n.set(i,e)}let r=new Set;for(let l=0;l<e.length;l+=1){let s=e[l],o=L(s);if(void 0===o){i.push({kind:\\\"insert\\\",index:l,value:s});continue}let a=n.get(o);if(void 0===a){i.push({kind:\\\"insert\\\",index:l,value:s});continue}r.add(a);let u=t[a];j(u)===j(s)?(a!==l&&i.push({kind:\\\"move\\\",from:a,to:l,value:s}),I(u,s)||i.push({kind:\\\"update\\\",index:l,value:s})):i.push({kind:\\\"replace\\\",index:l,oldValue:u,value:s})}for(let e=0;e<t.length;e+=1)r.has(e)||i.push({kind:\\\"remove\\\",index:e,value:t[e]});return i}(t,e):function(t,e){let i=[],n=Math.min(t.length,e.length);for(let r=0;r<n;r+=1)I(t[r],e[r])||i.push({kind:\\\"update\\\",index:r,value:e[r]});if(e.length>t.length)for(let n=t.length;n<e.length;n+=1)i.push({kind:\\\"insert\\\",index:n,value:e[n]});if(t.length>e.length)for(let n=e.length;n<t.length;n+=1)i.push({kind:\\\"remove\\\",index:n,value:t[n]});return i}(t,e)}function I(t,e){if(Object.is(t,e))return!0;if(\\\"object\\\"!=typeof t||\\\"object\\\"!=typeof e||null===t||null===e)return!1;let i=t,n=e,r=Object.keys(i),l=Object.keys(n);if(r.length!==l.length)return!1;for(let t of r)if(!Object.is(i[t],n[t]))return!1;return!0}function P(t){return 9===t.nodeType}function R(t){if(typeof window>\\\"u\\\")return;let e=[];window.parent!==window&&e.push(window.parent),window.opener instanceof Window&&e.push(window.opener),ri.sendReady(e,t)}function _(t,e){return t.generation===e.generation&&t.revision===e.revision}function W(t){return null!=t&&(\\\"string\\\"==typeof t||\\\"number\\\"==typeof t||\\\"boolean\\\"==typeof t||\\\"bigint\\\"==typeof t)}function F(t,e){if(!e)return t;let i=`_${e}`;return t.endsWith(i)?t.slice(0,-i.length):t}function D(){if(typeof window>\\\"u\\\")return!1;try{return window.self!==window.top}catch{return!0}}function U(t){if(typeof process<\\\"u\\\"){let e=process.env[t];if(\\\"string\\\"==typeof e&&e.length>0)return e}}function z(t){let e=t.trim();if(0!==e.length)try{let t=new URL(e);return\\\"http:\\\"!==t.protocol&&\\\"https:\\\"!==t.protocol||!Sn.test(t.origin)?void 0:t.origin}catch{return}}function V(t,e){let i=G();if(!i)throw new Pn(\\\"sanitizeHtml needs a DOM; provide one with setSanitizerDocument() during SSR.\\\");if(\\\"\\\"===t)return\\\"\\\";let n=function(t){if(!t){let t=new Map;for(let[e,i]of Object.entries(Ln))t.set(e,i);return{allowedTags:Nn,attrByTag:t}}let e=new Set(Nn);for(let i of t.additionalAllowedTags??[])e.add(i);let i=new Map;for(let[t,e]of Object.entries(Ln))i.set(t,e);for(let[e,n]of Object.entries(t.additionalAllowedAttributes??{})){let t=i.get(e),r=new Set(t??[]);for(let t of n)r.add(t);i.set(e,r)}return{allowedTags:e,attrByTag:i}}(e),r=i.createElement(\\\"template\\\");return r.innerHTML=t,B(r.content,n),r.innerHTML}function G(){if(!(typeof document>\\\"u\\\"))return document}function B(t,e){for(let i of Array.from(t.childNodes))i.nodeType===En?H(i,e):i.nodeType===In&&i.remove()}function H(t,e){let i=t.tagName.toLowerCase();if(xn.has(i))t.remove();else{if(!e.allowedTags.has(i)){B(t,e);let i=t.parentNode;if(i){for(;t.firstChild;)i.insertBefore(t.firstChild,t);t.remove()}return}(function(t,e,i){let n=i.attrByTag.get(e);for(let e of Array.from(t.attributes)){let i=e.name.toLowerCase();if(i.startsWith(\\\"on\\\"))t.removeAttribute(e.name);else if(\\\"style\\\"!==i){if(!(Mn.has(i)||i.startsWith(Cn)||i.startsWith(On))){if(n?.has(i)){(jn.has(i)&&!w(e.value)||\\\"srcset\\\"===i&&!q(e.value))&&t.removeAttribute(e.name);continue}t.removeAttribute(e.name)}}else t.removeAttribute(e.name)}})(t,i,e),\\\"a\\\"===i&&function(t){let e=t.getAttribute(\\\"href\\\");null===e||!S(e)||(t.setAttribute(\\\"rel\\\",\\\"noopener noreferrer\\\"),t.hasAttribute(\\\"target\\\")||t.setAttribute(\\\"target\\\",\\\"_blank\\\"))}(t),B(t,e)}}function q(t){let e=t.split(\\\",\\\");for(let t of e){let e=t.trim();if(0===e.length)continue;let i=e.search(/\\\\s/);if(!w(-1===i?e:e.slice(0,i)))return!1}return!0}function J(t,e){Rn.set(t,e)}function X(t){let e=t.format;if(\\\"string\\\"==typeof e&&Wn.has(e))return e;if(\\\"number\\\"==typeof e){let t=_n[e];if(void 0!==t)return t}}function Y(t){let e=t.indent;return\\\"number\\\"==typeof e&&e>0?e:0}function Z(t){return\\\"rtl\\\"===t.direction?' dir=\\\"rtl\\\"':\\\"ltr\\\"===t.direction?' dir=\\\"ltr\\\"':\\\"\\\"}function K(t){let e=X(t),i=Y(t),n=[];return void 0!==e&&n.push(`text-align:${e}`),i>0&&n.push(`padding-inline-start:${String(40*i)}px`),0===n.length?\\\"\\\":` style=\\\"${n.join(\\\";\\\")}\\\"`}function Q(t){return\\\"\\\"===t?\\\"\\\":t.replace(Dn,t=>Fn[t])}function tt(t){return\\\"\\\"===t?\\\"\\\":t.replace(zn,t=>Un[t])}function et(t){return Q(t).replace(/\\\\r\\\\n|\\\\r|\\\\n/g,\\\"<br>\\\")}function it(t){if(\\\"string\\\"==typeof t.text)return t.text;if(!t.children)return\\\"\\\";let e=\\\"\\\";for(let i of t.children)e+=it(i);return e}function nt(t){return t.replace(/[^a-zA-Z0-9_-]/g,\\\"\\\")}function rt(t){return Bn.get(t)}function lt(t){return t.replace(/[^a-zA-Z0-9_-]/g,\\\"-\\\").toLowerCase()}function st(t){if(\\\"object\\\"!=typeof t||null===t||!(\\\"root\\\"in t))return!1;let e=t.root;return\\\"object\\\"==typeof e&&null!==e&&\\\"children\\\"in e&&Array.isArray(e.children)}function ot(t){return st(t)?t.root.children.map(ht).join(\\\"\\\\n\\\").trim():\\\"\\\"}function at(t){let e=\\\"\\\";for(let i of t)e+=ut(i);return e}function ut(t){let e=function(t){return Rn.get(t)}(t.type);return e?e(t,Rt):void 0!==t.children?at(t.children):\\\"\\\"}function ht(t){if(\\\"string\\\"==typeof t.text)return t.text;if(\\\"linebreak\\\"===t.type)return\\\"\\\\n\\\";if(void 0===t.children)return\\\"\\\";let e=\\\"\\\";for(let i of t.children)e+=ht(i);return e}function dt(){let t=new WeakSet;return{name:\\\"text\\\",render:$((e,i)=>{let n=e.element,r=function(t){return null==t?\\\"\\\":st(t)?ot(t):\\\"string\\\"==typeof t?t:\\\"number\\\"==typeof t||\\\"boolean\\\"==typeof t?String(t):JSON.stringify(t)}(i);if(\\\"INPUT\\\"!==n.tagName&&\\\"TEXTAREA\\\"!==n.tagName){if(function(t){return null!==t.firstElementChild}(n)&&!n.hasAttribute(_t))return function(t,e,i){t.has(e)||(t.add(e),pe(`[live-preview] LP0402: Skipping text update for \\\"${i}\\\": <${e.tagName.toLowerCase()}> has structured children. Move data-payload-field to the value element, or add data-payload-text to replace them.`))}(t,n,e.fieldName),!1;r.includes(\\\"\\\\n\\\")||r.includes(\\\"\\\\r\\\")?n.innerHTML=et(r):n.textContent=r}else n.value=r})}}function ct(t){if(null==t)return\\\"\\\";if(\\\"string\\\"==typeof t)return t;if(\\\"number\\\"==typeof t||\\\"boolean\\\"==typeof t||\\\"bigint\\\"==typeof t)return String(t);try{return JSON.stringify(t)}catch{return\\\"\\\"}}function ft(t){if(\\\"object\\\"==typeof t&&null!==t)return t}function pt(t){if(\\\"object\\\"==typeof t&&null!==t){let e=t;return\\\"string\\\"==typeof e.title&&e.title.length>0?e.title:\\\"string\\\"==typeof e.name&&e.name.length>0?e.name:\\\"string\\\"==typeof e.slug&&e.slug.length>0?e.slug:void 0!==e.id?String(e.id):\\\"\\\"}return ct(t)}function gt(t){return Array.isArray(t)?t.map(t=>gt(t)).join(\\\", \\\"):ct(t)}function mt(t,e){let i=t??\\\"\\\";if(null==e)return i;let n=yt(e);return\\\"{}\\\"===n?i:`${i}|${n}`}function yt(t){if(null===t||\\\"object\\\"!=typeof t)return JSON.stringify(t);if(Array.isArray(t))return`[${t.map(t=>yt(t)).join(\\\",\\\")}]`;let e=t,i=Object.keys(e).sort(),n=[];for(let t of i){let i=e[t];void 0!==i&&n.push(`${JSON.stringify(t)}:${yt(i)}`)}return`{${n.join(\\\",\\\")}}`}function vt(t){for(;t.size>Xt;){let e=t.keys().next().value;if(void 0===e)break;t.delete(e)}}function bt(t,e,i,n){let r=\\\"object\\\"==typeof e&&null!==e?e:null;return t.replace(Kt,(t,l)=>null!==r&&function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(r,l)?Q(n(Reflect.get(r,l))):null===r&&\\\"value\\\"===l?Q(n(e)):\\\"index\\\"===l?String(i):t)}function wt(t,e,i){return bt(t,e,i,ct)}function St(t){return ct(t)}function $t(t){let{template:e,container:i,patches:n,nextItems:r,store:l,forceRender:s=!1}=t,o=At(i,e,n,r,s,l);return null===o?null:kt(o,l)}function At(t,e,i,n,r,l){let s=function(t){let e=new Set,i=new Set;for(let n of t)\\\"insert\\\"===n.kind||\\\"update\\\"===n.kind?e.add(n.index):\\\"replace\\\"===n.kind&&(e.add(n.index),i.add(n.index));return{renders:e,replaces:i}}(i),o=function(t,e,i,n,r,l,s){let o=Array.from(t.children),a=Lt(o,te),u=new Set,h=[];for(let d=0;d<i.length;d+=1){let c=i[d],f=Ot(c),p=void 0===f?o[d]??null:jt(a,f)??null;null!==p&&u.has(p)&&(p=null),null!==p&&u.add(p);let g=n.replaces.has(d),m=r||n.renders.has(d)||null===p?Et(t.ownerDocument,e,c,d):void 0;if(null===m)return null;let y=void 0===m?[]:Tt(g?null:p,m,c,l,s);if(null===y)return null;h.push([d,p,m??void 0,y])}return h}(t,e,n,s,r,l.get(t),l);return null===o?null:[t,o,n]}function kt(t,e){let[i,n,r]=t,l=new Set,s=!1;for(let t of n){let[n,r,o,a]=t,u=r;if(void 0!==o){for(let t of a)null!==t[0]&&(xt(t[0],t[1]),t[1].replaceWith(t[0])),void 0!==t[2]&&kt(t[2],e);null!==r&&(r.replaceWith(o),s=!0),u=o}if(null===u)continue;let h=i.children[n]??null;u!==h&&(i.insertBefore(u,h),s=!0),l.add(u)}for(let t of Array.from(i.children))l.has(t)||(t.remove(),s=!0);let o=function(t,e){let i=e.get(t);return i||(i=new Map,e.set(t,i)),i}(i,e);o.clear();for(let t of r)Ct(o,t);return s}function Tt(t,e,i,n,r){let l=Lt(null===t?[]:Nt(t),ee),s=Ot(i),o=void 0!==s?n?.get(s):void 0,a=[];for(let t of Nt(e)){let e=t.getAttribute(ee);if(null===e)continue;let n,s=jt(l,e)??null,u=t.getAttribute(ie),h=u?s:null,d=h?.getAttribute(ie)??null;if(u){let l=Mt(i,e);if(void 0!==l||null!==h){let i=l??[],s=E(null===h?[]:Mt(o,e)??[],i),a=null!==h&&d!==u;if((s.length>0||a)&&(n=At(h??t,u,s,i,a,r)??void 0,void 0===n))return null}}a.push([h,t,n])}return a}function Nt(t){return Array.from(t.querySelectorAll(`[${ee}]`)).filter(e=>{let i=e.parentElement;for(;null!==i&&i!==t;){if(i.hasAttribute(ee))return!1;i=i.parentElement}return i===t})}function xt(t,e){for(let i of Array.from(t.attributes))e.hasAttribute(i.name)||t.removeAttribute(i.name);for(let i of Array.from(e.attributes))t.getAttribute(i.name)!==i.value&&t.setAttribute(i.name,i.value)}function Mt(t,e){if(\\\"object\\\"!=typeof t||null===t)return;let i=t[e];return Array.isArray(i)?i:void 0}function Ct(t,e){let i=Ot(e);void 0!==i&&t.set(i,e)}function Ot(t){if(\\\"object\\\"!=typeof t||null===t)return;let e=t.id;return\\\"string\\\"==typeof e||\\\"number\\\"==typeof e?String(e):void 0}function Lt(t,e){let i=new Map;for(let n=t.length-1;n>=0;n-=1){let r=t[n];if(void 0===r)continue;let l=r.getAttribute(e);if(null===l)continue;let s=i.get(l);void 0===s?i.set(l,[r]):s.push(r)}return i}function jt(t,e){return t.get(e)?.pop()}function Et(t,e,i,n){let r=function(t,e,i){return bt(t,e,i,ct)}(e,i,n),l=V(r),s=t.createElement(\\\"template\\\");s.innerHTML=l;let o=s.content.firstElementChild;if(!o)return null;let a=Ot(i);return void 0!==a&&o.setAttribute(te,a),o}function It(){let t=new WeakMap,e=new WeakSet,i=new WeakMap;return{name:\\\"structural-array\\\",render:$((n,r)=>{if(!Array.isArray(r))return!1;let l=n.element,s=n.arrayTemplate;if(void 0===s||0===s.length)return function(t,e,i){t.has(e)||(t.add(e),pe(`[live-preview] LP0403: Skipping structural update for \\\"${i}\\\": <${e.tagName.toLowerCase()} data-payload-structural> needs data-payload-array-template (for example \\\"<li>{{label}}</li>\\\").`))}(e,l,n.fieldName),!1;let o=t.get(l),a=Pt(l),u=o?.values??function(t){return t.map((t,e)=>null===t?{__payloadDomPosition:e}:{id:t})}(a),h=E(u,r),d=function(t,e,i){return void 0===t||t.template!==e||!function(t,e){return t.length===e.length&&t.every((t,i)=>t===e[i])}(t.domSnapshot,i)}(o,s,a);if(0===h.length&&!d)return t.set(l,{values:r.slice(),template:s,domSnapshot:a}),!1;let c=$t({template:s,container:l,patches:h,nextItems:r,store:i,forceRender:d});return null!==c&&(t.set(l,{values:r.slice(),template:s,domSnapshot:Pt(l)}),!!c&&void 0)})}}function Pt(t){return Array.from(t.children,t=>t.getAttribute(te))}var Rt,_t,Wt,Ft,Dt,Ut,zt,Vt,Gt,Bt,Ht,qt,Jt,Xt,Yt,Zt,Kt,Qt,te,ee,ie,ne,re,le=Object.defineProperty,se=t=>{throw TypeError(t)},oe=(t,e,i)=>((t,e,i)=>e in t?le(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,\\\"symbol\\\"!=typeof e?e+\\\"\\\":e,i),ae=(t,e,i)=>e.has(t)||se(\\\"Cannot \\\"+i),ue=(t,e,i)=>(ae(t,e,\\\"read from private field\\\"),i?i.call(t):e.get(t)),he=(t,e,i)=>e.has(t)?se(\\\"Cannot add the same private member more than once\\\"):e instanceof WeakSet?e.add(t):e.set(t,i),de=(t,e,i,n)=>(ae(t,e,\\\"write to private field\\\"),n?n.call(t,i):e.set(t,i),i),ce=(t,e,i)=>(ae(t,e,\\\"access private method\\\"),i),fe=e((...t)=>console.error(...t)),pe=e((...t)=>console.warn(...t)),ge=e((...t)=>console.debug(...t)),me=class{constructor(){he(this,be);he(this,ye,new Map);he(this,ve,new Map)}on(t,e){return ce(this,be,Se).call(this,ue(this,ye),t,e)}once(t,e){return ce(this,be,Se).call(this,ue(this,ve),t,e)}off(t,e){ce(this,be,$e).call(this,ue(this,ye),t,e),ce(this,be,$e).call(this,ue(this,ve),t,e)}async emit(t,e){await ce(this,be,we).call(this,t,e)}async emitWhile(t,e,i){return ce(this,be,we).call(this,t,e,i)}listenerCount(t){return(ue(this,ye).get(t)?.size??0)+(ue(this,ve).get(t)?.size??0)}removeAllListeners(t){void 0!==t?(ue(this,ye).delete(t),ue(this,ve).delete(t)):(ue(this,ye).clear(),ue(this,ve).clear())}eventNames(){let t=new Set;for(let e of ue(this,ye).keys())t.add(e);for(let e of ue(this,ve).keys())t.add(e);return[...t]}},ye=new WeakMap,ve=new WeakMap,be=new WeakSet,we=async function(t,e,i){let n=()=>i?.()??!0;if(!n())return!1;let r=ue(this,ye).get(t);if(r)for(let i of[...r])if(!n()||(await ce(this,be,Ae).call(this,i,e,t),!n()))return!1;if(!n())return!1;let l=ue(this,ve).get(t);if(l&&l.size>0){let i=[...l];ue(this,ve).delete(t);for(let r of i)if(!n()||(await ce(this,be,Ae).call(this,r,e,t),!n()))return!1}return n()},Se=function(t,e,i){let n=t.get(e);return n||(n=new Set,t.set(e,n)),n.add(i),()=>{ce(this,be,$e).call(this,t,e,i)}},$e=function(t,e,i){let n=t.get(e);void 0!==n&&(n.delete(i),0===n.size&&t.delete(e))},Ae=async function(t,e,i){try{await t(e)}catch(t){let e=\\\"string\\\"==typeof i||\\\"number\\\"==typeof i?String(i):\\\"<event>\\\";fe(`[live-preview] LP0601: handler for \\\"${e}\\\" threw:`,t)}},ke=\\\"data-payload-field\\\",Te=\\\"data-payload-type\\\",Ne=\\\"data-payload-attribute\\\",xe=\\\"data-payload-href\\\",Me=\\\"data-payload-src\\\",Ce=\\\"data-payload-alt\\\",Oe=\\\"data-payload-array-template\\\",Le=\\\"data-payload-array-separator\\\",je=\\\"data-payload-locale\\\",Ee=\\\"data-payload-richtext\\\",Ie=\\\"data-payload-html\\\",Pe=\\\"data-payload-array\\\",Re=\\\"data-payload-structural\\\",_e=\\\"data-payload-owner\\\",We=[ke,Te,Ne,xe,Me,Ce,Oe,Le,je,Ee,Ie,Pe,Re,_e,\\\"type\\\"],Fe=`[${ke}]`,De=`[${_e}]`,Ue=new Set([\\\"text\\\",\\\"textarea\\\",\\\"richText\\\",\\\"email\\\",\\\"number\\\",\\\"checkbox\\\",\\\"date\\\",\\\"select\\\",\\\"radio\\\",\\\"array\\\",\\\"blocks\\\",\\\"group\\\",\\\"tabs\\\",\\\"row\\\",\\\"collapsible\\\",\\\"relationship\\\",\\\"upload\\\",\\\"point\\\",\\\"json\\\",\\\"code\\\",\\\"ui\\\",\\\"html\\\",\\\"url\\\",\\\"image\\\",\\\"structural-array\\\"]),ze=class{constructor(t={}){he(this,He);he(this,Ve,new Map);he(this,Ge,new WeakMap);he(this,Be);de(this,Be,t.filter??n)}buildFromRoot(t){let e=performance.now();this.clear();let i=t.querySelectorAll(Fe),n=0;for(let t of i)void 0!==this.add(t)&&(n+=1);return{elementCount:n,fieldCount:ue(this,Ve).size,durationMs:performance.now()-e}}add(t){let e=ue(this,Be).call(this,t)?ce(this,He,Ye).call(this,t):void 0,i=ue(this,Ge).get(t);if(void 0!==e)return void 0!==i&&ce(this,He,qe).call(this,i,e)?(ue(this,Ge).set(t,e),e):(void 0!==i&&ce(this,He,Je).call(this,t,i),ce(this,He,Xe).call(this,e),ue(this,Ge).set(t,e),e);void 0!==i&&ce(this,He,Je).call(this,t,i)}remove(t){let e=ue(this,Ge).get(t);return!!e&&ce(this,He,Je).call(this,t,e)}get(t){return ue(this,Ve).get(t)}getByElement(t){return ue(this,Ge).get(t)}get fieldCount(){return ue(this,Ve).size}get elementCount(){let t=0;for(let e of ue(this,Ve).values())t+=e.length;return t}entries(){return ue(this,Ve).entries()}*values(){for(let t of ue(this,Ve).values())yield*t}has(t){return ue(this,Ge).has(t)}clear(){ue(this,Ve).clear(),de(this,Ge,new WeakMap)}},Ve=new WeakMap,Ge=new WeakMap,Be=new WeakMap,He=new WeakSet,qe=function(t,e){if(t.fieldName!==e.fieldName)return!1;let i=ue(this,Ve).get(t.fieldName);if(!i)return!1;let n=i.indexOf(t);return!(n<0||(i[n]=e,0))},Je=function(t,e){let i=ue(this,Ve).get(e.fieldName);if(!i)return ue(this,Ge).delete(t),!1;let n=i.indexOf(e);return n<0?(ue(this,Ge).delete(t),!1):(i.splice(n,1),0===i.length&&ue(this,Ve).delete(e.fieldName),ue(this,Ge).delete(t),!0)},Xe=function(t){let e=ue(this,Ve).get(t.fieldName);e?e.push(t):ue(this,Ve).set(t.fieldName,[t])},Ye=function(t){let e=t.getAttribute(ke);if(null===e||0===e.length)return;let i=t.getAttribute(Te),n=function(t){let e=t.getAttribute(Te);if(null!==e&&Ue.has(e))return e;if(t.hasAttribute(Ee))return\\\"richText\\\";if(t.hasAttribute(Ie))return\\\"html\\\";if(t.hasAttribute(Re))return\\\"structural-array\\\";if(t.hasAttribute(Pe))return\\\"array\\\";if(\\\"IMG\\\"===t.tagName)return\\\"image\\\";if(\\\"A\\\"===t.tagName)return\\\"url\\\";if(\\\"TIME\\\"===t.tagName)return\\\"date\\\";if(\\\"INPUT\\\"===t.tagName){let e=t.type;if(\\\"checkbox\\\"===e)return\\\"checkbox\\\";if(\\\"number\\\"===e)return\\\"number\\\";if(\\\"date\\\"===e||\\\"datetime-local\\\"===e)return\\\"date\\\"}return\\\"text\\\"}(t),r=t.getAttribute(Ne),l=t.getAttribute(xe),s=t.getAttribute(Me),o=t.getAttribute(Ce),a=t.getAttribute(Oe),u=t.getAttribute(Le),h=t.getAttribute(je),d=function(t){let e=t.closest(De)?.getAttribute(_e);return null==e||0===e.length?void 0:e}(t);return{element:t,fieldName:e,fieldType:n,explicitFieldType:null!==i&&Ue.has(i),...null!==r&&r.length>0?{targetAttribute:r}:{},...null!==l&&l.length>0?{hrefField:l}:{},...null!==s&&s.length>0?{srcField:s}:{},...null!==o&&o.length>0?{altField:o}:{},...null!==a?{arrayTemplate:a}:{},...null!==u?{arraySeparator:u}:{},...null!==h&&h.length>0?{locale:h}:{},...void 0!==d?{owner:d}:{}}},Ze=1,Ke=class{constructor(t,e={}){he(this,Qe);oe(this,\\\"s\\\");this.s=[t,e.mutationDebounceMs??100,e.intersectionRootMargin??\\\"200px\\\",new Set,null,null,null,0]}start(t){let e=this.s[7];this.stop();let i=e+1;if(this.s[7]!==i)return;let n=null,r=null;try{n=new MutationObserver(t=>{ce(this,Qe,ti).call(this,t,i)}),r=new IntersectionObserver(t=>{ce(this,Qe,ei).call(this,t,i)},{rootMargin:this.s[2],threshold:0}),n.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...We]})}catch(t){throw n?.disconnect(),r?.disconnect(),t}this.s[7]===i?(this.s[4]=n,this.s[5]=r):(n.disconnect(),r.disconnect())}observeElement(t){this.s[5]?.observe(t)}unobserveElement(t){this.s[5]?.unobserve(t),this.s[3].delete(t)}markVisible(t,e){e?this.s[3].add(t):this.s[3].delete(t)}isVisible(t){return this.s[3].has(t)}stop(){this.s[7]+=1;let t=this.s[6],e=this.s[4],i=this.s[5];this.s[6]=null,this.s[4]=null,this.s[5]=null,this.s[3].clear(),null!==t&&clearTimeout(t);try{e?.disconnect()}finally{i?.disconnect()}}},Qe=new WeakSet,ti=function(t,e){if(!ce(this,Qe,ii).call(this,e)||!function(t){for(let e of t){if(\\\"attributes\\\"===e.type&&null!==e.attributeName&&We.includes(e.attributeName)&&(e.attributeName===ke||e.attributeName===_e||e.target.nodeType===Ze&&e.target.hasAttribute(ke)))return!0;for(let t of e.addedNodes)if(u(t))return!0;for(let t of e.removedNodes)if(u(t))return!0}return!1}(t)||!ce(this,Qe,ii).call(this,e))return;null!==this.s[6]&&clearTimeout(this.s[6]);let i=setTimeout(()=>{!ce(this,Qe,ii).call(this,e)||this.s[6]!==i||(this.s[6]=null,this.s[0].onStructuralChange())},this.s[1]);this.s[6]=i},ei=function(t,e){for(let i of t){if(!ce(this,Qe,ii).call(this,e))return;let t=i.target;if(i.isIntersecting){if(!this.s[3].has(t)&&(this.s[3].add(t),this.s[0].onVisibilityChange(t,!0),!ce(this,Qe,ii).call(this,e)))return}else if(this.s[3].has(t)&&(this.s[3].delete(t),this.s[0].onVisibilityChange(t,!1),!ce(this,Qe,ii).call(this,e)))return}},ii=function(t){return this.s[7]===t&&null!==this.s[5]},ni={basic:1,\\\"schema-json\\\":2,\\\"preview-token\\\":3,\\\"nested-arrays\\\":4,\\\"recursive-diffs\\\":4},ri=class{constructor(t,e){he(this,li);oe(this,\\\"s\\\");this.s=[t,e,void 0,void 0,0,0,[],0]}attach(t=window){if(void 0!==this.s[3])return;let e=!1,i=t=>{if(!e||this.s[2]!==i)return;let n=this.s[4];try{ce(this,li,si).call(this,t,n)}catch{let e=\\\"\\\";try{e=t.origin}catch{}ce(this,li,di).call(this,\\\"shape\\\",e,n)}};this.s[4]+=1,ce(this,li,mi).call(this),this.s[3]=t,this.s[2]=i;try{t.addEventListener(\\\"message\\\",i)}catch(e){this.s[2]===i&&(this.s[3]=void 0,this.s[2]=void 0,ce(this,li,mi).call(this));try{t.removeEventListener(\\\"message\\\",i)}catch{}throw e}if(this.s[2]===i)e=!0;else try{t.removeEventListener(\\\"message\\\",i)}catch{}}detach(t){let e=this.s[3],i=this.s[2];void 0===e||void 0===i||(this.s[3]=void 0,this.s[2]=void 0,ce(this,li,mi).call(this),e.removeEventListener(\\\"message\\\",i))}advanceGeneration(){return void 0!==this.s[3]&&(this.s[4]+=1,ce(this,li,mi).call(this),!0)}static sendReady(t,e){let i=t.length>0;if(!i||0===e.length)return;let n={type:\\\"payload-live-preview\\\",ready:i,protocolVersion:4};for(let i of t)for(let t of e)try{i.postMessage(n,t)}catch{}}},li=new WeakSet,si=function(t,e){if(!ce(this,li,pi).call(this,e))return;let i=t.origin;if(!ce(this,li,pi).call(this,e))return;if(!ce(this,li,ci).call(this,i,e)){ce(this,li,di).call(this,\\\"origin\\\",i,e);return}let n=t.data;if(!ce(this,li,pi).call(this,e))return;let r=function(t){return\\\"object\\\"==typeof t&&null!==t&&\\\"type\\\"in t&&\\\"string\\\"==typeof t.type}(n);if(!ce(this,li,pi).call(this,e))return;if(!r){ce(this,li,di).call(this,\\\"shape\\\",i,e);return}let l=n.type;if(ce(this,li,pi).call(this,e))switch(l){case\\\"payload-live-preview\\\":{let t=function(t){let e=t;return!!((void 0===e.data||null===e.data||g(e.data))&&p(e.fieldSchemaJSON,t=>Array.isArray(t))&&p(e.globalSlug,t=>\\\"string\\\"==typeof t)&&p(e.collectionSlug,t=>\\\"string\\\"==typeof t)&&p(e.locale,t=>\\\"string\\\"==typeof t)&&p(e.ready,t=>\\\"boolean\\\"==typeof t)&&p(e.previewToken,t=>\\\"string\\\"==typeof t)&&p(e.protocolVersion,t=>\\\"number\\\"==typeof t))}(n);if(!ce(this,li,pi).call(this,e))return;if(!t){ce(this,li,di).call(this,\\\"shape\\\",i,e);return}let r=function(t){let e={...t};for(let t of yi)null===Reflect.get(e,t)&&Reflect.deleteProperty(e,t);if(!Array.isArray(e.fieldSchemaJSON))return e;let i;try{i=h(e.fieldSchemaJSON)}catch{i=[]}return{...e,fieldSchemaJSON:i}}(n);if(!ce(this,li,pi).call(this,e))return;ce(this,li,oi).call(this,r,i,e);return}case\\\"payload-document-event\\\":{let t=function(t){let e=t;return!(!f(e.action,t=>\\\"updated\\\"===t||\\\"created\\\"===t||\\\"deleted\\\"===t)||!f(e.slug,t=>\\\"string\\\"==typeof t)||!f(e.id,t=>\\\"string\\\"==typeof t||\\\"number\\\"==typeof t&&Number.isFinite(t)))}(n);if(!ce(this,li,pi).call(this,e))return;if(!t){ce(this,li,di).call(this,\\\"shape\\\",i,e);return}let r;try{r=this.s[1].onDocumentEvent}catch{return}if(!ce(this,li,pi).call(this,e))return;ce(this,li,fi).call(this,r,n,i);return}default:ce(this,li,di).call(this,\\\"type\\\",i,e)}},oi=function(t,e,i){if(!ce(this,li,pi).call(this,i))return;let n=t.data;if(!ce(this,li,pi).call(this,i))return;let r=g(n);if(!ce(this,li,pi).call(this,i))return;let l,s=r?{generation:i,revision:this.s[5]+=1}:void 0;try{l=this.s[1].validateToken}catch{return}if(!ce(this,li,pi).call(this,i))return;if(void 0===l){ce(this,li,hi).call(this,t,e,i,s);return}if(!0===t.ready&&void 0===n){ce(this,li,hi).call(this,t,e,i,void 0);return}let o={generation:i,message:t,origin:e,messageRevision:s,settled:!1,approved:!1};this.s[6].push(o);let a;try{a=l(t.previewToken,e)}catch{ce(this,li,ai).call(this,o,!1);return}\\\"boolean\\\"!=typeof a?Promise.resolve(a).then(t=>{ce(this,li,ai).call(this,o,!0===t)},()=>{ce(this,li,ai).call(this,o,!1)}):ce(this,li,ai).call(this,o,a)},ai=function(t,e){ce(this,li,pi).call(this,t.generation)&&(t.approved=e,t.settled=!0,ce(this,li,ui).call(this,t.generation))},ui=function(t){for(;ce(this,li,pi).call(this,t);){let e=this.s[6][this.s[7]];if(void 0===e)return;if(ce(this,li,ci).call(this,e.origin,t)){if(!e.settled)return;ce(this,li,gi).call(this,e)&&(e.approved?ce(this,li,hi).call(this,e.message,e.origin,e.generation,e.messageRevision):ce(this,li,di).call(this,\\\"token\\\",e.origin,e.generation))}else{if(!ce(this,li,gi).call(this,e))continue;ce(this,li,di).call(this,\\\"origin\\\",e.origin,e.generation)}}},hi=function(t,e,i,n){if(!ce(this,li,pi).call(this,i))return;let r;try{r=this.s[1].onUpdate}catch{return}ce(this,li,pi).call(this,i)&&(void 0===n?ce(this,li,fi).call(this,r,t,e):ce(this,li,fi).call(this,r,t,e,n))},di=function(t,e,i){if(!ce(this,li,pi).call(this,i))return;let n;try{n=this.s[1].onInvalid}catch{return}ce(this,li,pi).call(this,i)&&void 0!==n&&ce(this,li,fi).call(this,n,t,e)},ci=function(t,e){if(!ce(this,li,pi).call(this,e))return!1;try{return!0===this.s[0](t)&&ce(this,li,pi).call(this,e)}catch{return!1}},fi=function(e,...i){try{t(e(...i))}catch{}},pi=function(t){return void 0!==this.s[3]&&this.s[4]===t},gi=function(t){let e=this.s;return e[6][e[7]]===t&&(e[7]+=1,e[7]===e[6].length?(ce(this,li,mi).call(this),!0):(e[7]>=1024&&2*e[7]>=e[6].length&&(e[6]=e[6].slice(e[7]),e[7]=0),!0))},mi=function(){this.s[6]=[],this.s[7]=0},yi=[\\\"data\\\",\\\"fieldSchemaJSON\\\",\\\"globalSlug\\\",\\\"collectionSlug\\\",\\\"locale\\\",\\\"ready\\\",\\\"previewToken\\\",\\\"protocolVersion\\\"],vi=class{constructor(t){oe(this,\\\"s\\\");this.s=[t.timeoutMs??0,t.onTimeout,null,0]}kick(){if(this.s[3]=Date.now(),this.s[0]<=0)return;null!==this.s[2]&&clearTimeout(this.s[2]);let t=setTimeout(()=>{this.s[2]===t&&(this.s[2]=null,this.s[1]())},this.s[0]);this.s[2]=t}stop(){null!==this.s[2]&&(clearTimeout(this.s[2]),this.s[2]=null)}get lastKickAt(){return this.s[3]}get pending(){return null!==this.s[2]}},bi=class{constructor(t){oe(this,\\\"s\\\");this.s=[\\\"disconnected\\\",t]}get status(){return this.s[0]}markConnected(){return this.transition(\\\"connected\\\")}markConnecting(){return this.transition(\\\"connecting\\\")}markDisconnected(){return this.transition(\\\"disconnected\\\")}transition(t){if(this.s[0]===t)return!1;let e=this.s[0];return this.s[0]=t,this.s[1](t,e),!0}},wi=class{constructor(t){oe(this,\\\"s\\\");let n=t.serverURL.replace(/\\\\/+$/,\\\"\\\"),r=t.apiRoute??\\\"/api\\\";this.s=[n,r.startsWith(\\\"/\\\")?r:`/${r}`,t.depth??1,t.fetchFn,void 0===t.log?i:e(t.log),null,0,0]}canMerge(t){try{return t.globalSlug?y(t.globalSlug):!!y(t.collectionSlug)&&function(t){if(\\\"number\\\"==typeof t)return Number.isFinite(t);if(\\\"string\\\"!=typeof t||0===t.length||t.length>512||\\\".\\\"===t||\\\"..\\\"===t||t.includes(\\\"/\\\")||t.includes(\\\"\\\\\\\\\\\")||m(t))return!1;try{return encodeURIComponent(t),!0}catch{return!1}}(t.data.id)}catch{return!1}}async merge(t){if(this.s[7]>0)return{status:\\\"superseded\\\"};let e=this.s[6]+1;this.s[6]=e;let i=this.s[5];this.s[5]=null;let n=null;try{if(i?.abort(),!v(this.s,e))return{status:\\\"superseded\\\"};if(!this.canMerge(t))return v(this.s,e)?{status:\\\"unavailable\\\"}:{status:\\\"superseded\\\"};if(!v(this.s,e))return{status:\\\"superseded\\\"};let r=this.s[3]??(\\\"function\\\"==typeof fetch?fetch:void 0);if(!v(this.s,e))return{status:\\\"superseded\\\"};if(void 0===r)return{status:\\\"unavailable\\\"};if(n=new AbortController,!v(this.s,e))return n.abort(),{status:\\\"superseded\\\"};this.s[5]=n;let l=t.globalSlug?`globals/${encodeURIComponent(t.globalSlug)}`:`${encodeURIComponent(t.collectionSlug??\\\"\\\")}/${encodeURIComponent(String(t.data.id))}`,s=`${this.s[0]}${this.s[1]}/${l}`,o=JSON.stringify({data:t.data,depth:this.s[2],flattenLocales:!1,...void 0!==t.locale?{locale:t.locale}:{}});if(!v(this.s,e))return{status:\\\"superseded\\\"};let a=await r(s,{method:\\\"POST\\\",credentials:\\\"include\\\",headers:{\\\"Content-Type\\\":\\\"application/json\\\",\\\"X-Payload-HTTP-Method-Override\\\":\\\"GET\\\"},body:o,signal:n.signal});if(!v(this.s,e)||b(n.signal))return{status:\\\"superseded\\\"};let u=a.ok;if(!v(this.s,e))return{status:\\\"superseded\\\"};if(!u){let t=a.status;return v(this.s,e)?(this.s[4](\\\"merge HTTP\\\",t,s),v(this.s,e)?{status:\\\"unavailable\\\"}:{status:\\\"superseded\\\"}):{status:\\\"superseded\\\"}}let h=await a.json();return!v(this.s,e)||b(n.signal)?{status:\\\"superseded\\\"}:null===h||\\\"object\\\"!=typeof h||Array.isArray(h)?(this.s[4](\\\"merge invalid\\\",s),v(this.s,e)?{status:\\\"unavailable\\\"}:{status:\\\"superseded\\\"}):{status:\\\"merged\\\",doc:h}}catch(t){return!v(this.s,e)||null!==n&&b(n.signal)?{status:\\\"superseded\\\"}:(this.s[4](\\\"merge exception\\\",t),v(this.s,e)?{status:\\\"unavailable\\\"}:{status:\\\"superseded\\\"})}finally{null!==n&&v(this.s,e)&&this.s[5]===n&&(this.s[5]=null)}}destroy(){this.s[6]+=1;let t=this.s[5];this.s[5]=null,this.s[7]+=1;try{t?.abort()}finally{this.s[7]-=1}}},Si=new Set([\\\"http:\\\",\\\"https:\\\",\\\"mailto:\\\",\\\"tel:\\\"]),$i=/^\\\\s*(?:javascript|data|vbscript|file|blob|about)\\\\s*:/i,Ai=/^(?:\\\\.{1,2}\\\\/|[a-zA-Z0-9_-]+\\\\/?)/,ki=new Set([\\\"style\\\",\\\"srcdoc\\\",\\\"formaction\\\",\\\"form\\\",\\\"id\\\",\\\"name\\\",\\\"is\\\",\\\"srcset\\\",\\\"imagesrcset\\\"]),Ti=new Set([\\\"href\\\",\\\"src\\\",\\\"poster\\\",\\\"cite\\\",\\\"action\\\",\\\"xlink:href\\\",\\\"data\\\"]),Ni=new WeakSet,xi=class{constructor(t,e){he(this,Mi);oe(this,\\\"s\\\");let i=e.scheduleFrame??(\\\"function\\\"==typeof requestAnimationFrame?requestAnimationFrame.bind(globalThis):t=>setTimeout(()=>{t(performance.now())},0)),n=e.cancelFrame??(\\\"function\\\"==typeof cancelAnimationFrame?cancelAnimationFrame.bind(globalThis):t=>{clearTimeout(t)});this.s=[t,e.debounceMs??50,e.isVisible,e.visibilityGateThreshold??50,e.disableVisibilityGate??!1,e.getCacheSize,e.onFlush,i,n,new Map,new Map,new Set,null,0,null,0,null,!1]}schedule(t){if(void 0!==t.identity&&(this.s[17]||!A(t.identity,this.s[16])))return;let e=this.s[9],i=e.get(t.target.element);i?(i.value=t.value,i.allFields=t.allFields,i.identity=t.identity,i.data=t.data):e.set(t.target.element,{...t,identity:t.identity,data:t.data}),ce(this,Mi,Ci).call(this)}acceptRevision(t){let e=this.s[16];A(t,e)||null!==e&&function(t,e){return t.generation!==e.generation?t.generation-e.generation:t.revision-e.revision}(t,e)<0||(ce(this,Mi,_i).call(this),ce(this,Mi,Pi).call(this),this.s[16]=t,this.s[17]=!1)}cancelRevision(t){A(t,this.s[16])&&(ce(this,Mi,_i).call(this),ce(this,Mi,Pi).call(this),this.s[17]=!0)}flushNow(){return ce(this,Mi,_i).call(this),ce(this,Mi,Li).call(this)}notifyVisible(t){let e=this.s[10],i=e.get(t);if(!i||(e.delete(t),!ce(this,Mi,ji).call(this,i)))return;let n=performance.now(),r=ce(this,Mi,Ei).call(this,i)?1:0;this.s[6]?.(ce(this,Mi,Ri).call(this,i,r,0,performance.now()-n,1===r?[i.target.fieldName]:[]))}retarget(t){ce(this,Mi,Ii).call(this,this.s[9],t),ce(this,Mi,Ii).call(this,this.s[10],t);for(let e of this.s[11])ce(this,Mi,Ii).call(this,e,t)}forget(t){this.s[9].delete(t),this.s[10].delete(t);for(let e of this.s[11])e.delete(t)}destroy(){ce(this,Mi,_i).call(this),ce(this,Mi,Pi).call(this),this.s[16]=null,this.s[17]=!1}get pendingCount(){return this.s[9].size}get replayCount(){return this.s[10].size}get gateThreshold(){return this.s[3]}get gateActive(){return!this.s[4]&&this.s[5]()>this.s[3]}},Mi=new WeakSet,Ci=function(){let t=this.s[13]+=1,e=this.s[12];if(this.s[12]=null,null!==e&&clearTimeout(e),this.s[13]!==t)return;let i=setTimeout(()=>{this.s[13]===t&&(this.s[12]=null,ce(this,Mi,Oi).call(this))},this.s[1]);this.s[13]===t&&(this.s[12]=i)},Oi=function(){let t=this.s[15]+=1,e=this.s[14];if(this.s[14]=null,null!==e&&this.s[8](e),this.s[15]!==t)return;let i=!1,n=this.s[7](()=>{this.s[15]===t&&(i=!0,this.s[14]=null,ce(this,Mi,Li).call(this))});!i&&this.s[15]===t&&(this.s[14]=n)},Li=function(){let t=performance.now(),e=!this.s[4]&&this.s[5]()>this.s[3],i=this.s[9];this.s[9]=new Map;let n,r=0,l=[],s=0;this.s[11].add(i);try{for(let t of i.values()){if(!ce(this,Mi,ji).call(this,t))continue;let i=!e||this.s[2](t.target.element);if(ce(this,Mi,ji).call(this,t)){if(n??(n=t),!i){this.s[10].set(t.target.element,t),s+=1;continue}this.s[10].delete(t.target.element),ce(this,Mi,Ei).call(this,t)&&(r+=1,l.push(t.target.fieldName))}}}finally{this.s[11].delete(i)}let o=ce(this,Mi,Ri).call(this,n,r,s,performance.now()-t,l);return this.s[6]?.(o),o},ji=function(t){return void 0===t.identity||!this.s[17]&&A(t.identity,this.s[16])},Ei=function(t){let e=this.s[0];return!1!==e(t)||!function(t){return Ni.has(t)}(e)},Ii=function(t,e){let i=t.get(e.element);if(void 0!==i){if(i.target.fieldName!==e.fieldName||i.target.locale!==e.locale){t.delete(e.element);return}i.target=e}},Pi=function(){this.s[9].clear(),this.s[10].clear();for(let t of this.s[11])t.clear()},Ri=function(t,e,i,n,r){return{applied:e,appliedFields:r,deferred:i,durationMs:n,...void 0!==t?.identity?{identity:t.identity}:{},...void 0!==t?.data?{data:t.data}:{}}},_i=function(){let t=this.s[12],e=this.s[14];this.s[13]+=1,this.s[15]+=1,this.s[12]=null,this.s[14]=null,null!==t&&clearTimeout(t),null!==e&&this.s[8](e)},Wi=\\\"1.8.0\\\",Fi=new Set([\\\"__proto__\\\",\\\"prototype\\\",\\\"constructor\\\"]),Di=\\\"payload-live-preview-a11y\\\",Ui=new WeakMap,zi=class{constructor(t,e){oe(this,\\\"s\\\");let i=e??(typeof document>\\\"u\\\"?null:document),n=i?.documentElement.getAttribute(\\\"lang\\\")??\\\"\\\";this.s=[x(t??(n.length>0?n:N())),i,null]}mount(){let t=this.s[1];if(null==t?.body)return null;let e=this.s[2];null===e&&(e=function(t){let e=Ui.get(t);return e??(e=[null,!1,null,0,null]),Ui.set(t,e),e[3]+=1,e}(t),this.s[2]=e);let i=e[0];if(i?.isConnected&&i.ownerDocument===t)return i;if(null!==i){let t=e[1];M(e),t&&i.remove()}let n=t.getElementById(Di);return e[1]=null===n,n||(n=t.createElement(\\\"div\\\"),n.id=Di,n.setAttribute(\\\"role\\\",\\\"status\\\"),n.setAttribute(\\\"aria-live\\\",\\\"polite\\\"),n.setAttribute(\\\"aria-atomic\\\",\\\"true\\\"),n.setAttribute(\\\"style\\\",\\\"position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0\\\"),t.body.appendChild(n)),e[0]=n,n}announceConnected(){this.say(this.s[0]?\\\"Vorschau verbunden\\\":\\\"Live preview connected\\\")}announceDisconnected(){this.say(this.s[0]?\\\"Vorschau getrennt\\\":\\\"Live preview disconnected\\\")}announceUpdate(t){t<=0||this.say(this.s[0]?`${String(t)} ${1===t?\\\"\\\\xc4nderung\\\":\\\"\\\\xc4nderungen\\\"} angewendet`:`${String(t)} ${1===t?\\\"change\\\":\\\"changes\\\"} applied`)}detach(){let t=this.s[2],e=this.s[1];if(null===t||null===e||(this.s[2]=null,t[3]-=1,t[3]>0))return;let i=t[0];null!==i&&M(t),t[1]&&i?.remove(),t[0]=null,Ui.delete(e)}say(t){let e=this.mount(),i=this.s[2];if(null===e||null===i)return;let n=i[2];n?.parentNode!==e?(n?.remove(),n=e.ownerDocument.createTextNode(e.hasChildNodes()?` ${t}`:t),i[2]=n,e.appendChild(n)):n.data=null===n.previousSibling?t:` ${t}`,null!==i[4]&&clearTimeout(i[4]);let r=setTimeout(()=>{i[4]===r&&i[0]===e&&M(i)},1500);i[4]=r}},Vi=new Set([\\\"tabs\\\",\\\"row\\\",\\\"collapsible\\\"]),Gi={text:\\\"text\\\",textarea:\\\"textarea\\\",richText:\\\"richText\\\",email:\\\"email\\\",number:\\\"number\\\",checkbox:\\\"checkbox\\\",date:\\\"date\\\",select:\\\"select\\\",radio:\\\"radio\\\",array:\\\"array\\\",blocks:\\\"blocks\\\",group:\\\"text\\\",tabs:\\\"text\\\",row:\\\"text\\\",collapsible:\\\"text\\\",relationship:\\\"relationship\\\",upload:\\\"upload\\\",point:\\\"text\\\",json:\\\"text\\\",code:\\\"text\\\",ui:\\\"text\\\"},Bi=[0,500,1e3,2e3],Hi=class{constructor(t){he(this,qi);oe(this,\\\"d\\\");oe(this,\\\"l\\\");let n=t.emitter,r=t.renderers,l=t.resolveRenderer??(t=>r[t]),s=t.transformValue,o=t.root??(typeof document<\\\"u\\\"?document:null),a=t.readyTargets,u=t.sendReady??R,h=t.onHeartbeatTimeout,d=void 0===t.log?i:e(t.log),f=void 0===t.warn?pe:e(t.warn),p=function(t){if(!1===t.enableA11y)return null;let e=void 0===t.root?void 0:9===t.root.nodeType?t.root:t.root.ownerDocument;return new zi(t.a11yLocale,e)}(t),g=void 0!==t.dataMerge?new wi({serverURL:t.dataMerge.serverURL,...void 0!==t.dataMerge.apiRoute?{apiRoute:t.dataMerge.apiRoute}:{},...void 0!==t.dataMerge.depth?{depth:t.dataMerge.depth}:{},...void 0!==t.dataMerge.fetchFn?{fetchFn:t.dataMerge.fetchFn}:{},log:(...t)=>{d(...t)}}):null,m=new ze,y=new Ke({onStructuralChange:()=>{ce(this,qi,Qi).call(this)},onVisibilityChange:(t,e)=>{e&&this.d[3].notifyVisible(t)}},{...void 0!==t.intersectionRootMargin?{intersectionRootMargin:t.intersectionRootMargin}:{}}),v=new xi($(t=>ce(this,qi,fn).call(this,t)),{...void 0!==t.debounceMs?{debounceMs:t.debounceMs}:{},...void 0!==t.disableVisibilityGate?{disableVisibilityGate:t.disableVisibilityGate}:{},...void 0!==t.visibilityGateThreshold?{visibilityGateThreshold:t.visibilityGateThreshold}:{},isVisible:t=>y.isVisible(t),getCacheSize:()=>m.elementCount,onFlush:t=>{ce(this,qi,pn).call(this,t)}}),b=new ri(t.originMatcher,{onUpdate:(t,e,i)=>{ce(this,qi,en).call(this,t,e,i)},onDocumentEvent:()=>{n.emit(\\\"documentSave\\\",{timestamp:Date.now()})},onInvalid:(t,e)=>{if(\\\"token\\\"===t){let t=new Error(`Preview token rejected (origin: ${e})`);n.emit(\\\"error\\\",{error:t,context:\\\"token\\\",code:\\\"LP0502\\\"})}d(\\\"LP0501 message rejected:\\\",t,e)},...void 0!==t.validateToken?{validateToken:t.validateToken}:{}}),w=new bi(()=>{}),S=new vi({...void 0!==t.heartbeatMs?{timeoutMs:t.heartbeatMs}:{},onTimeout:()=>{ce(this,qi,gn).call(this)}});this.d=[n,m,y,v,b,w,S,r,l,s,o,a,u,h,d,f,[],p,g,!0===t.scopeBindingsByOwner,t.lockedOrigin??(()=>{})],this.l=[void 0,void 0,void 0,c(void 0),!1,null,0,null,new Set,!1,!1,0,null,new Set]}start(){if(this.l[4])return!1;this.l[4]=!0;let t=this.d[10];if(P(t)&&\\\"loading\\\"===t.readyState){let e=()=>{if(this.l[4]){this.l[5]=null;try{ce(this,qi,Ji).call(this)}catch(t){ce(this,qi,Yi).call(this),ce(this,qi,yn).call(this,t,\\\"startup\\\",\\\"LP0605\\\")}}};this.l[5]=e;try{t.addEventListener(\\\"DOMContentLoaded\\\",e,{once:!0})}catch(t){throw ce(this,qi,Yi).call(this),t}return!0}try{return ce(this,qi,Ji).call(this),!0}catch(t){throw ce(this,qi,Yi).call(this),t}}suspend(){return!!this.l[4]&&(ce(this,qi,Xi).call(this)&&this.d[0].emit(\\\"disconnect\\\",{reason:\\\"unload\\\",timestamp:Date.now()}),!0)}destroy(){this.l[4]&&(ce(this,qi,Xi).call(this)&&this.d[0].emit(\\\"disconnect\\\",{reason:\\\"destroy\\\",timestamp:Date.now()}),this.d[17]?.detach(),this.d[0].emit(\\\"destroy\\\",{timestamp:Date.now()}))}refreshCache(){this.l[4]&&ce(this,qi,Qi).call(this)}get status(){return this.d[5].status}get cache(){return this.d[1]}get updateCount(){return this.l[6]}get protocol(){return this.l[3]}inspect(){let t=this.d[1],e=this.d[3],i=this.l[3],n=this.l[7],r=this.l[12],l=[],s=new Set;for(let[e,i]of t.entries()){l.push(e);for(let t of i)void 0!==t.owner&&s.add(t.owner)}return{version:Wi,started:this.l[4],status:this.d[5].status,origins:{trusted:[...this.d[11]],locked:this.d[20]()},protocol:{ours:i.ours,theirs:i.theirs,negotiated:i.negotiated,capabilities:[...i.capabilities].sort()},revisions:{accepted:this.l[6],superseded:this.l[11],active:null===n?void 0:n.identity.revision},bindings:{elements:t.elementCount,fields:t.fieldCount,fieldNames:l.sort(),absentFields:[...this.l[13]].sort(),orphanFields:[...this.l[8]].sort(),ownerScoped:this.d[19],owners:[...s].sort()},scheduler:{pending:e.pendingCount,deferred:e.replayCount,visibilityGateThreshold:e.gateThreshold,visibilityGateActive:e.gateActive,lastFlush:null===r?void 0:{applied:r.applied,appliedFields:r.appliedFields,deferred:r.deferred,durationMs:r.durationMs}},renderers:Object.keys(this.d[7]).sort()}}},qi=new WeakSet,Ji=function(){if(!this.l[4])return;let t=P(this.d[10])?function(t){return t.body}(this.d[10]):this.d[10];if(null===t)throw new Error(\\\"LivePreviewRuntime: document.body unavailable\\\");if(this.d[2].start(t),ce(this,qi,Ki).call(this),ce(this,qi,dn).call(this)&&(this.d[4].attach(),this.d[0].emitWhile(\\\"init\\\",{timestamp:Date.now()},()=>this.l[4]),ce(this,qi,dn).call(this)))for(let t of Bi){if(!ce(this,qi,dn).call(this))return;if(0===t){if(this.d[12](this.d[11]),!ce(this,qi,dn).call(this))return}else{let e=setTimeout(()=>{this.l[4]&&ce(this,qi,mn).call(this)},t);this.d[16].push(e)}}},Xi=function(){this.l[7]=null,this.l[4]=!1;let t=this.l[5];this.l[5]=null,null!==t&&P(this.d[10])&&ce(this,qi,Zi).call(this,()=>{this.d[10].removeEventListener(\\\"DOMContentLoaded\\\",t)});for(let t of this.d[16])ce(this,qi,Zi).call(this,()=>{clearTimeout(t)});return this.d[16].length=0,ce(this,qi,Zi).call(this,()=>{this.d[6].stop()}),ce(this,qi,Zi).call(this,()=>{this.d[4].detach()}),ce(this,qi,Zi).call(this,()=>{this.d[2].stop()}),ce(this,qi,Zi).call(this,()=>{this.d[3].destroy()}),ce(this,qi,Zi).call(this,()=>{this.d[18]?.destroy()}),this.d[1].clear(),this.d[5].markDisconnected()},Yi=function(){ce(this,qi,Xi).call(this),ce(this,qi,Zi).call(this,()=>{this.d[17]?.detach()})},Zi=function(t){try{t()}catch(t){this.d[14](\\\"cleanup failed:\\\",t)}},Ki=function(){if(!this.l[4])return;let t=this.d[1].buildFromRoot(this.d[10]);if(this.d[14](\\\"cache\\\",t),ce(this,qi,dn).call(this)&&(this.d[0].emitWhile(\\\"cacheRefresh\\\",t,()=>this.l[4]),ce(this,qi,dn).call(this)))for(let t of this.d[1].values()){if(!ce(this,qi,dn).call(this))return;this.d[2].observeElement(t.element)}},Qi=function(){if(!this.l[4])return;let t=new Map;for(let e of this.d[1].values())t.set(e.element,e),this.d[2].unobserveElement(e.element);if(ce(this,qi,Ki).call(this),ce(this,qi,dn).call(this)){for(let e of this.d[1].values())t.get(e.element)?.fieldName===e.fieldName?this.d[3].retarget(e):this.d[3].forget(e.element),t.delete(e.element);for(let e of t.values())this.d[3].forget(e.element)}},tn=function(t){let e=this.l[3];if(e.theirs===t)return;let i=c(t);this.l[3]=i,i.negotiated!==e.negotiated&&this.d[14](\\\"protocol\\\",\\\"ours=4\\\",`theirs=${t}`,`negotiated=${i.negotiated}`)},en=function(t,e,i){if(this.d[6].kick(),void 0===t.data){void 0!==t.protocolVersion&&ce(this,qi,tn).call(this,t.protocolVersion);return}if(void 0===i)return;\\\"string\\\"==typeof t.locale&&(this.l[0]=t.locale),Array.isArray(t.fieldSchemaJSON)&&(this.l[1]=t.fieldSchemaJSON,this.l[2]=C(t.fieldSchemaJSON));let n={identity:i,message:t,locale:this.l[0],schema:this.l[1],schemaIndex:this.l[2],cancelled:!1};null!==this.l[7]&&(this.l[11]+=1),this.l[7]=n,this.d[3].acceptRevision(i),this.l[6]+=1,(void 0===t.protocolVersion||(ce(this,qi,tn).call(this,t.protocolVersion),this.l[4]&&this.l[7]===n))&&(this.d[5].markConnected()&&(this.d[17]?.announceConnected(),this.d[0].emit(\\\"connect\\\",{origin:e,timestamp:Date.now()}),!this.l[4]||this.l[7]!==n||(this.d[14](\\\"connection\\\",\\\"disconnected\\\",\\\"\\\\u2192\\\",\\\"connected\\\"),!this.l[4]||this.l[7]!==n))||ce(this,qi,nn).call(this,n))},nn=async function(t){let e=await ce(this,qi,rn).call(this,t);if(null===e||!this.l[4]||this.l[7]!==t)return;let{message:i}=t,n={fields:e,...void 0!==t.schema?{schema:t.schema}:{},...\\\"string\\\"==typeof i.globalSlug?{globalSlug:i.globalSlug}:{},...\\\"string\\\"==typeof i.collectionSlug?{collectionSlug:i.collectionSlug}:{},...void 0!==t.locale?{locale:t.locale}:{}};this.d[0].listenerCount(\\\"beforeUpdate\\\")>0&&(!await this.d[0].emitWhile(\\\"beforeUpdate\\\",{data:n,revision:t.identity.revision,cancel:()=>{t.cancelled=!0,this.d[3].cancelRevision(t.identity)}},()=>!t.cancelled&&this.l[4]&&this.l[7]===t)||t.cancelled||!this.l[4]||this.l[7]!==t)||this.l[4]&&this.l[7]===t&&ce(this,qi,ln).call(this,t,n)},rn=async function(t){let{message:e}=t,i=e.data??{};if(null===this.d[18])return i;let n=await this.d[18].merge({collectionSlug:e.collectionSlug,globalSlug:e.globalSlug,data:i,locale:t.locale});return this.l[4]&&this.l[7]===t?\\\"merged\\\"===n.status?n.doc:\\\"superseded\\\"===n.status?null:i:null},ln=function(t,e){if(!this.l[4]||this.l[7]!==t)return;let i=()=>this.l[4]&&this.l[7]===t,n=ce(this,qi,sn).call(this,t,e.fields);for(let[r,l]of this.d[1].entries()){if(!this.l[4]||this.l[7]!==t)return;for(let s of l){if(!1!==n&&!o(s.owner,n))continue;let l=k(e.fields,r,s.locale??t.locale,void 0!==s.locale);if(void 0===l){this.l[13].add(r);continue}if(!this.l[4]||this.l[7]!==t)return;let a=ce(this,qi,hn).call(this,s,l,e.fields,i);if(!this.l[4]||this.l[7]!==t)return;let u={target:s,value:a,allFields:e.fields,identity:t.identity,data:e};if(!this.l[4]||this.l[7]!==t)return;this.d[3].schedule(u)}}ce(this,qi,un).call(this,e.fields,t.locale,n)},sn=function(t,e){if(!this.d[19])return!1;let{message:i}=t,n=function(t){if(s(t.globalSlug))return[r(t.globalSlug)];if(!s(t.collectionSlug))return null;let e=l(t.collectionSlug);return s(t.documentId)?[e,l(t.collectionSlug,t.documentId)]:[e]}({globalSlug:\\\"string\\\"==typeof i.globalSlug?i.globalSlug:void 0,collectionSlug:\\\"string\\\"==typeof i.collectionSlug?i.collectionSlug:void 0,documentId:a(e)});return null===n&&!this.l[9]&&(this.l[9]=!0,this.d[15](\\\"[live-preview] LP0202: scopeBindingsByOwner: update names no document; nothing applied\\\")),n},on=function(t){for(let e of this.d[1].values())if(o(e.owner,t))return!0;return!1},an=function(t,e){let i=this.d[1].get(t);return void 0!==i&&(!1===e||i.some(t=>o(t.owner,e)))},un=function(t,e,i){if(0===this.d[1].fieldCount||!1!==i&&!ce(this,qi,on).call(this,i))return;let n;for(let[r,l]of Object.entries(t)){if(this.l[8].has(r)||bn.has(r)||!W(l))continue;let t=F(r,e);if(!(ce(this,qi,an).call(this,r,i)||t!==r&&ce(this,qi,an).call(this,t,i))){if(void 0===n){n=new Set;for(let[t,e]of this.d[1].entries())for(let r of e)!1!==i&&!o(r.owner,i)||void 0!==r.locale&&n.add(`${t}_${r.locale}`)}n.has(r)||(this.l[8].add(r),this.d[15](`[live-preview] LP0201: update arrived for field \\\"${r}\\\" but no <\\\\u2026 data-payload-field=\\\"${t}\\\"> element exists on this page. Render the binding anchor unconditionally in your template so live edits to an initially-empty field have somewhere to land.`))}}},hn=function(e,i,n,r){if(void 0===this.d[9])return i;try{let l=this.d[9](e.fieldName,i,{element:e.element,allFields:n},r),s=t(l);if(!r())return i;if(s)throw new TypeError(`Transform for \\\"${e.fieldName}\\\" returned a Promise/thenable; transforms must be synchronous`);return l}catch(t){if(!r())return i;let e=t instanceof Error?t:new Error(String(t));return this.d[0].emit(\\\"error\\\",{error:e,context:\\\"transform\\\",code:\\\"LP0602\\\"}),i}},dn=function(){return this.l[4]},cn=function(t){0!==t.deferred&&(this.l[10]||(this.l[10]=!0,this.d[15](`[live-preview] LP0301: visibility gate held ${String(t.deferred)} offscreen update(s) until scrolled into view; see visibilityGateThreshold.`)))},fn=function(t){let e=this.l[7];if(null===e||void 0===t.identity||!_(e.identity,t.identity)||!this.l[4]||this.l[7]!==e)return!1;let i=void 0!==e.schemaIndex?function(t,e){if(t.has(e))return t.get(e);let i=e.replace(/\\\\.\\\\d+(?=\\\\.|$)/g,\\\".*\\\");return t.has(i)?t.get(i):void 0}(e.schemaIndex,t.target.fieldName):void 0,n=t.value,r=function(t,e){if(t.explicitFieldType)return t.fieldType;if(void 0!==e){let t=function(t){if(Object.prototype.hasOwnProperty.call(Gi,t))return Gi[t]}(e);if(void 0!==t)return t}return t.fieldType}(t.target,i?.type);\\\"text\\\"===r&&!0!==t.target.explicitFieldType&&function(t){if(\\\"object\\\"!=typeof t||null===t||!(\\\"root\\\"in t))return!1;let e=t.root;return\\\"object\\\"==typeof e&&null!==e&&Array.isArray(e.children)}(n)&&(r=\\\"richText\\\");let l;try{l=this.d[8](r)}catch(t){if(!this.l[4]||this.l[7]!==e)return!1;let i=t instanceof Error?t:new Error(String(t));return this.d[0].emitWhile(\\\"error\\\",{error:i,context:\\\"renderer\\\",code:\\\"LP0603\\\"},()=>this.l[4]&&this.l[7]===e),!1}if(!this.l[4]||this.l[7]!==e)return!1;let s=this.d[0].listenerCount(\\\"elementUpdate\\\")>0,o=s?function(t){return\\\"INPUT\\\"===t.tagName||\\\"TEXTAREA\\\"===t.tagName?t.value:\\\"IMG\\\"===t.tagName?t.src:t.textContent}(t.target.element):void 0;if(!this.l[4]||this.l[7]!==e)return!1;let a={allFields:t.allFields,locale:t.target.locale??e.locale,schema:i};try{if(void 0!==t.target.targetAttribute){if(\\\"blocked\\\"===function(t,e,i){let n=e.toLowerCase().trim();if(0===n.length||n.startsWith(\\\"on\\\")||ki.has(n))return\\\"blocked\\\";if(null==i)return t.removeAttribute(n),\\\"applied\\\";if(\\\"string\\\"!=typeof i&&\\\"number\\\"!=typeof i&&\\\"boolean\\\"!=typeof i)return\\\"blocked\\\";let r=String(i);return Ti.has(n)&&!w(r)?\\\"blocked\\\":(t.setAttribute(n,r),\\\"applied\\\")}(t.target.element,t.target.targetAttribute,n))return this.d[15](`[live-preview] LP0401: refused to write field \\\"${t.target.fieldName}\\\" into attribute \\\"${t.target.targetAttribute}\\\" (unsafe attribute or value)`),!1}else{if(!l)return this.d[14](\\\"no renderer for\\\",r),!1;if(!1===function(t,e,i,n){return t.render(e,i,n)}(l,t.target,n,a)&&function(t){return Ni.has(t.render)}(l))return!1}}catch(t){if(!this.l[4]||this.l[7]!==e)return!1;let i=t instanceof Error?t:new Error(String(t));return this.d[0].emitWhile(\\\"error\\\",{error:i,context:\\\"renderer\\\",code:\\\"LP0603\\\"},()=>this.l[4]&&this.l[7]===e),!1}return!(!this.l[4]||this.l[7]!==e)&&(s&&this.d[0].emitWhile(\\\"elementUpdate\\\",{element:t.target.element,fieldName:t.target.fieldName,previousValue:o,nextValue:n,revision:e.identity.revision},()=>this.l[4]&&this.l[7]===e),this.l[4]&&this.l[7]===e)},pn=function(t){this.l[12]=t,ce(this,qi,cn).call(this,t);let{identity:e,data:i}=t;if(0===t.applied||void 0===e||void 0===i)return;let n=this.l[7];if(null===n||!this.l[4]||this.l[7]!==n||!_(n.identity,e))return;let r=()=>this.l[4]&&this.l[7]===n&&_(n.identity,e);this.d[17]?.announceUpdate(t.applied),r()&&0!==this.d[0].listenerCount(\\\"afterUpdate\\\")&&this.d[0].emitWhile(\\\"afterUpdate\\\",{data:i,updatedCount:t.applied,durationMs:t.durationMs,revision:e.revision},r)},gn=function(){if(!ce(this,qi,dn).call(this))return;this.d[4].advanceGeneration();let t=this.l[7];this.l[7]=null,null!==t&&this.d[3].cancelRevision(t.identity),this.d[18]?.destroy();let e=this.d[5].markDisconnected();try{this.d[13]?.()}catch(t){this.d[14](\\\"heartbeat:\\\",t)}ce(this,qi,dn).call(this)&&(e&&ce(this,qi,vn).call(this)&&(this.d[17]?.announceDisconnected(),this.d[0].emitWhile(\\\"disconnect\\\",{reason:\\\"timeout\\\",timestamp:Date.now()},()=>ce(this,qi,vn).call(this)),!ce(this,qi,dn).call(this)||ce(this,qi,vn).call(this)&&(this.d[14](\\\"connection\\\",\\\"connected\\\",\\\"\\\\u2192\\\",\\\"disconnected\\\"),!ce(this,qi,dn).call(this)))||ce(this,qi,dn).call(this)&&ce(this,qi,mn).call(this))},mn=function(){try{this.d[12](this.d[11])}catch(t){ce(this,qi,yn).call(this,t,\\\"ready\\\",\\\"LP0606\\\")}},yn=function(t,e,i){let n=t instanceof Error?t:new Error(String(t));this.d[0].emit(\\\"error\\\",{error:n,context:e,code:i})},vn=function(){return this.l[4]&&\\\"disconnected\\\"===this.d[5].status&&null===this.l[7]},bn=new Set([\\\"id\\\",\\\"_id\\\",\\\"createdAt\\\",\\\"updatedAt\\\",\\\"createdBy\\\",\\\"updatedBy\\\",\\\"_status\\\",\\\"globalType\\\",\\\"collection\\\",\\\"locale\\\",\\\"localized\\\"]),wn=/^https?:\\\\/\\\\/(localhost|127\\\\.0\\\\.0\\\\.1)(?::\\\\d+)?$/i,Sn=/^https?:\\\\/\\\\/[^/?#\\\\s]+$/i,$n=[\\\"PAYLOAD_ADMIN_ORIGIN\\\",\\\"PUBLIC_PAYLOAD_ADMIN_ORIGIN\\\",\\\"NEXT_PUBLIC_PAYLOAD_ADMIN_ORIGIN\\\"],An=class{constructor(t={}){he(this,kn);let e=new Set;for(let i of t.additionalOrigins??[]){let t=z(i);void 0!==t&&e.add(t)}for(let t of $n){let i=U(t);if(void 0!==i)for(let t of i.split(\\\",\\\")){let i=z(t);void 0!==i&&e.add(i)}}let i;if(t.enableReferrerDetection??1){let e=t.referrer??(typeof document<\\\"u\\\"?document.referrer:\\\"\\\");if(e.length>0)try{let t=new URL(e).origin;t&&\\\"null\\\"!==t&&(i=t)}catch{}}let n=(t.enableLocalhostMatching??!0)&&(t.forceDevMode??function(){let t=function(){if(!(typeof process>\\\"u\\\"))return\\\"production\\\"}();if(void 0!==t)return\\\"production\\\"!==t;0;if(typeof window<\\\"u\\\"){let t=window.location.hostname;if(\\\"localhost\\\"===t||\\\"127.0.0.1\\\"===t)return!0}return!1}());de(this,kn,[e,i,n,void 0!==i,void 0])}matches(t){return 0!==t.length&&\\\"null\\\"!==t&&(void 0!==ue(this,kn)[4]?t===ue(this,kn)[4]:!!(ue(this,kn)[0].has(t)||0===ue(this,kn)[0].size&&void 0!==ue(this,kn)[1]&&t===ue(this,kn)[1]||ue(this,kn)[2]&&wn.test(t)))}lockOrigin(t){return!!this.matches(t)&&(ue(this,kn)[4]=t,!0)}unlockOrigin(){let t=ue(this,kn)[4];return ue(this,kn)[4]=void 0,t}get lockedOrigin(){return ue(this,kn)[4]}enumerate(){if(void 0!==ue(this,kn)[4])return[ue(this,kn)[4]];let t=new Set(ue(this,kn)[0]);if(0===ue(this,kn)[0].size&&void 0!==ue(this,kn)[1]&&t.add(ue(this,kn)[1]),ue(this,kn)[2])for(let e of Tn)t.add(`http://localhost:${String(e)}`),t.add(`http://127.0.0.1:${String(e)}`);return[...t]}get referrerWasAvailable(){return ue(this,kn)[3]}get isProductionUnconfigured(){return!(!D()||ue(this,kn)[0].size>0||ue(this,kn)[2]||void 0!==ue(this,kn)[1])}get isReferrerOnlyTrust(){return!(ue(this,kn)[0].size>0||ue(this,kn)[2])&&void 0!==ue(this,kn)[1]}},kn=new WeakMap,Tn=[3e3,3001,3333,4e3,4321,5e3,5173,5174,8e3,8080,8888,9e3],Nn=new Set([\\\"p\\\",\\\"br\\\",\\\"strong\\\",\\\"b\\\",\\\"em\\\",\\\"i\\\",\\\"u\\\",\\\"s\\\",\\\"strike\\\",\\\"mark\\\",\\\"small\\\",\\\"h1\\\",\\\"h2\\\",\\\"h3\\\",\\\"h4\\\",\\\"h5\\\",\\\"h6\\\",\\\"ul\\\",\\\"ol\\\",\\\"li\\\",\\\"dl\\\",\\\"dt\\\",\\\"dd\\\",\\\"blockquote\\\",\\\"code\\\",\\\"pre\\\",\\\"kbd\\\",\\\"samp\\\",\\\"var\\\",\\\"a\\\",\\\"span\\\",\\\"div\\\",\\\"section\\\",\\\"article\\\",\\\"aside\\\",\\\"header\\\",\\\"footer\\\",\\\"nav\\\",\\\"figure\\\",\\\"figcaption\\\",\\\"img\\\",\\\"picture\\\",\\\"source\\\",\\\"audio\\\",\\\"video\\\",\\\"sub\\\",\\\"sup\\\",\\\"hr\\\",\\\"time\\\",\\\"abbr\\\",\\\"cite\\\",\\\"q\\\",\\\"table\\\",\\\"thead\\\",\\\"tbody\\\",\\\"tfoot\\\",\\\"tr\\\",\\\"th\\\",\\\"td\\\",\\\"caption\\\",\\\"colgroup\\\",\\\"col\\\"]),xn=new Set([\\\"script\\\",\\\"style\\\",\\\"iframe\\\",\\\"object\\\",\\\"embed\\\",\\\"link\\\",\\\"meta\\\",\\\"base\\\",\\\"form\\\",\\\"input\\\",\\\"button\\\",\\\"select\\\",\\\"textarea\\\",\\\"svg\\\",\\\"math\\\",\\\"template\\\",\\\"frame\\\",\\\"frameset\\\",\\\"noframes\\\",\\\"noscript\\\"]),Mn=new Set([\\\"id\\\",\\\"class\\\",\\\"lang\\\",\\\"dir\\\",\\\"title\\\",\\\"role\\\",\\\"tabindex\\\"]),Cn=\\\"aria-\\\",On=\\\"data-\\\",Ln={a:new Set([\\\"href\\\",\\\"target\\\",\\\"rel\\\",\\\"download\\\",\\\"hreflang\\\",\\\"type\\\"]),img:new Set([\\\"src\\\",\\\"srcset\\\",\\\"sizes\\\",\\\"alt\\\",\\\"width\\\",\\\"height\\\",\\\"loading\\\",\\\"decoding\\\"]),picture:new Set([]),source:new Set([\\\"src\\\",\\\"srcset\\\",\\\"sizes\\\",\\\"type\\\",\\\"media\\\"]),audio:new Set([\\\"src\\\",\\\"controls\\\",\\\"autoplay\\\",\\\"loop\\\",\\\"muted\\\",\\\"preload\\\"]),video:new Set([\\\"src\\\",\\\"poster\\\",\\\"controls\\\",\\\"autoplay\\\",\\\"loop\\\",\\\"muted\\\",\\\"preload\\\",\\\"width\\\",\\\"height\\\",\\\"playsinline\\\"]),time:new Set([\\\"datetime\\\"]),abbr:new Set([\\\"title\\\"]),q:new Set([\\\"cite\\\"]),blockquote:new Set([\\\"cite\\\"]),table:new Set([\\\"summary\\\"]),th:new Set([\\\"colspan\\\",\\\"rowspan\\\",\\\"scope\\\",\\\"headers\\\",\\\"abbr\\\"]),td:new Set([\\\"colspan\\\",\\\"rowspan\\\",\\\"headers\\\"]),col:new Set([\\\"span\\\"]),colgroup:new Set([\\\"span\\\"]),ol:new Set([\\\"start\\\",\\\"reversed\\\",\\\"type\\\"]),li:new Set([\\\"value\\\"]),code:new Set([\\\"class\\\"]),pre:new Set([\\\"class\\\"])},jn=new Set([\\\"href\\\",\\\"src\\\",\\\"cite\\\",\\\"poster\\\"]),En=1,In=8,Pn=class extends Error{constructor(){super(...arguments);oe(this,\\\"name\\\",\\\"SanitizerEnvironmentError\\\")}},Rn=(Object.freeze({allowedTags:Nn,removeCompletely:xn,globalAttributes:Mn,attributesByTag:Ln,urlAttributes:jn}),new Map),_n={1:\\\"left\\\",2:\\\"center\\\",3:\\\"right\\\",4:\\\"justify\\\"},Wn=new Set([\\\"left\\\",\\\"center\\\",\\\"right\\\",\\\"justify\\\",\\\"start\\\",\\\"end\\\"]),Fn=Object.freeze({\\\"&\\\":\\\"&amp;\\\",\\\"<\\\":\\\"&lt;\\\",\\\">\\\":\\\"&gt;\\\",'\\\"':\\\"&quot;\\\",\\\"'\\\":\\\"&#x27;\\\",\\\"/\\\":\\\"&#x2F;\\\",\\\"`\\\":\\\"&#x60;\\\",\\\"=\\\":\\\"&#x3D;\\\"}),Dn=/[&<>\\\"'/`=]/g,Un=Object.freeze({\\\"&\\\":\\\"&amp;\\\",\\\"<\\\":\\\"&lt;\\\",\\\">\\\":\\\"&gt;\\\",'\\\"':\\\"&quot;\\\",\\\"'\\\":\\\"&#x27;\\\"}),zn=/[&<>\\\"']/g,Vn=new Set([\\\"h1\\\",\\\"h2\\\",\\\"h3\\\",\\\"h4\\\",\\\"h5\\\",\\\"h6\\\"]),Gn=(t,e)=>{let i=\\\"string\\\"==typeof t.url?t.url:\\\"\\\",n=e.renderChildren(t.children??[]);if(0===i.length||!w(i))return n;let r=S(i)?' target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\"':function(t){let e=\\\"string\\\"==typeof t.target?t.target:\\\"\\\";if(0===e.length)return\\\"\\\";let i=Q(e);return\\\"_blank\\\"===e?' target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\"':` target=\\\"${i}\\\"`}(t),l=\\\"string\\\"==typeof t.title?` title=\\\"${Q(t.title)}\\\"`:\\\"\\\";return`<a href=\\\"${tt(i)}\\\"${r}${l}>${n}</a>`},Bn=new Map;J(\\\"text\\\",t=>{let e=Q(\\\"string\\\"==typeof t.text?t.text:\\\"\\\"),i=\\\"number\\\"==typeof t.format?t.format:0;return!!(16&i)&&(e=`<code>${e}</code>`),!!(1&i)&&(e=`<strong>${e}</strong>`),!!(2&i)&&(e=`<em>${e}</em>`),!!(8&i)&&(e=`<u>${e}</u>`),!!(4&i)&&(e=`<s>${e}</s>`),!!(32&i)&&(e=`<sub>${e}</sub>`),!!(64&i)&&(e=`<sup>${e}</sup>`),!!(128&i)&&(e=`<mark>${e}</mark>`),e});J(\\\"paragraph\\\",(t,e)=>{let i=e.renderChildren(t.children??[]);return`<p${Z(t)}${K(t)}>${i}</p>`});J(\\\"heading\\\",(t,e)=>{let i=\\\"string\\\"==typeof t.tag?t.tag.toLowerCase():\\\"h2\\\",n=Vn.has(i)?i:\\\"h2\\\",r=e.renderChildren(t.children??[]);return`<${n}${Z(t)}${K(t)}>${r}</${n}>`});J(\\\"list\\\",(t,e)=>{let i=\\\"string\\\"==typeof t.listType?t.listType:\\\"bullet\\\",n=\\\"number\\\"===i?\\\"ol\\\":\\\"ul\\\",r=\\\"number\\\"===i&&\\\"number\\\"==typeof t.start&&t.start>1?` start=\\\"${String(t.start)}\\\"`:\\\"\\\",l=\\\"check\\\"===i?' role=\\\"list\\\"':\\\"\\\",s=e.renderChildren(t.children??[]);return`<${n}${Z(t)}${K(t)}${r}${l}>${s}</${n}>`});J(\\\"listitem\\\",(t,e)=>{let i=e.renderChildren(t.children??[]);if(\\\"boolean\\\"==typeof t.checked)return`<li role=\\\"checkbox\\\" aria-checked=\\\"${t.checked?\\\"true\\\":\\\"false\\\"}\\\"${K(t)}>${i}</li>`;let n=\\\"number\\\"==typeof t.value?` value=\\\"${Q(String(t.value))}\\\"`:\\\"\\\";return`<li${Z(t)}${K(t)}${n}>${i}</li>`});J(\\\"link\\\",Gn);J(\\\"autolink\\\",Gn);J(\\\"quote\\\",(t,e)=>{let i=e.renderChildren(t.children??[]);return`<blockquote${Z(t)}${K(t)}>${i}</blockquote>`});J(\\\"code\\\",t=>{let e=nt(\\\"string\\\"==typeof t.language?t.language:\\\"\\\");return`<pre><code${\\\"\\\"===e?\\\"\\\":` class=\\\"language-${e}\\\"`}>${Q(it(t))}</code></pre>`});J(\\\"code-highlight\\\",t=>{let e=\\\"string\\\"==typeof t.text?t.text:\\\"\\\";return`<span${\\\"string\\\"==typeof t.highlightType?` class=\\\"token-${nt(t.highlightType)}\\\"`:\\\"\\\"}>${Q(e)}</span>`});J(\\\"linebreak\\\",()=>\\\"<br>\\\");J(\\\"horizontalrule\\\",()=>\\\"<hr>\\\");J(\\\"tab\\\",()=>\\\"\\\\t\\\");J(\\\"upload\\\",t=>{let e=function(t){let e=t.value;if(\\\"object\\\"==typeof e&&null!==e)return e}(t);if(void 0===e)return\\\"\\\";let i=e.url;if(\\\"string\\\"!=typeof i||!w(i))return\\\"\\\";let n=\\\"string\\\"==typeof e.mimeType?e.mimeType:\\\"\\\";return n.startsWith(\\\"video/\\\")?function(t,e){let i=\\\"number\\\"==typeof t.width?` width=\\\"${String(t.width)}\\\"`:\\\"\\\",n=\\\"number\\\"==typeof t.height?` height=\\\"${String(t.height)}\\\"`:\\\"\\\",r=\\\"string\\\"==typeof t.mimeType?` type=\\\"${tt(t.mimeType)}\\\"`:\\\"\\\";return`<video controls${i}${n}><source src=\\\"${tt(e)}\\\"${r}></video>`}(e,i):n.startsWith(\\\"audio/\\\")?function(t,e){let i=\\\"string\\\"==typeof t.mimeType?` type=\\\"${tt(t.mimeType)}\\\"`:\\\"\\\";return`<audio controls><source src=\\\"${tt(e)}\\\"${i}></audio>`}(e,i):\\\"\\\"===n||n.startsWith(\\\"image/\\\")?function(t,e){let i=\\\"string\\\"==typeof t.alt?Q(t.alt):\\\"\\\",n=\\\"number\\\"==typeof t.width?` width=\\\"${String(t.width)}\\\"`:\\\"\\\",r=\\\"number\\\"==typeof t.height?` height=\\\"${String(t.height)}\\\"`:\\\"\\\";return`<img src=\\\"${tt(e)}\\\" alt=\\\"${i}\\\"${n}${r} loading=\\\"lazy\\\" decoding=\\\"async\\\">`}(e,i):function(t,e){let i=\\\"string\\\"==typeof t.filename?Q(t.filename):Q(e);return`<a href=\\\"${tt(e)}\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">${i}</a>`}(e,i)});J(\\\"relationship\\\",t=>{let e=\\\"string\\\"==typeof t.relationTo?t.relationTo:\\\"\\\",i=function(t){let e=t.value;if(\\\"object\\\"==typeof e&&null!==e)return e}(t),n=function(t,e){return void 0===t?\\\"\\\"===e?\\\"#\\\":`#${e}`:\\\"string\\\"==typeof t.title&&t.title.length>0?t.title:\\\"string\\\"==typeof t.name&&t.name.length>0?t.name:\\\"string\\\"==typeof t.slug&&t.slug.length>0?t.slug:void 0!==t.id?String(t.id):\\\"\\\"===e?\\\"#\\\":`#${e}`}(i,e),r=Q(n),l=\\\"\\\"===e?\\\"\\\":` data-relation-to=\\\"${Q(e)}\\\"`,s=i?.url;return\\\"string\\\"==typeof s&&w(s)?`<a href=\\\"${tt(s)}\\\"${l}>${r}</a>`:`<span${l}>${r}</span>`});J(\\\"block\\\",(t,e)=>{let i=function(t){let e=t.fields;return\\\"object\\\"!=typeof e||null===e?{}:e}(t),n=\\\"string\\\"==typeof i.blockType?i.blockType:\\\"\\\",r=lt(n);if(\\\"\\\"!==n){let t=rt(n)??rt(r);if(t)return t(i,{renderChildren:e.renderChildren})}let l=[];\\\"\\\"!==r&&l.push(`data-block-type=\\\"${Q(r)}\\\"`);for(let[t,e]of Object.entries(i)){if(\\\"blockType\\\"===t||\\\"id\\\"===t||null==e)continue;let i=\\\"string\\\"==typeof e||\\\"number\\\"==typeof e||\\\"boolean\\\"==typeof e?String(e):JSON.stringify(e);l.push(`data-block-${lt(t)}=\\\"${Q(i)}\\\"`)}return`<div${0===l.length?\\\"\\\":` ${l.join(\\\" \\\")}`}></div>`});Rt={renderChildren:at,resolveAlignment:X,resolveIndent:Y};_t=\\\"data-payload-text\\\";Wt={name:\\\"textarea\\\",render(t,e){let i=t.element,n=st(e)?ot(e):ct(e);\\\"INPUT\\\"!==i.tagName&&\\\"TEXTAREA\\\"!==i.tagName?i.innerHTML=et(n):i.value=n}};Ft={name:\\\"richText\\\",render:$((t,e)=>{if(st(e))t.element.innerHTML=function(t,e={}){if(!st(t))return\\\"\\\";let i=at(t.root.children);return!1===e.sanitize||void 0===G()?i:V(i)}(e);else{if(\\\"string\\\"!=typeof e)return!1;t.element.innerHTML=V(e)}})};Dt={name:\\\"html\\\",render(t,e){if(null==e){t.element.textContent=\\\"\\\";return}let i=\\\"string\\\"==typeof e?e:ct(e);t.element.innerHTML=V(i)}};Ut={name:\\\"url\\\",render(t,e,i){let n=t.element,r=ct(e);if(\\\"A\\\"===n.tagName){let l=n,s=t.hrefField,o=void 0===s||0===s.length?e:k(i.allFields,s,i.locale,void 0!==t.locale);\\\"string\\\"==typeof o&&w(o)&&(l.href=o),l.textContent=r;return}\\\"INPUT\\\"!==n.tagName&&\\\"TEXTAREA\\\"!==n.tagName?n.textContent=r:n.value=r}};zt={name:\\\"image\\\",render:$((t,e,i)=>{let n=t.element,r=ft(e),l=void 0!==t.locale,s=function(t,e,i,n,r,l){if(void 0!==i&&i.length>0){let t=k(n,i,r,l);if(\\\"string\\\"==typeof t&&w(t))return t;let e=ft(t);return void 0!==e?.url&&w(e.url)?e.url:void 0}return void 0!==t?.url&&w(t.url)?t.url:\\\"string\\\"==typeof e&&w(e)?e:void 0}(r,e,t.srcField,i.allFields,i.locale,l);if(void 0===s)return!1;if(\\\"IMG\\\"===n.tagName){let e=n;e.src=s;let o=function(t,e,i,n,r){if(void 0!==e&&e.length>0){let t=k(i,e,n,r);return\\\"string\\\"==typeof t?t:void 0}if(void 0!==t?.alt)return t.alt}(r,t.altField,i.allFields,i.locale,l);void 0!==o&&(e.alt=o);return}n.style.backgroundImage=`url('${function(t){return t.replace(/['\\\"()\\\\\\\\]/g,\\\"\\\\\\\\$&\\\")}(s)}')`})};Vt={name:\\\"upload\\\",render:$((t,e)=>{let i=t.element,n=function(t){if(\\\"object\\\"==typeof t&&null!==t)return t}(e);if(void 0===n)return!1;let r=n.url;if(\\\"string\\\"!=typeof r||!w(r))return!1;if(\\\"IMG\\\"===i.tagName){let t=i;t.src=r,void 0!==n.alt&&(t.alt=n.alt);return}if(\\\"A\\\"===i.tagName){let t=i;t.href=r,t.textContent=n.filename??r;return}let l=void 0!==n.filename?Q(n.filename):Q(r);i.innerHTML=`<a href=\\\"${tt(r)}\\\">${l}</a>`})};Gt={name:\\\"relationship\\\",render(t,e){let i=t.element,n=function(t){return null==t?[\\\"\\\"]:Array.isArray(t)?t.map(pt):[pt(t)]}(e).join(\\\", \\\");if(\\\"A\\\"===i.tagName&&!Array.isArray(e)){let t=i,r=e?.url;\\\"string\\\"==typeof r&&w(r)&&(t.href=r),t.textContent=n;return}i.textContent=n}};Bt={name:\\\"select\\\",render(t,e){let i=t.element,n=gt(e);if(\\\"SELECT\\\"!==i.tagName){if(\\\"INPUT\\\"===i.tagName&&\\\"radio\\\"===i.type){let t=i;t.checked=t.value===n;return}i.textContent=n}else i.value=n}};Ht={name:\\\"checkbox\\\",render(t,e){let i=t.element,n=!!e;\\\"INPUT\\\"!==i.tagName||\\\"checkbox\\\"!==i.type?i.hasAttribute(\\\"aria-checked\\\")?i.setAttribute(\\\"aria-checked\\\",n?\\\"true\\\":\\\"false\\\"):i.textContent=n?\\\"true\\\":\\\"false\\\":i.checked=n}};qt=new Map,Jt=new Map,Xt=64;Yt={name:\\\"date\\\",render(t,e,i){let n=t.element;if(null==e||\\\"\\\"===e){\\\"INPUT\\\"===n.tagName?n.value=\\\"\\\":(\\\"TIME\\\"===n.tagName&&n.removeAttribute(\\\"datetime\\\"),n.textContent=\\\"\\\");return}let r=\\\"string\\\"==typeof e?e:ct(e),l=new Date(r),s=!Number.isNaN(l.getTime());\\\"INPUT\\\"!==n.tagName?(\\\"TIME\\\"!==n.tagName||n.setAttribute(\\\"datetime\\\",s?l.toISOString():r),n.textContent=s?function(t,e){let i=e.locale??N();try{return function(t,e){let i=mt(t,e),n=Jt.get(i);if(void 0!==n)return Jt.delete(i),Jt.set(i,n),n;let r=new Intl.DateTimeFormat(t,e);return Jt.set(i,r),vt(Jt),r}(i,{dateStyle:\\\"medium\\\",timeStyle:\\\"short\\\"}).format(t)}catch{return t.toISOString()}}(l,i):r):n.value=s?function(t,e){return\\\"date\\\"===t?e.toISOString().slice(0,10):\\\"datetime-local\\\"===t?e.toISOString().slice(0,16):e.toISOString()}(n.type,l):r}};Zt={name:\\\"number\\\",render(t,e,i){let n=t.element;if(null==e||\\\"\\\"===e){\\\"INPUT\\\"===n.tagName?n.value=\\\"\\\":n.textContent=\\\"\\\";return}let r=\\\"number\\\"==typeof e?e:Number(ct(e));Number.isNaN(r)?n.textContent=ct(e):\\\"INPUT\\\"!==n.tagName?n.textContent=function(t,e){let i=e.locale??N();try{return function(t,e){let i=mt(t,e),n=qt.get(i);if(void 0!==n)return qt.delete(i),qt.set(i,n),n;let r=new Intl.NumberFormat(t,e);return qt.set(i,r),vt(qt),r}(i).format(t)}catch{return String(t)}}(r,i):n.value=String(r)}};Kt=/\\\\{\\\\{([\\\\s\\\\S]*?)\\\\}\\\\}/g;Qt={name:\\\"array\\\",render:$((t,e)=>{let i=t.element;if(!Array.isArray(e))return!1;let n=t.arrayTemplate;if(void 0!==n&&n.length>0){let t=function(t,e){let i=\\\"\\\";for(let n=0;n<e.length;n+=1)i+=wt(t,e[n],n);return i}(n,e);i.innerHTML=V(t);return}let r=t.arraySeparator??\\\", \\\";i.textContent=e.map(St).join(r)})};te=\\\"data-payload-key\\\",ee=\\\"data-payload-nested-key\\\",ie=\\\"data-payload-nested-template\\\";ne=new Map;re=[Wt,Ft,Dt,Ut,{...Ut,name:\\\"email\\\"},zt,Vt,Gt,Bt,{...Bt,name:\\\"radio\\\"},Ht,Yt,Zt,Qt,{...Qt,name:\\\"blocks\\\"}];!function(){if(typeof window>\\\"u\\\"||!D()&&(typeof window>\\\"u\\\"||null==window.opener))return;let t=window.__livePreview;if(void 0!==t)return t;let[e=[],i=\\\"\\\",n=\\\"/api\\\",r=1,l=!1,s=50,o=!0,a=0,u=!1,h=50,d=\\\"200px\\\",c=!1,f=!1,p=!1]=typeof __LIVE_PREVIEW_CONFIG__>\\\"u\\\"?[]:__LIVE_PREVIEW_CONFIG__,g=new An({additionalOrigins:e,enableReferrerDetection:!c,enableLocalhostMatching:!f});g.isProductionUnconfigured?pe(\\\"[live-preview] LP0101: No trusted origin. Set PAYLOAD_ADMIN_ORIGIN or pass allowedOrigins to generateInlineScript().\\\"):g.isReferrerOnlyTrust&&pe(\\\"[live-preview] LP0102: document.referrer fallback trusts any framing site. Set allowedOrigins and a frame-ancestors CSP in production.\\\");let m=new me,y=function(t=[]){let e={};for(let i of t)e[i.name]=i;for(let[t,i]of ne)e[t]=i;return Object.freeze(e)}([dt(),...re,It()]),v=new Hi({renderers:y,originMatcher:t=>g.matches(t),lockedOrigin:()=>g.lockedOrigin,readyTargets:g.enumerate(),emitter:m,...\\\"\\\"!==i?{dataMerge:{serverURL:i,apiRoute:n,depth:r}}:{},debounceMs:s,heartbeatMs:a,intersectionRootMargin:d,disableVisibilityGate:u,visibilityGateThreshold:h,enableA11y:o,scopeBindingsByOwner:p,onHeartbeatTimeout:()=>{g.unlockOrigin()},...l?{log:(...t)=>{ge(\\\"[live-preview]\\\",...t)}}:{}});m.on(\\\"connect\\\",t=>{g.lockOrigin(t.origin)}),v.start();let b=function(t,e={}){let i=e.windowTarget??globalThis.window,n=e.documentTarget??globalThis.document,r=e.softNavigationEvents??[],l=()=>{t.suspend()},s=e=>{!0===e.persisted&&t.resume()},o=()=>{t.refreshCache()};i?.addEventListener(\\\"pagehide\\\",l),i?.addEventListener(\\\"pageshow\\\",s);for(let t of r)n?.addEventListener(t,o);let a=!1;return()=>{if(!a){a=!0,i?.removeEventListener(\\\"pagehide\\\",l),i?.removeEventListener(\\\"pageshow\\\",s);for(let t of r)n?.removeEventListener(t,o)}}}({suspend:()=>v.suspend(),resume:()=>v.start(),refreshCache:()=>{v.refreshCache()}}),w=Object.freeze({version:Wi,destroy:()=>{b(),v.destroy();let t=window;t.__livePreview===w&&delete t.__livePreview},refresh:()=>{v.refreshCache()},enumerateOrigins:()=>g.enumerate(),inspect:()=>v.inspect()});try{Object.defineProperty(window,\\\"__livePreview\\\",{value:w,writable:!1,configurable:!0})}catch(t){throw b(),v.destroy(),t}}()})();\";\nexport const RUNTIME_CONTENT_HASH = \"82620c90d7307b6d\";\nexport const RUNTIME_INTEGRITY = \"sha384-xnuuxRgWkWDi/7WE4cxwZ9KX/pYzfs8zbXhlYw9E+N3soc8cJ+9MQtBFGbEG6V0C\";\nexport const RUNTIME_BUILD_INFO: RuntimeBuildInfo = { generatedAt: \"2026-08-25T22:49:43.000Z\", size: 67950 };\n","/**\n * Inline script generator.\n *\n * Wraps the build-time-generated runtime IIFE with consumer-provided\n * configuration. Returns a JavaScript string suitable for embedding\n * via `<script>` in any framework.\n *\n * The runtime body is identical to the one used by the high-level\n * client because both originate from `src/core/runtime.ts`. There is\n * no parallel implementation to drift out of sync.\n *\n * @module @inline/generator\n */\n\nimport { RUNTIME_SOURCE, RUNTIME_BUILD_INFO, type RuntimeBuildInfo } from './runtime.generated';\nimport { LOADER_SOURCE } from './loader.generated';\n\nexport interface InlineScriptConfig {\n /** Additional trusted origins to merge with auto-detected ones. */\n readonly allowedOrigins?: readonly string[];\n /**\n * Payload server origin, e.g. `https://cms.example.com`. When set,\n * every incoming update is re-fetched through the Payload REST API\n * (`X-Payload-HTTP-Method-Override: GET`, same strategy as the\n * official client) so relationship and upload fields render\n * populated instead of as bare IDs. Strongly recommended for\n * Payload 3.x. Requires the preview page to be able to reach the\n * API with credentials (same-site cookies or CORS `credentials`).\n */\n readonly serverURL?: string;\n /** REST API route prefix used with `serverURL`. Defaults to `/api`. */\n readonly apiRoute?: string;\n /** Population depth used with `serverURL`. Defaults to `1`. */\n readonly mergeDepth?: number;\n /** Enable verbose console logging. Defaults to `false`. */\n readonly debug?: boolean;\n /** Debounce window for incoming updates in ms. Defaults to `50`. */\n readonly debounceMs?: number;\n /** Enable screen-reader live region. Defaults to `true`. */\n readonly enableA11y?: boolean;\n /**\n * Heartbeat timeout in ms. Defaults to `0` (disabled). The Payload\n * admin only posts messages on form edits — there is no protocol\n * keepalive — so an idle-based timeout would fire spurious\n * disconnects while the editor pauses. Enable only if your admin\n * setup sends periodic messages.\n */\n readonly heartbeatMs?: number;\n /**\n * Bypass the visibility-gate optimisation and apply every update\n * regardless of viewport position. Default `false` — the gate kicks\n * in when the cache exceeds `visibilityGateThreshold` entries.\n */\n readonly disableVisibilityGate?: boolean;\n /**\n * Cache-size threshold above which the visibility gate activates.\n * Default `50`. Off-screen elements above this threshold are queued\n * for replay on intersection instead of being updated immediately.\n */\n readonly visibilityGateThreshold?: number;\n /**\n * `rootMargin` passed to the `IntersectionObserver` watching the\n * cached elements. Default `'200px'`. Increase to pre-render\n * further off-screen content; decrease for tighter visibility.\n */\n readonly intersectionRootMargin?: string;\n /**\n * Opt out of `document.referrer`-based origin auto-detection.\n * Useful when the page is loaded under `Referrer-Policy: no-referrer`\n * and you want predictable behaviour. Default `false`.\n */\n readonly disableReferrerDetection?: boolean;\n /**\n * Opt out of the dev-mode localhost-pattern matcher (any port on\n * `localhost` / `127.0.0.1`). Useful when running locally against\n * a production-like origin list. Default `false`.\n */\n readonly disableLocalhostMatching?: boolean;\n /**\n * Restrict each update to the bindings owned by the document it describes,\n * declared in markup with `data-payload-owner` and resolved from the nearest\n * ancestor. Default `false`, which keeps matching on the field name alone.\n *\n * Enable it when one page previews more than one document. While enabled a\n * binding without an owner is never updated.\n */\n readonly scopeBindingsByOwner?: boolean;\n /**\n * Retained for 1.x source compatibility, but has no effect here:\n * `generateInlineScript()` returns a script body and creates no tag.\n * Pass the nonce separately to `wrapWithScriptTag(body, { nonce })`.\n *\n * @deprecated Use the second argument of `wrapWithScriptTag()`.\n */\n readonly nonce?: string;\n}\n\n/**\n * Build an inline script body. The result is a self-contained IIFE\n * with the build-time runtime, prefixed by a configuration block.\n *\n * The string does NOT include the `<script>` tags — use\n * `wrapWithScriptTag()` when you need them.\n */\nexport function generateInlineScript(config: InlineScriptConfig = {}): string {\n if (RUNTIME_SOURCE.length === 0) {\n throw new Error(\n '[live-preview] runtime.generated.ts is empty. Run `npm run build:runtime` before bundling.',\n );\n }\n // The IIFE declares its own scope. We inject the config via a `var`\n // declaration that the bundled runtime reads back through the\n // `__LIVE_PREVIEW_CONFIG__` constant placeholder. The identifier is retained\n // across 1.0.x because existing deployments use it as a non-secret runtime\n // presence/leak signal in response-level integration tests.\n return [`var __LIVE_PREVIEW_CONFIG__=${buildConfigLiteral(config)};`, RUNTIME_SOURCE].join('\\n');\n}\n\n/**\n * Serialize the runtime configuration into the compact wire literal.\n *\n * Shared by the inline script and the static-delivery bootstrap so the two can\n * never disagree about the format. The runtime destructures this positionally.\n */\nfunction buildConfigLiteral(config: InlineScriptConfig): string {\n // Compact private wire format; keep this order aligned with\n // `RuntimeBuildConfig` in `src/core/runtime.ts`.\n const compactConfig: unknown[] = [\n config.allowedOrigins,\n config.serverURL,\n config.apiRoute,\n config.mergeDepth,\n config.debug,\n config.debounceMs,\n config.enableA11y,\n config.heartbeatMs,\n config.disableVisibilityGate,\n config.visibilityGateThreshold,\n config.intersectionRootMargin,\n config.disableReferrerDetection,\n config.disableLocalhostMatching,\n config.scopeBindingsByOwner,\n ];\n while (compactConfig.length > 0 && compactConfig.at(-1) === undefined) compactConfig.pop();\n // Preserve omitted interior options as sparse JavaScript slots. JSON arrays\n // encode `undefined` as `null`, which would bypass the runtime's destructuring\n // defaults and can turn an omitted serverURL into an invalid configured value.\n // `<` must never appear literally inside an inline <script> body — a\n // consumer-supplied string containing `</script>` would terminate the tag.\n const configLiteral = `[${compactConfig\n .map((value) => (value === undefined ? '' : JSON.stringify(value)))\n .join(',')}]`.replace(/</g, '\\\\u003C');\n return configLiteral;\n}\n\n/** Where the runtime asset lives, and how the browser should verify it. */\nexport interface LoaderScriptTarget {\n /** URL the bootstrap appends. Same-origin or absolute; hashed by the caller. */\n readonly runtimeSrc: string;\n /**\n * Subresource-integrity value for that asset, e.g. `sha384-…`.\n *\n * Empty disables the check and the `crossorigin` attribute that enforcement\n * requires. Only appropriate where the asset is served from the same origin\n * as the page and the deployment already guarantees they ship together.\n */\n readonly integrity?: string;\n}\n\n/**\n * Generate the static-delivery bootstrap instead of the whole runtime.\n *\n * Emits the configuration plus a few hundred bytes that check the preview\n * context and, only then, append the runtime as an external script. A\n * statically built site otherwise bakes the full runtime into every page,\n * charging every ordinary visitor for a feature only an editor uses.\n *\n * The runtime asset stays configuration-free: the config lives in this inline\n * body, so the asset is byte identical across sites and deployments — which is\n * what lets it be cached and hashed, and what makes it structurally incapable\n * of carrying a token.\n */\nexport function generateLoaderScript(\n config: InlineScriptConfig = {},\n target: LoaderScriptTarget,\n): string {\n if (LOADER_SOURCE.length === 0) {\n throw new Error(\n '[live-preview] loader.generated.ts is empty. Run `npm run build:runtime` before bundling.',\n );\n }\n if (target.runtimeSrc === '') {\n throw new Error('[live-preview] generateLoaderScript needs a runtimeSrc.');\n }\n // `<` must never appear literally inside an inline <script> body: a\n // consumer-supplied URL containing `</script>` would terminate the tag.\n const encode = (value: string): string => JSON.stringify(value).replace(/</gu, '\\\\u003C');\n return [\n `var __LIVE_PREVIEW_CONFIG__=${buildConfigLiteral(config)};`,\n `var __LP_RUNTIME_SRC__=${encode(target.runtimeSrc)};`,\n `var __LP_RUNTIME_INTEGRITY__=${encode(target.integrity ?? '')};`,\n LOADER_SOURCE,\n ].join('\\n');\n}\n\n/**\n * Wrap an inline script body in a `<script>` tag. When a nonce is\n * provided it is added as the `nonce` attribute so CSP policies that\n * require `'nonce-...'` accept the script.\n */\nexport function wrapWithScriptTag(body: string, options: { nonce?: string } = {}): string {\n const nonceAttr = options.nonce !== undefined ? ` nonce=\"${escapeNonce(options.nonce)}\"` : '';\n return `<script${nonceAttr}>${body}</script>`;\n}\n\n/**\n * Snapshot of the build-time information for diagnostics.\n */\nexport function runtimeBuildInfo(): RuntimeBuildInfo {\n return RUNTIME_BUILD_INFO;\n}\n\nfunction escapeNonce(nonce: string): string {\n if (!/^[A-Za-z0-9+/=_-]+$/.test(nonce)) {\n throw new RangeError('wrapWithScriptTag: nonce contains invalid characters');\n }\n return nonce;\n}\n","/**\n * Server-side preview-intent detection.\n *\n * The live-preview runtime only ever activates inside the Payload\n * admin's iframe, but the *server* still has to decide whether a\n * request expresses preview intent before doing optional preview\n * work. Adapters use this predicate as a delivery optimisation, and\n * consumers with hand-rolled middleware can import it directly.\n *\n * IMPORTANT: every signal inspected here is controlled or triggerable\n * by the client. A positive result is never proof of identity,\n * authentication, or permission to read drafts. Before forwarding\n * credentials, fetching draft data, bypassing caches, changing CSP,\n * or injecting the runtime, verify the request with an application-\n * owned server session or a short-lived signed authorization. Use the\n * same verified decision for all of those effects.\n *\n * Preview intent is present when any of these hold:\n *\n * 1. A preview query parameter is present (`?preview=true`,\n * `?draft=true`, `?livePreview=true` — configurable).\n * 2. `Sec-Fetch-Dest: iframe` — the document is being loaded as an\n * iframe, which is exactly how the Payload admin embeds it.\n * (Sent by all evergreen browsers; absence never *excludes* a\n * request, presence includes it.)\n * 3. The `Referer` points at one of the given admin origins.\n *\n * @module @adapters/shared/preview-request\n */\n\n/** The individual signals the predicate can consider. */\nexport type PreviewSignal = 'query' | 'fetch-dest' | 'referer';\n\nexport interface PreviewRequestOptions {\n /**\n * Which signals count as preview intent. Default: all three.\n * Restricting this to `['query']` reduces accidental activation, but\n * an explicit `?preview=true` is still client-controlled and must not\n * authorize response changes or privileged data access by itself.\n */\n readonly signals?: readonly PreviewSignal[];\n /**\n * Query parameters (with values `true` or `1`) that signal preview\n * intent. Default: `['preview', 'draft', 'livePreview']`.\n */\n readonly queryParams?: readonly string[];\n /**\n * Treat `Sec-Fetch-Dest: iframe` as a preview-intent signal. Default `true`.\n * Legacy alias for excluding `'fetch-dest'` from `signals`.\n */\n readonly checkFetchDest?: boolean;\n /**\n * Admin origins whose `Referer` signals preview intent, e.g.\n * `['https://cms.example.com']`. Referer matching is not HTTP-request\n * authentication.\n */\n readonly adminOrigins?: readonly string[];\n}\n\nconst DEFAULT_QUERY_PARAMS = ['preview', 'draft', 'livePreview'] as const;\n\n/**\n * The minimal request surface the predicate needs. The standard\n * `Request` satisfies it structurally, and server frameworks without\n * fetch-style requests (e.g. Nitro/H3) can supply a tiny shim.\n */\nexport interface PreviewRequestLike {\n readonly url: string;\n readonly headers: { get(name: string): string | null };\n}\n\n/**\n * Detect whether `request` carries live-preview intent. See the module\n * docblock for the exact signals and the required authorization\n * boundary. This compatibility name does not imply authentication.\n */\nexport function isPreviewRequest(\n request: PreviewRequestLike,\n options: PreviewRequestOptions = {},\n): boolean {\n const signals = new Set<PreviewSignal>(options.signals ?? ['query', 'fetch-dest', 'referer']);\n const queryParams = options.queryParams ?? DEFAULT_QUERY_PARAMS;\n const checkFetchDest = (options.checkFetchDest ?? true) && signals.has('fetch-dest');\n\n if (signals.has('query')) {\n let url: URL | undefined;\n try {\n url = new URL(request.url);\n } catch {\n url = undefined;\n }\n if (url !== undefined) {\n for (const param of queryParams) {\n const value = url.searchParams.get(param);\n if (value === 'true' || value === '1') return true;\n }\n }\n }\n\n if (checkFetchDest && request.headers.get('sec-fetch-dest') === 'iframe') {\n return true;\n }\n\n const adminOrigins = signals.has('referer') ? (options.adminOrigins ?? []) : [];\n if (adminOrigins.length > 0) {\n const referer = request.headers.get('referer');\n if (referer !== null) {\n try {\n const refererOrigin = new URL(referer).origin;\n for (const adminOrigin of adminOrigins) {\n try {\n if (new URL(adminOrigin).origin === refererOrigin) return true;\n } catch {\n // skip malformed configured origin\n }\n }\n } catch {\n // malformed referer — not a preview signal\n }\n }\n }\n\n return false;\n}\n","/**\n * Astro middleware for Payload Live Preview.\n *\n * Responsibilities (per request):\n *\n * 1. Generate a per-response CSP nonce and stash it on\n * `Astro.locals.livePreviewNonce` so consumers can reference it.\n * 2. On requests carrying **preview intent** (see\n * `isPreviewRequest`), rewrite the HTML response to inject the\n * live-preview `<script>` tag.\n * 3. On those requests, merge `frame-ancestors` into the\n * `Content-Security-Policy` header so the Payload admin may embed\n * the page. Full `script-src` nonce management is opt-in via\n * `manageCsp: 'full'`.\n *\n * The intent signals are client-controlled and this middleware does\n * not authenticate them. For protected preview responses, first verify\n * an application-owned server session or short-lived authorization,\n * then invoke this middleware with that same decision also governing\n * draft reads, credentials, and cache policy. `shouldInject` filters\n * script insertion only; it is not an authorization boundary and does\n * not disable CSP handling.\n *\n * Prerendered pages are skipped entirely: Astro runs middleware at\n * build time for those, where per-request nonces and response headers\n * are meaningless.\n *\n * @module @adapters/astro/middleware\n */\n\nimport {\n generateCspNonce,\n buildFrameAncestors,\n buildScriptSrcWithNonce,\n mergeCspHeader,\n} from '@security/csp';\nimport { generateInlineScript, wrapWithScriptTag } from '@inline/generator';\nimport { isPreviewRequest } from '@adapters/shared/preview-request';\nimport type { LivePreviewAstroOptions } from './types';\n\n// Astro type imports are deferred via a local declaration so consumers\n// without Astro installed (e.g., type-checking the library itself) can\n// still build the adapter. At runtime the function signature matches.\ntype MiddlewareNext = () => Promise<Response>;\ninterface MiddlewareContext {\n readonly request: Request;\n readonly locals: Record<string, unknown>;\n /** Present in Astro ≥ 5: `true` while prerendering at build time. */\n readonly isPrerendered?: boolean;\n}\nexport type LivePreviewMiddleware = (\n context: MiddlewareContext,\n next: MiddlewareNext,\n) => Promise<Response>;\n\n/**\n * Key on `Astro.locals` carrying the request-scoped nonce. Consumers\n * can read `Astro.locals.livePreviewNonce` from `.astro` templates to\n * set the `nonce` attribute on their own scripts.\n */\nexport const NONCE_LOCALS_KEY = 'livePreviewNonce';\n\nconst HTML_CONTENT_TYPE = /text\\/html/i;\nconst HEAD_INSERT = /<head(\\s[^>]*)?>/i;\n\n/**\n * Build the Astro-compatible middleware. Register it in\n * `src/middleware.ts`:\n *\n * ```ts\n * import { createLivePreviewMiddleware } from 'payload-live-preview/astro';\n * export const onRequest = createLivePreviewMiddleware({\n * allowedOrigins: [import.meta.env.PUBLIC_PAYLOAD_ADMIN_ORIGIN],\n * });\n * ```\n */\nexport function createLivePreviewMiddleware(\n options: LivePreviewAstroOptions = {},\n): LivePreviewMiddleware {\n const allowedOrigins = options.allowedOrigins ?? [];\n const autoInject = options.autoInject ?? true;\n const injectMode = options.inject ?? 'preview-only';\n const manageCsp = normalizeManageCsp(options.manageCsp);\n const shouldInject = options.shouldInject;\n\n // The script body is configuration-static (the nonce only decorates\n // the surrounding tag) — generate it once, not per request.\n let cachedScriptBody: string | undefined;\n const scriptBody = (): string => {\n cachedScriptBody ??= generateInlineScript({\n ...(options.allowedOrigins !== undefined ? { allowedOrigins: options.allowedOrigins } : {}),\n ...(options.serverURL !== undefined ? { serverURL: options.serverURL } : {}),\n ...(options.apiRoute !== undefined ? { apiRoute: options.apiRoute } : {}),\n ...(options.mergeDepth !== undefined ? { mergeDepth: options.mergeDepth } : {}),\n ...(options.debug !== undefined ? { debug: options.debug } : {}),\n ...(options.debounceMs !== undefined ? { debounceMs: options.debounceMs } : {}),\n ...(options.heartbeatMs !== undefined ? { heartbeatMs: options.heartbeatMs } : {}),\n });\n return cachedScriptBody;\n };\n\n return async (context, next) => {\n const nonce = generateCspNonce();\n context.locals[NONCE_LOCALS_KEY] = nonce;\n\n const response = await next();\n\n // Build-time prerendering: no meaningful request headers, no\n // response headers in the static output, and a baked-forever nonce.\n if (context.isPrerendered === true) return response;\n\n const isPreview =\n injectMode === 'always' ||\n isPreviewRequest(context.request, {\n ...(options.previewQueryParams !== undefined\n ? { queryParams: options.previewQueryParams }\n : {}),\n ...(options.previewSignals !== undefined ? { signals: options.previewSignals } : {}),\n adminOrigins: allowedOrigins,\n });\n if (!isPreview) return response;\n\n let outResponse = response;\n\n const contentType = response.headers.get('content-type') ?? '';\n const apply = autoInject && (shouldInject?.(context.request) ?? true);\n if (apply && HTML_CONTENT_TYPE.test(contentType)) {\n outResponse = await injectScript(response, nonce, scriptBody());\n }\n\n if (manageCsp !== false) {\n outResponse = applyCspHeaders(outResponse, nonce, allowedOrigins, manageCsp, options);\n }\n\n return outResponse;\n };\n}\n\nfunction normalizeManageCsp(\n value: LivePreviewAstroOptions['manageCsp'],\n): false | 'frame-ancestors' | 'full' {\n if (value === false) return false;\n if (value === 'full') return 'full';\n // `true` (legacy) and `undefined` both mean the safe default.\n return 'frame-ancestors';\n}\n\nasync function injectScript(response: Response, nonce: string, body: string): Promise<Response> {\n const html = await response.text();\n const headers = new Headers(response.headers);\n headers.delete('content-length');\n\n // Fragment responses (server islands, page partials) have no <head>;\n // injecting a roughly 60 KB runtime into each of them would corrupt every\n // fragment for zero benefit — the full document already carries it.\n if (!HEAD_INSERT.test(html)) {\n return new Response(html, {\n status: response.status,\n statusText: response.statusText,\n headers,\n });\n }\n\n const scriptTag = wrapWithScriptTag(body, { nonce });\n const out = html.replace(HEAD_INSERT, (match) => `${match}${scriptTag}`);\n return new Response(out, {\n status: response.status,\n statusText: response.statusText,\n headers,\n });\n}\n\nfunction applyCspHeaders(\n response: Response,\n nonce: string,\n allowedOrigins: readonly string[],\n mode: 'frame-ancestors' | 'full',\n options: LivePreviewAstroOptions,\n): Response {\n const frameAncestors = buildFrameAncestors({\n self: true,\n origins: [...allowedOrigins, ...(options.frameAncestorsExtra ?? [])],\n });\n\n const additions: Record<string, string> = { 'frame-ancestors': frameAncestors };\n if (mode === 'full') {\n additions['script-src'] = buildScriptSrcWithNonce(nonce, {\n self: true,\n strictDynamic: options.strictDynamic ?? false,\n ...(options.scriptSrcExtra !== undefined ? { extra: options.scriptSrcExtra } : {}),\n });\n }\n\n const previous = response.headers.get('content-security-policy') ?? '';\n const next = mergeCspHeader(previous, additions);\n\n // Responses passed through from `fetch()` can carry immutable\n // headers — clone into a mutable Response instead of mutating.\n try {\n response.headers.set('content-security-policy', next);\n return response;\n } catch {\n const headers = new Headers(response.headers);\n headers.set('content-security-policy', next);\n return new Response(response.body, {\n status: response.status,\n statusText: response.statusText,\n headers,\n });\n }\n}\n","/**\n * Middleware entrypoint used by the integration's `mode: 'middleware'`.\n *\n * Astro's `addMiddleware()` takes a module specifier, not a function —\n * so options travel through a virtual module that the integration's\n * Vite plugin provides at build time. Consumers never import this\n * module directly; `livePreview({ mode: 'middleware' })` wires it.\n *\n * @module @adapters/astro/middleware-entry\n */\n\nimport { createLivePreviewMiddleware } from './middleware';\nimport type { LivePreviewAstroOptions } from './types';\n\n// Resolved by the Vite plugin the integration registers; carries the\n// JSON-serializable subset of the integration options.\n// @ts-expect-error — virtual module, provided at build time\nimport options from 'virtual:payload-live-preview/options';\n\nexport const onRequest = createLivePreviewMiddleware(options as LivePreviewAstroOptions);\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"file":"middleware-entry.js","names":["CSP_ASCII_WHITESPACE","isCspWhitespace","value","index","code","charCodeAt","trimCspWhitespace","start","end","length","slice","asciiLowercase","replace","character","toLowerCase","buildFrameAncestors","options","self","origins","allowNone","seen","Set","out","push","add","origin","trimmed","trim","has","join","mergeCspPolicy","existing","additions","directives","Map","part","split","whitespaceIndex","search","name","set","rawName","rawAddition","Object","entries","addition","mode","current","get","merged","token","withoutNone","filter","PreviewConfigurationError","Error","BRAND","Symbol","for","isAuthorizedPreviewContext","isFrozen","RUNTIME_SOURCE","FRAGMENT_SOURCE","INLINE_CONFIG_KEYS","assertBuilt","source","artifact","fragmentPrelude","config","fragmentEndpoint","configStatement","defaults","serverURL","mergeDepth","values","map","key","at","pop","JSON","stringify","buildConfigLiteral","V2_ADAPTER_DEFAULTS","freeze","strict","previewSignals","V2_RUNTIME_DEFAULTS","disableReferrerDetection","eventSourcePolicy","skipUnchanged","sanitizerPolicy","V1_ADAPTER_DEFAULTS","V1_RUNTIME_DEFAULTS","DEFAULT_QUERY_PARAMS","isDevelopmentProcess","env","globalThis","process","HEAD_INSERT","HTML_CONTENT_TYPE","META_CHARSET","resolvePolicyOptions","adapter","runtime","runtimeRow","disableLocalhostMatching","assertMergeDepthExplicit","NONE","isPreview","authorization","outcome","inject","cspMode","exposeNonce","createPreviewPolicy","resolved","authorizes","authorizePreview","allowedOrigins","protocol","URL","includes","assertStrictConfiguration","holder","warned","console","warn","warnOnce","manageCsp","autoInject","body","decide","request","hooks","authorize","signals","queryParams","url","param","searchParams","headers","adminOrigins","referer","refererOrigin","adminOrigin","hasPreviewIntent","previewQueryParams","previewIntentFor","result","error","isPreviewConfigurationError","authorized","context","contextFrom","shouldInject","scriptTag","nonce","test","RangeError","escapeNonce","wrapWithScriptTag","generateInlineScript","apiRoute","revealEditedField","debug","debounceMs","heartbeatMs","scopeBindingsByOwner","fragments","endpoint","inlineScriptConfig","csp","frameAncestorsExtra","buildScriptSrcWithNonce","extra","strictDynamic","parts","e","scriptSrcExtra","policies","policy","mergeCspHeader","buildPreviewCsp","generateCspNonce","bytes","Number","isInteger","String","crypto","fromGlobal","getRandomValues","resolveCrypto","buffer","Uint8Array","binary","byte","fromCharCode","btoa","Buffer","from","toString","replaceAll","base64UrlEncode","NONCE_LOCALS_KEY","onRequest","async","next","isPrerendered","locals","decision","bindDecisionHooks","exposeDecision","response","apply","Headers","Response","status","statusText","withHeaders","cacheControl","vary","listed","markUncacheable","withCspHeader","injected","html","head","exec","headEnd","headClose","indexOf","meta","injectIntoHead","clone","text","delete","injectIntoResponse","applyDecision","createLivePreviewMiddleware"],"sources":["../../../src/security/csp.ts","../../../src/security/preview-verdict.ts","../../../src/types/authorized-preview.ts","../../../src/inline/runtime.generated.ts","../../../src/inline/fragment.generated.ts","../../../src/types/inline-config.ts","../../../src/inline/generator.ts","../../../src/core/defaults-profile.ts","../../../src/adapters/shared/preview-request.ts","../../../src/adapters/shared/dev-warning.ts","../../../src/adapters/shared/policy.ts","../../../src/adapters/shared/locals.ts","../../../src/adapters/astro/middleware-entry.ts","../../../src/adapters/astro/middleware.ts","../../../src/adapters/shared/response.ts"],"sourcesContent":["/**\n * Content-Security-Policy helpers: nonce generation, directive builders and\n * the header merge every adapter uses. Isomorphic; needs only Web Crypto.\n */\n\nconst DEFAULT_NONCE_BYTES = 16;\n\n/** CSP3's exact whitespace set: HTAB, LF, FF, CR, and SPACE. */\nconst CSP_ASCII_WHITESPACE = /[\\t\\n\\f\\r ]+/;\n\n/** Reads one code unit; an index past the end yields NaN, which matches nothing. */\nfunction isCspWhitespace(value: string, index: number): boolean {\n const code = value.charCodeAt(index);\n return code === 9 || code === 10 || code === 12 || code === 13 || code === 32;\n}\n\n/**\n * Trim CSP whitespace by scanning from both ends.\n *\n * The obvious `/^\\s+|\\s+$/` is superlinear by construction: for a long run the\n * trailing alternative is retried at every position. V8 happens to optimise the\n * shape away, but this header can come from a consumer's own response and this\n * module runs in every engine, so the guarantee has to come from the algorithm\n * rather than from one engine's optimiser.\n */\nfunction trimCspWhitespace(value: string): string {\n let start = 0;\n let end = value.length;\n while (start < end && isCspWhitespace(value, start)) start += 1;\n while (end > start && isCspWhitespace(value, end - 1)) end -= 1;\n return start === 0 && end === value.length ? value : value.slice(start, end);\n}\n\n/** CSP names are ASCII; Unicode case folding must not create directives. */\nfunction asciiLowercase(value: string): string {\n return value.replace(/[A-Z]/g, (character) => character.toLowerCase());\n}\n\n/** The one Web Crypto method this module calls; accepts Node's `webcrypto` without a cast. */\ninterface WebCryptoLike {\n getRandomValues: <T extends ArrayBufferView | null>(array: T) => T;\n}\n\nlet cryptoOverride: WebCryptoLike | undefined;\n\n/** Supply a Web Crypto implementation for runtimes without `globalThis.crypto`; `null` clears it. */\nexport function setCspCrypto(crypto: WebCryptoLike | null): void {\n cryptoOverride = crypto ?? undefined;\n}\n\n/** A base64url nonce of `bytes` random bytes (default 16); throws without Web Crypto, since a predictable nonce silently defeats the CSP. */\nexport function generateCspNonce(bytes: number = DEFAULT_NONCE_BYTES): string {\n if (!Number.isInteger(bytes) || bytes < 8) {\n throw new RangeError(`generateCspNonce: bytes must be an integer >= 8, got ${String(bytes)}`);\n }\n const crypto = resolveCrypto();\n if (!crypto) {\n throw new Error(\n 'generateCspNonce: Web Crypto is unavailable. On Node 18 call setCspCrypto(webcrypto) ' +\n \"once at startup, or run with --experimental-global-webcrypto. We won't fabricate \" +\n 'a predictable nonce — that would silently defeat the entire CSP.',\n );\n }\n const buffer = new Uint8Array(bytes);\n crypto.getRandomValues(buffer);\n return base64UrlEncode(buffer);\n}\n\nfunction resolveCrypto(): WebCryptoLike | undefined {\n if (cryptoOverride?.getRandomValues) return cryptoOverride;\n const fromGlobal = (globalThis as { crypto?: WebCryptoLike }).crypto;\n if (fromGlobal?.getRandomValues) return fromGlobal;\n return undefined;\n}\n\nfunction base64UrlEncode(bytes: Uint8Array): string {\n let binary = '';\n for (const byte of bytes) binary += String.fromCharCode(byte);\n const base64 = typeof btoa === 'function' ? btoa(binary) : Buffer.from(bytes).toString('base64');\n return base64.replaceAll('+', '-').replaceAll('/', '_').replaceAll('=', '');\n}\n\n/** A `frame-ancestors` source: `'self'`, `'none'`, or an origin. */\nexport type FrameAncestorSource = string;\n\nexport interface FrameAncestorsOptions {\n readonly self?: boolean;\n readonly origins?: readonly string[];\n readonly allowNone?: boolean;\n}\n\n/** The `frame-ancestors` value: `'self'` and the origins, deduplicated; `'none'` when empty. */\nexport function buildFrameAncestors(options: FrameAncestorsOptions = {}): string {\n const { self = true, origins = [], allowNone = false } = options;\n const seen = new Set<string>();\n const out: FrameAncestorSource[] = [];\n if (allowNone && !self && origins.length === 0) return \"'none'\";\n if (self) {\n out.push(\"'self'\");\n seen.add(\"'self'\");\n }\n for (const origin of origins) {\n const trimmed = origin.trim();\n if (trimmed.length === 0 || seen.has(trimmed)) continue;\n seen.add(trimmed);\n out.push(trimmed);\n }\n return out.length > 0 ? out.join(' ') : \"'none'\";\n}\n\n/**\n * A `script-src` value permitting one nonce plus optional extra sources.\n * `'strict-dynamic'` is opt-in: it makes CSP 3 browsers ignore `'self'` and\n * host sources, so every script on the page must then carry the nonce.\n */\nexport function buildScriptSrcWithNonce(\n nonce: string,\n options: {\n readonly self?: boolean;\n readonly extra?: readonly string[];\n readonly strictDynamic?: boolean;\n } = {},\n): string {\n if (nonce.length === 0) throw new RangeError('buildScriptSrcWithNonce: nonce is empty');\n const { self = true, extra = [], strictDynamic = false } = options;\n const parts: string[] = [];\n if (self) parts.push(\"'self'\");\n parts.push(`'nonce-${nonce}'`);\n if (strictDynamic) parts.push(\"'strict-dynamic'\");\n for (const e of extra) {\n const trimmed = e.trim();\n if (trimmed.length > 0) parts.push(trimmed);\n }\n return parts.join(' ');\n}\n\n/** `union` (default) adds sources to an existing directive; `replace` overwrites it. */\nexport interface CspDirectiveMerge {\n readonly value: string;\n readonly mode?: 'union' | 'replace';\n}\n\n/**\n * Merge directives into an existing `Content-Security-Policy` header value.\n * Commas separate policies (that is how `Headers.get()` joins repeated\n * headers); each is merged, because a browser enforces every policy and\n * widening only the last would leave the others blocking.\n */\nexport function mergeCspHeader(\n existing: string,\n additions: Readonly<Record<string, string | CspDirectiveMerge>>,\n): string {\n const policies = existing.split(',').filter((policy) => policy.trim().length > 0);\n if (policies.length === 0) return mergeCspPolicy('', additions);\n return policies.map((policy) => mergeCspPolicy(policy, additions)).join(', ');\n}\n\nfunction mergeCspPolicy(\n existing: string,\n additions: Readonly<Record<string, string | CspDirectiveMerge>>,\n): string {\n const directives = new Map<string, string>();\n for (const part of existing.split(';')) {\n const trimmed = trimCspWhitespace(part);\n if (trimmed.length === 0) continue;\n const whitespaceIndex = trimmed.search(CSP_ASCII_WHITESPACE);\n const name = asciiLowercase(whitespaceIndex < 0 ? trimmed : trimmed.slice(0, whitespaceIndex));\n // CSP3 §2.2.1: a user agent ignores later duplicates, so a looser\n // duplicate must not become the policy that is serialized.\n if (directives.has(name)) continue;\n const value = whitespaceIndex < 0 ? '' : trimCspWhitespace(trimmed.slice(whitespaceIndex));\n directives.set(name, value);\n }\n\n for (const [rawName, rawAddition] of Object.entries(additions)) {\n const name = asciiLowercase(rawName);\n const addition: CspDirectiveMerge =\n typeof rawAddition === 'string' ? { value: rawAddition } : rawAddition;\n const mode = addition.mode ?? 'union';\n const current = directives.get(name);\n if (mode === 'replace' || current === undefined || current.length === 0) {\n directives.set(name, addition.value);\n continue;\n }\n const seen = new Set<string>();\n const merged: string[] = [];\n for (const token of [\n ...current.split(CSP_ASCII_WHITESPACE),\n ...addition.value.split(CSP_ASCII_WHITESPACE),\n ]) {\n if (token.length === 0 || seen.has(token)) continue;\n seen.add(token);\n merged.push(token);\n }\n // `'none'` cannot coexist with other sources.\n const withoutNone = merged.filter((token) => token !== \"'none'\");\n directives.set(name, (withoutNone.length > 0 ? withoutNone : merged).join(' '));\n }\n\n const out: string[] = [];\n for (const [name, value] of directives) {\n out.push(value.length === 0 ? name : `${name} ${value}`);\n }\n return out.join('; ');\n}\n","/**\n * The verdict shape every authorization strategy produces, and the one error\n * class that is allowed to escape it. Kept apart from the strategies so the\n * adapters can import the error without pulling in HMAC or session code.\n */\n\nimport type { AuthorizedPreviewContext } from '@/types/authorized-preview';\n\n/** Why a request was refused. `'authorized'` is the one non-refusal. */\nexport type PreviewAuthorizationOutcome =\n | 'authorized'\n | 'missing-credential'\n | 'invalid'\n | 'expired'\n | 'wrong-audience'\n | 'wrong-path'\n | 'wrong-locale'\n | 'wrong-purpose'\n | 'replayed'\n | 'unavailable';\n\n/** The result of `authorizePreviewRequest()`: a verdict, never an exception. */\nexport type PreviewAuthorization =\n | {\n readonly authorized: true;\n readonly outcome: 'authorized';\n readonly context: AuthorizedPreviewContext;\n }\n | {\n readonly authorized: false;\n readonly outcome: Exclude<PreviewAuthorizationOutcome, 'authorized'>;\n readonly context: null;\n };\n\n/** The request shape every strategy reads: a URL and a header getter. */\nexport interface PreviewAuthorizationRequest {\n readonly url: string;\n readonly headers: { get(name: string): string | null };\n}\n\n/**\n * A strategy was misconfigured — raised on first use and re-thrown by the\n * adapters rather than reported as `'unavailable'`, so it fails loudly.\n */\nexport class PreviewConfigurationError extends Error {\n override readonly name = 'PreviewConfigurationError';\n}\n\n/** Recognises the error across bundles, where `instanceof` sees a different class copy. */\nexport function isPreviewConfigurationError(error: unknown): error is PreviewConfigurationError {\n return (\n error instanceof PreviewConfigurationError ||\n (error instanceof Error && error.name === 'PreviewConfigurationError')\n );\n}\n\nexport function refused(\n outcome: Exclude<PreviewAuthorizationOutcome, 'authorized'>,\n): PreviewAuthorization {\n return { authorized: false, outcome, context: null };\n}\n","/**\n * The authorized preview context's shape and brand, in the leaf `types` domain\n * so producer and consumers recognise the same context. See ADR 0006.\n */\n\n/**\n * The brand key, in the type and on the object.\n *\n * This was a `unique symbol` until 2026-08-30. A `unique symbol` is nominal per\n * *declaration*, and the published entries each carry their own declaration\n * file — so `AuthorizedPreviewContext` from the root barrel was a different\n * type from the one in `./server` or in an adapter, and the documented flow\n * (authorize once, hand the context to the adapter hook and to the draft read)\n * did not type-check in any combination a consumer can write.\n *\n * That is the same trap the runtime brand below already avoids by using\n * `Symbol.for` rather than `Symbol()`; the lesson simply had not reached the\n * type. A shared string literal is identical in every bundle for the same\n * reason a registry symbol is.\n *\n * It is not what makes a context trustworthy. `isAuthorizedPreviewContext`\n * decides that, on the registry symbol and on `Object.isFrozen`, and every\n * consumption point calls it — the adapter policy, the draft read and the\n * binding emitter. Writing this key by hand buys nothing.\n */\nexport const AUTHORIZED_PREVIEW_BRAND_KEY = 'payload-live-preview.authorized-preview-context';\n\nexport type PreviewAuthorizationStrategyName = 'payload-session' | 'signed-token' | 'verifier';\n\n/** What a context is bound to; every field is optional because every strategy binds differently. */\nexport interface AuthorizedPreviewScope {\n /** The site origin the credential was issued for. */\n readonly audience?: string;\n /** The request pathname the credential is valid for. */\n readonly path?: string;\n readonly locale?: string;\n}\n\n/** The verdict of a successful `authorizePreviewRequest()`: frozen, branded, produced only there. Carry it, do not rebuild it. */\nexport interface AuthorizedPreviewContext {\n readonly [AUTHORIZED_PREVIEW_BRAND_KEY]: true;\n readonly strategy: PreviewAuthorizationStrategyName;\n /** The user id, token subject, or whatever the verifier named. */\n readonly subject: string | undefined;\n /** Unix milliseconds. */\n readonly authorizedAt: number;\n /** Unix milliseconds, or `undefined` when the strategy does not know. */\n readonly expiresAt: number | undefined;\n readonly scope: AuthorizedPreviewScope;\n /** The minimal request material a draft read forwards to Payload — one verified cookie, never the whole `Cookie` header. */\n readonly payloadHeaders: Readonly<Record<string, string>>;\n}\n\n// A registry symbol: entries are separate bundles, and a per-bundle `Symbol()`\n// would refuse the other's contexts in the package while unit tests passed.\nconst BRAND = Symbol.for(AUTHORIZED_PREVIEW_BRAND_KEY);\n\n/** Whether `value` was produced by `authorizePreviewRequest()`; a copy or JSON round trip is not. */\nexport function isAuthorizedPreviewContext(value: unknown): value is AuthorizedPreviewContext {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as Record<PropertyKey, unknown>)[BRAND] === true &&\n Object.isFrozen(value)\n );\n}\n\n/** Internal: the one place a context is made. */\nexport function createAuthorizedPreviewContext(\n fields: Omit<AuthorizedPreviewContext, typeof AUTHORIZED_PREVIEW_BRAND_KEY>,\n): AuthorizedPreviewContext {\n const context = Object.freeze({\n ...fields,\n scope: Object.freeze({ ...fields.scope }),\n payloadHeaders: Object.freeze({ ...fields.payloadHeaders }),\n [BRAND]: true,\n [AUTHORIZED_PREVIEW_BRAND_KEY]: true,\n });\n // No cast: the frozen object carries the brand key the interface declares.\n return context;\n}\n","// Auto-generated by scripts/build-runtime.ts — do not edit.\nexport interface RuntimeBuildInfo { readonly generatedAt: string; readonly size: number }\nexport const RUNTIME_SOURCE: string = \"(()=>{function e(e){return(\\\"object\\\"==typeof e&&null!==e||\\\"function\\\"==typeof e)&&\\\"function\\\"==typeof e.then&&(Promise.resolve(e).catch(()=>{}),!0)}function t(t){return(...n)=>{try{e(t(...n))}catch{}}}function n(){}function i(){return function(){if(typeof document>\\\"u\\\")return;let e=document.documentElement.getAttribute(\\\"lang\\\");return null===e||0===e.length?void 0:e}()??function(){if(typeof navigator>\\\"u\\\")return;let e=navigator.language;return\\\"string\\\"==typeof e&&e.length>0?e:void 0}()??\\\"en\\\"}function r(e){null!==e.timer&&(clearTimeout(e.timer),e.timer=null),e.messageNode?.remove(),e.messageNode=null}function l(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=o(n);e&&t.push(e)}return t}function o(e){if(\\\"object\\\"!=typeof e||null===e)return;let t=e,n=t.name,i=t.type;if(\\\"string\\\"!=typeof n||0===n.length||\\\"string\\\"!=typeof i||0===i.length)return;let r=l(t.fields),o=function(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(\\\"object\\\"!=typeof n||null===n)continue;let e=n,i=e.slug;if(\\\"string\\\"!=typeof i||0===i.length)continue;let r=l(e.fields);t.push({...e,slug:i,fields:r})}return t}(t.blocks),a={...t,name:n,type:i};return r.length>0?a.fields=r:delete a.fields,o.length>0?a.blocks=o:delete a.blocks,a}function a(e,t=\\\"\\\"){let n=new Map;return s(e,t,n),n}function s(e,t,n){for(let i of e){if(Dt.has(i.type)){i.fields&&s(i.fields,t,n);continue}let e=\\\"\\\"===t?i.name:`${t}.${i.name}`;if(n.set(e,i),\\\"group\\\"===i.type)i.fields&&s(i.fields,e,n);else if(\\\"array\\\"===i.type&&i.fields)s(i.fields,`${e}.*`,n);else if(\\\"blocks\\\"===i.type&&i.blocks)for(let t of i.blocks)s(t.fields,`${e}.*.${t.slug}`,n)}}function u(e){if(\\\"object\\\"!=typeof e||null===e)return;let t=e.id;return\\\"string\\\"==typeof t||\\\"number\\\"==typeof t?t:void 0}function d(e){if(\\\"object\\\"!=typeof e||null===e)return;let t=e.blockType;return\\\"string\\\"==typeof t?t:void 0}function c(e,t){return t.every(e=>void 0!==u(e))?function(e,t){let n=[],i=new Map;for(let t=0;t<e.length;t+=1){let n=u(e[t]);void 0!==n&&i.set(n,t)}let r=new Set;for(let l=0;l<t.length;l+=1){let o=t[l],a=u(o);if(void 0===a){n.push({kind:\\\"insert\\\",index:l,value:o});continue}let s=i.get(a);if(void 0===s){n.push({kind:\\\"insert\\\",index:l,value:o});continue}r.add(s);let c=e[s];d(c)===d(o)?(s!==l&&n.push({kind:\\\"move\\\",from:s,to:l,value:o}),h(c,o)||n.push({kind:\\\"update\\\",index:l,value:o})):n.push({kind:\\\"replace\\\",index:l,oldValue:c,value:o})}for(let t=0;t<e.length;t+=1)r.has(t)||n.push({kind:\\\"remove\\\",index:t,value:e[t]});return n}(e,t):function(e,t){let n=[],i=Math.min(e.length,t.length);for(let r=0;r<i;r+=1)h(e[r],t[r])||n.push({kind:\\\"update\\\",index:r,value:t[r]});if(t.length>e.length)for(let i=e.length;i<t.length;i+=1)n.push({kind:\\\"insert\\\",index:i,value:t[i]});if(e.length>t.length)for(let i=t.length;i<e.length;i+=1)n.push({kind:\\\"remove\\\",index:i,value:e[i]});return n}(e,t)}function h(e,t){if(Object.is(e,t))return!0;if(\\\"object\\\"!=typeof e||\\\"object\\\"!=typeof t||null===e||null===t)return!1;let n=e,i=t,r=Object.keys(n),l=Object.keys(i);if(r.length!==l.length)return!1;for(let e of r)if(!Object.is(n[e],i[e]))return!1;return!0}function f(e){if(\\\"string\\\"!=typeof e||0===e.length)return!1;let t=e.trim().replace(Gt,\\\"\\\");if(0===t.length||_t.test(t))return!1;if(t.startsWith(\\\"#\\\")||t.startsWith(\\\"?\\\")||zt.test(t)||t.startsWith(\\\"/\\\"))return!0;try{let e=new URL(t);return Bt.has(e.protocol)}catch{return Ht.test(t)}}function p(e){if(!f(e))return!1;let t=e.trim().replace(Gt,\\\"\\\");return/^https?:\\\\/\\\\//i.test(t)||zt.test(t)}function g(e){return Kt.add(e),e}function m(e){switch(typeof e){case\\\"string\\\":return e.length>65536?void 0:`s:${e}`;case\\\"number\\\":return`n:${Object.is(e,-0)?\\\"-0\\\":String(e)}`;case\\\"boolean\\\":return\\\"b:\\\"+(e?\\\"1\\\":\\\"0\\\");case\\\"bigint\\\":return`i:${String(e)}`;case\\\"undefined\\\":return\\\"u\\\";case\\\"object\\\":{if(null===e)return\\\"z\\\";let t;try{t=JSON.stringify(e)}catch{return}return t.length>65536?void 0:`o:${t}`}case\\\"symbol\\\":case\\\"function\\\":return}}function v(e,t=[]){let n=\\\"number\\\"==typeof e&&Number.isFinite(e)&&e>=1?Math.floor(e):void 0,i=Math.min(4,n??1),r=new Set(t),l=new Set;for(let e of Zt)(i>=Xt[e].since||r.has(e))&&l.add(e);return{ours:4,...void 0!==n?{theirs:n}:{theirs:void 0},negotiated:i,capabilities:l,observed:r}}function y(e){try{return!0===e.matchMedia?.(\\\"(prefers-reduced-motion: reduce)\\\").matches}catch{return!1}}function b(e,t){return e.generation===t.generation&&e.revision===t.revision}function w(...e){let t=new Map;for(let n of e)for(let[e,i]of Object.entries(n)){let n=t.get(e);void 0===n&&(n=new Set,t.set(e,n));for(let e of i)n.add(e)}let n={};for(let[e,i]of t)n[e]=[...i];return n}function S(e,t){let n={};for(let i of t)i!==e&&(n[i]=[e]);return n}function k(e){return\\\"astro-island\\\"===e.tagName.toLowerCase()||e.hasAttribute(ln)}function T(e){return\\\"patch\\\"===e.getAttribute(ln)}function A(e){return e.closest(`[${an}]`)}function C(e){let t=e.getAttribute(sn);return null!==t&&t.length>0?\\\"patch\\\"===t||\\\"fragment\\\"===t||\\\"route\\\"===t?t:void 0:null!==A(e)?\\\"fragment\\\":null!==e.closest(\\\"head\\\")?\\\"route\\\":\\\"patch\\\"}function $(e){return Mn.has(e)||Nn.test(e)}function F(e){let t=e.getAttribute(dn);if(null!==t&&$(t))return t;if(e.hasAttribute(yn))return\\\"richText\\\";if(e.hasAttribute(bn))return\\\"html\\\";if(e.hasAttribute(Sn))return\\\"structural-array\\\";if(e.hasAttribute(wn))return\\\"array\\\";if(\\\"IMG\\\"===e.tagName)return\\\"image\\\";if(\\\"A\\\"===e.tagName)return\\\"url\\\";if(\\\"TIME\\\"===e.tagName)return\\\"date\\\";if(\\\"INPUT\\\"===e.tagName){let t=e.type;if(\\\"checkbox\\\"===t)return\\\"checkbox\\\";if(\\\"number\\\"===t)return\\\"number\\\";if(\\\"date\\\"===t||\\\"datetime-local\\\"===t)return\\\"date\\\"}return\\\"text\\\"}function R(){return!0}function N(e){for(let t of e){let e=t.codePointAt(0);if(void 0!==e&&(e<=31||127===e))return!0}return!1}function M(e){if(void 0===e||0===e.length||e.length>128||\\\".\\\"===e||\\\"..\\\"===e||e.includes(\\\"/\\\")||e.includes(\\\"\\\\\\\\\\\")||e.includes(\\\"?\\\")||e.includes(\\\"#\\\")||N(e))return!1;try{return encodeURIComponent(e),!0}catch{return!1}}function x(e){return e.aborted}function E(e){return e.has(\\\"schema-json\\\")?Ln:e.has(\\\"document-events\\\")||e.has(\\\"relationship-events\\\")?On:Un}function I(e,t){return void 0===e||t(e)}function L(e,t){return null==e||t(e)}function O(e){if(\\\"object\\\"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}function U(e){if(e.nodeType!==Wn)return!1;let t=e;return t.hasAttribute(un)||null!==t.querySelector(`[${un}]`)}function P(e){return`global:${e}`}function j(e,t){return void 0===t||\\\"\\\"===t?`collection:${e}`:`collection:${e}:${t}`}function W(e){return\\\"string\\\"==typeof e&&e.length>0}function D(e,t){return null!==t&&void 0!==e&&t.includes(e)}function V(e){let t=e.id;return\\\"string\\\"==typeof t&&t.length>0?t:\\\"number\\\"==typeof t&&Number.isFinite(t)?String(t):void 0}function B(e,t,n,i=!1){if(i&&void 0!==n){let i=_(e,`${t}_${n}`);if(void 0!==i)return i}let r=_(e,t);if(void 0!==r)return r;if(t.includes(\\\".\\\")){let n=e,i=!0;for(let e of t.split(\\\".\\\")){if(_n.has(e)||null===n||\\\"object\\\"!=typeof n){i=!1;break}if(n=_(n,e),void 0===n){i=!1;break}}if(i)return n}return void 0===n?void 0:_(e,`${t}_${n}`)}function _(e,t){if(!_n.has(t)&&Object.prototype.hasOwnProperty.call(e,t))return e[t]}function H(e,t,n){let i=e.get(t);return void 0!==i&&(!1===n||i.some(e=>D(e.owner,n)))}function z(e,t){let n=new Set;for(let[i,r]of e.entries())for(let e of r)!1!==t&&!D(e.owner,t)||void 0!==e.locale&&n.add(`${i}_${e.locale}`);return n}function G(e){let t=typeof e;return\\\"string\\\"===t||\\\"number\\\"===t||\\\"boolean\\\"===t||\\\"bigint\\\"===t}function q(e,t){if(void 0===t||0===t.length)return e;let n=`_${t}`;return e.endsWith(n)?e.slice(0,-n.length):e}function J(e){let t=function(){if(void 0!==vt)return vt;let e=function(){let e=globalThis.trustedTypes;return\\\"object\\\"!=typeof e||null===e?void 0:\\\"function\\\"==typeof e.createPolicy?e:void 0}();if(void 0===e)return vt=null,null;try{vt=e.createPolicy(zn,{createHTML:e=>e})}catch{vt=null}return vt}();return null===t?e:t.createHTML(e)}function K(e,t){for(let n of t.keyAttributes){let t=e.getAttribute(n);if(null!==t&&t.length>0)return`${n}=${t}`}}function Q(e){if(e.tagName.toLowerCase().includes(\\\"-\\\")||e.hasAttribute(ln)||e.hasAttribute(Gn))return!0;let t=e.getAttribute(\\\"contenteditable\\\");return null!==t&&\\\"false\\\"!==t}function X(e,t,n){if(!function(e,t){return e.tagName===t.tagName&&e.namespaceURI===t.namespaceURI&&!Q(e)&&!Q(t)}(e,t))return t;let i=function(e){let t=e.ownerDocument.activeElement;return t instanceof HTMLElement&&e.contains(t)?{element:t,selection:t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?[t.selectionStart,t.selectionEnd]:null}:null}(e);return function(e,t){for(let n of Array.from(e.attributes))t.hasAttribute(n.name)||qn.has(n.name.toLowerCase())||e.removeAttribute(n.name);for(let n of Array.from(t.attributes))e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value)}(e,t),!0!==n.retainChildrenOf?.(e,t)&&function(e,t,n){let i=function(e,t){let n,i=new Map;for(let r of Array.from(e.children)){let e=K(r,t);if(void 0!==e){if(i.has(e)){n??(n=e.slice(e.indexOf(\\\"=\\\")+1));continue}i.set(e,r)}}return void 0!==n&&t.onDuplicateKey?.(e,n),i}(e,n),r=new Set(i.values()),l=Array.from(e.childNodes).filter(e=>!r.has(e)),o=new Set,a=new Set,s=Array.from(t.childNodes),u=e.firstChild,d=0;for(let t=0;t<s.length;t+=1){let r=s[t],c=null,h=r instanceof Element?K(r,n):void 0;if(void 0!==h&&a.has(h)&&(h=void 0),void 0!==h){a.add(h);let e=i.get(h);if(void 0!==e&&!o.has(e)&&(c=Z(e,r,n)===e?e:null,null===c)){e.replaceWith(r),o.add(r),u=r.nextSibling;continue}}else{for(;d<l.length;){let i=l[d];if(d+=1,!o.has(i)){if(ee(i,r)){c=Z(i,r,n)===i?i:null,null===c&&(e.replaceChild(r,i),o.add(r),u=r.nextSibling);break}if(i instanceof Element){let n=s[t+1];if(!(r instanceof Element)||void 0!==n&&ee(i,n)){d-=1;break}e.replaceChild(r,i),o.add(r),u=r.nextSibling;break}if(!(r instanceof Element)){e.replaceChild(r,i),o.add(r),u=r.nextSibling;break}}}if(null===c&&o.has(r))continue}let f=c??r;for(o.add(f);null!==u&&u!==f&&!o.has(u)&&Y(u);)u=u.nextSibling;f!==u&&e.insertBefore(f,u),u=f.nextSibling}for(let t of Array.from(e.childNodes))o.has(t)||t.remove()}(e,t,n),function(e){if(null===e)return;let{element:t,selection:n}=e;if(t.ownerDocument.activeElement!==t&&t.isConnected)try{t.focus({preventScroll:!0});let[e,i]=n??[null,null];null!==e&&null!==i&&t.setSelectionRange(e,i)}catch{}}(i),e}function Z(e,t,n){return e instanceof Element&&t instanceof Element?Q(e)&&Q(t)?e:X(e,t,n):(e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e)}function Y(e){return e.nodeType===Node.TEXT_NODE&&0===(e.nodeValue??\\\"\\\").trim().length}function ee(e,t){return e.nodeType===t.nodeType&&(!(e instanceof Element&&t instanceof Element)||e.tagName===t.tagName&&e.namespaceURI===t.namespaceURI)}function te(e,t){let n=ne();if(!n)throw new Error(\\\"sanitizeHtml needs a DOM\\\");if(\\\"\\\"===e)return\\\"\\\";let i=function(e){if(!e){let e=new Map;for(let[t,n]of Object.entries(ti))e.set(t,n);return{allowedTags:Jn,attrByTag:e,allowFormControls:!1,templateMode:!1,mode:oi,allowedData:new Set}}let t=new Set(Jn);for(let n of e.additionalAllowedTags??[])t.add(n);if(!0===e.allowFormControls)for(let e of Kn)t.add(e);let n=new Map;for(let[e,t]of Object.entries(ti))n.set(e,t);for(let[t,i]of Object.entries(e.additionalAllowedAttributes??{})){let e=n.get(t),r=new Set(e??[]);for(let e of i)r.add(e);n.set(t,r)}return{allowedTags:t,attrByTag:n,allowFormControls:!0===e.allowFormControls,templateMode:!0===e.templateMode,mode:e.policy??oi,allowedData:new Set((e.allowedDataAttributes??[]).map(e=>e.toLowerCase()))}}(t),r=n.createElement(\\\"template\\\");return r.innerHTML=J(e),ie(r.content,i),r.innerHTML}function ne(){if(!(typeof document>\\\"u\\\"))return document}function ie(e,t){for(let n of Array.from(e.childNodes))n.nodeType===ii?re(n,t):n.nodeType===ri&&n.remove()}function re(e,t){let n=e.tagName.toLowerCase();if(!Qn.has(n)||t.allowFormControls&&Kn.has(n)){if(!t.allowedTags.has(n)){ie(e,t);let n=e.parentNode;if(n){for(;e.firstChild;)n.insertBefore(e.firstChild,e);e.remove()}return}(function(e,t,n){let i=n.attrByTag.get(t);for(let t of Array.from(e.attributes)){let r=t.name.toLowerCase();if(r.startsWith(\\\"on\\\")||\\\"style\\\"===r)e.removeAttribute(t.name);else{if(\\\"strict\\\"===n.mode){if(n.templateMode&&li.has(r))continue;if(\\\"id\\\"===r||\\\"name\\\"===r||r.startsWith(ei)){e.removeAttribute(t.name);continue}if(r.startsWith(Yn)){n.allowedData.has(r)||e.removeAttribute(t.name);continue}if(Xn.has(r)||r.startsWith(Zn))continue}else if(Xn.has(r)||r.startsWith(Zn)||r.startsWith(Yn))continue;i?.has(r)?(ni.has(r)&&!f(t.value)||\\\"srcset\\\"===r&&!le(t.value))&&e.removeAttribute(t.name):e.removeAttribute(t.name)}}})(e,n,t),\\\"a\\\"===n&&function(e){let t=e.getAttribute(\\\"href\\\");null===t||!p(t)||(e.setAttribute(\\\"rel\\\",\\\"noopener noreferrer\\\"),e.hasAttribute(\\\"target\\\")||e.setAttribute(\\\"target\\\",\\\"_blank\\\"))}(e),ie(e,t)}else e.remove()}function le(e){for(let t of e.split(\\\",\\\")){let e=t.trim();if(0===e.length)continue;let n=e.search(/\\\\s/);if(!f(-1===n?e:e.slice(0,n)))return!1}return!0}function oe(e){return\\\"\\\"===e?\\\"\\\":e.replace(si,e=>ai[e])}function ae(e){return\\\"\\\"===e?\\\"\\\":e.replace(di,e=>ui[e])}function se(e,t,n,i){let r=\\\"object\\\"==typeof t&&null!==t?t:null;return e.replace(ci,(e,l)=>null!==r&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(r,l)?oe(i(Reflect.get(r,l))):null===r&&\\\"value\\\"===l?oe(i(t)):\\\"index\\\"===l?String(n):e)}function ue(e){if(null==e)return\\\"\\\";if(\\\"string\\\"==typeof e)return e;if(\\\"number\\\"==typeof e||\\\"boolean\\\"==typeof e||\\\"bigint\\\"==typeof e)return String(e);try{return JSON.stringify(e)}catch{return\\\"\\\"}}function de(e){return null==e||\\\"\\\"===e}function ce(e){let t=gi.get(e);if(void 0!==t)return t;let n=new Set(hi);for(let t of e.matchAll(pi)){let e=t[1]?.toLowerCase();void 0!==e&&n.add(e)}let i={};for(let e of n)i[e]=fi;let r={additionalAllowedTags:[...n],additionalAllowedAttributes:i,allowFormControls:!0,templateMode:!0};return gi.set(e,r),r}function he(e){let{template:t,container:n,patches:i,nextItems:r,store:l,forceRender:o=!1}=e,a=pe(n,t,i,r,o,l);return null===a?null:ge(a,l,{morph:e.morph??!0,onDuplicateKey:e.onDuplicateKey})}function fe(e,t){return t.hasAttribute(vi)&&t.hasAttribute(yi)}function pe(e,t,n,i,r,l){let o=function(e,t,n,i,r,l,o){let a=Array.from(e.children),s=ke(a,mi),u=new Set,d=[];for(let c=0;c<n.length;c+=1){let h=n[c],f=Se(h),p=void 0===f?a[c]??null:Te(s,f)??null;null!==p&&u.has(p)&&(p=null),null!==p&&u.add(p);let g=i.replaces.has(c),m=r||i.renders.has(c)||null===p?Ae(e.ownerDocument,t,h,c):void 0;if(null===m)return null;let v=void 0===m?[]:me(g?null:p,m,h,l,o);if(null===v)return null;d.push([c,p,m??void 0,v,g])}return d}(e,t,i,function(e){let t=new Set,n=new Set;for(let i of e)\\\"insert\\\"===i.kind||\\\"update\\\"===i.kind?t.add(i.index):\\\"replace\\\"===i.kind&&(t.add(i.index),n.add(i.index));return{renders:t,replaces:n}}(n),r,l.get(e),l);return null===o?null:[e,o,i]}function ge(e,t,n){let[i,r,l]=e,o=new Set,a=!1;for(let[e,l,s,u,d]of r){let r=l;if(void 0!==s){let e=!(!n.morph||d||null===l)&&X(l,s,{keyAttributes:[mi,vi],retainChildrenOf:fe,...void 0!==n.onDuplicateKey?{onDuplicateKey:n.onDuplicateKey}:{}})===l;if(!e)for(let[e,t]of u)null!==e&&(ye(e,t),t.replaceWith(e));for(let[,,e]of u)void 0!==e&&ge(e,t,n);e?a=!0:(null!==l&&(l.replaceWith(s),a=!0),r=s)}if(null===r)continue;let c=i.children[e]??null;r!==c&&(i.insertBefore(r,c),a=!0),o.add(r)}for(let e of Array.from(i.children))o.has(e)||(e.remove(),a=!0);let s=function(e,t){let n=t.get(e);return n||(n=new Map,t.set(e,n)),n}(i,t);s.clear();for(let e of l)we(s,e);return a}function me(e,t,n,i,r){let l=ke(null===e?[]:ve(e),vi),o=Se(n),a=void 0!==o?i?.get(o):void 0,s=[];for(let e of ve(t)){let t=e.getAttribute(vi);if(null===t)continue;let i,o=Te(l,t)??null,u=e.getAttribute(yi),d=u?o:null,h=d?.getAttribute(yi)??null;if(u){let l=be(n,t);if(void 0!==l||null!==d){let n=l??[],o=c(null===d?[]:be(a,t)??[],n),s=null!==d&&h!==u;if((o.length>0||s)&&(i=pe(d??e,u,o,n,s,r)??void 0,void 0===i))return null}}s.push([d,e,i])}return s}function ve(e){return Array.from(e.querySelectorAll(`[${vi}]`)).filter(t=>{let n=t.parentElement;for(;null!==n&&n!==e;){if(n.hasAttribute(vi))return!1;n=n.parentElement}return n===e})}function ye(e,t){for(let n of Array.from(e.attributes))t.hasAttribute(n.name)||e.removeAttribute(n.name);for(let n of Array.from(t.attributes))e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value)}function be(e,t){if(\\\"object\\\"!=typeof e||null===e)return;let n=e[t];return Array.isArray(n)?n:void 0}function we(e,t){let n=Se(t);void 0!==n&&e.set(n,t)}function Se(e){if(\\\"object\\\"!=typeof e||null===e)return;let t=e.id;return\\\"string\\\"==typeof t||\\\"number\\\"==typeof t?String(t):void 0}function ke(e,t){let n=new Map;for(let i=e.length-1;i>=0;i-=1){let r=e[i];if(void 0===r)continue;let l=r.getAttribute(t);if(null===l)continue;let o=n.get(l);void 0===o?n.set(l,[r]):o.push(r)}return n}function Te(e,t){return e.get(t)?.pop()}function Ae(e,t,n,i){let r=te(se(t,n,i,ue),ce(t)),l=e.createElement(\\\"template\\\");l.innerHTML=J(r);let o=l.content.firstElementChild;if(!o)return null;let a=Se(n);return void 0!==a&&o.setAttribute(mi,a),o}function Ce(e,t,n,i){let r=m(t);if(void 0===r)return;let l=[e.hrefField,e.srcField,e.altField],o=r;for(let t of l){if(void 0===t||0===t.length)continue;let r=m(B(n,t,e.locale??i,void 0!==e.locale));if(void 0===r)return;o+=`|${t}=${r}`}return o}function $e(e,t){return null!==t&&e.generation===t.generation&&e.revision===t.revision}function Fe(e){if(!1===e.enableA11y)return null;let t=e.root,n=void 0===t?void 0:Re(t)?t:t.ownerDocument;return new Wt(e.a11yLocale,n)}function Re(e){return 9===e.nodeType}function Ne(e){return e.body}function Me(e){if(typeof window>\\\"u\\\")return;let t=[];window.parent!==window&&t.push(window.parent),window.opener instanceof Window&&t.push(window.opener),jn.sendReady(t,e)}function xe(){if(typeof window>\\\"u\\\")return!1;try{return window.self!==window.top}catch{return!0}}function Ee(e){let t=e.trim();if(0!==t.length)try{let e=new URL(t);return\\\"http:\\\"!==e.protocol&&\\\"https:\\\"!==e.protocol||!Ci.test(e.origin)?void 0:e.origin}catch{return}}function Ie(e){let t=e.format;return\\\"string\\\"==typeof t&&Mi.has(t)?t:\\\"number\\\"==typeof t?Ni[t]:void 0}function Le(e){let t=e.indent;return\\\"number\\\"==typeof t&&t>0?t:0}function Oe(e){return\\\"rtl\\\"===e.direction?' dir=\\\"rtl\\\"':\\\"ltr\\\"===e.direction?' dir=\\\"ltr\\\"':\\\"\\\"}function Ue(e){let t=Ie(e),n=Le(e),i=[];return void 0!==t&&i.push(`lp-align-${t}`),n>0&&i.push(`lp-indent-${String(n)}`),0===i.length?\\\"\\\":` class=\\\"${i.join(\\\" \\\")}\\\"`}function Pe(e){return\\\"object\\\"==typeof e&&null!==e?e:void 0}function je(e){return Pe(e)}function We(e){return e.replace(/[^a-zA-Z0-9_-]/g,\\\"-\\\").toLowerCase()}function De(e){return\\\"string\\\"==typeof e&&e.length>0?e:void 0}function Ve(e){let t=De(e.title)??De(e.name)??De(e.slug);return void 0!==t?t:void 0===e.id?void 0:String(e.id)}function Be(e){if(\\\"string\\\"==typeof e.text)return e.text;if(!e.children)return\\\"\\\";let t=\\\"\\\";for(let n of e.children)t+=Be(n);return t}function _e(e){return`${\\\"number\\\"==typeof e.width?` width=\\\"${String(e.width)}\\\"`:\\\"\\\"}${\\\"number\\\"==typeof e.height?` height=\\\"${String(e.height)}\\\"`:\\\"\\\"}`}function He(e){return\\\"string\\\"==typeof e.mimeType?` type=\\\"${ae(e.mimeType)}\\\"`:\\\"\\\"}function ze(e){return Li.get(e)}function Ge(e,t,n,i){let r=Pe(e.fields)??{},l=\\\"string\\\"==typeof r.blockType?r.blockType:\\\"\\\",o=We(l);if(\\\"\\\"!==l){let e=ze(l)??ze(o);if(e)return e(r,{renderChildren:t.renderChildren})}return`<${n} class=\\\"${\\\"\\\"===o?i:`${i} ${i}--${o}`}\\\"></${n}>`}function qe(e,t){return\\\"number\\\"==typeof t&&t>1?` ${e}=\\\"${String(t)}\\\"`:\\\"\\\"}function Je(e){if(\\\"object\\\"!=typeof e||null===e||!(\\\"root\\\"in e))return!1;let t=e.root;return\\\"object\\\"==typeof t&&null!==t&&\\\"children\\\"in t&&Array.isArray(t.children)}function Ke(e){let t=\\\"\\\";for(let n of e)t+=Qe(n);return t}function Qe(e){let t=function(e){return Ui.get(e)??Oi[e]}(e.type);return t?t(e,Pi):void 0!==e.children?Ke(e.children):\\\"\\\"}function Xe(e){if(\\\"string\\\"==typeof e.text)return e.text;if(\\\"linebreak\\\"===e.type)return\\\"\\\\n\\\";if(void 0===e.children)return\\\"\\\";let t=\\\"\\\";for(let n of e.children)t+=Xe(n);return t}function Ze(e=\\\"text\\\"){let t=new WeakSet;return{name:e,render:g((e,n)=>{let i=e.element,r=function(e){return null==e?\\\"\\\":Je(e)?function(e){return Je(e)?e.root.children.map(Xe).join(\\\"\\\\n\\\").trim():\\\"\\\"}(e):\\\"string\\\"==typeof e?e:\\\"number\\\"==typeof e||\\\"boolean\\\"==typeof e?String(e):JSON.stringify(e)}(n);if(\\\"INPUT\\\"!==i.tagName&&\\\"TEXTAREA\\\"!==i.tagName){if(function(e){return null!==e.querySelector(\\\":scope > :not(br)\\\")}(i)&&!i.hasAttribute(Wi))return function(e,t,n){e.has(t)||(e.add(t),Ft(`[live-preview] LP0402: Skipping text update for \\\"${n}\\\": <${t.tagName.toLowerCase()}> has structured children. Move data-payload-field to the value element, or add data-payload-text to replace them.`))}(t,i,e.fieldName),!1;r.includes(\\\"\\\\n\\\")||r.includes(\\\"\\\\r\\\")?i.innerHTML=J(function(e){return oe(e).replace(/\\\\r\\\\n|\\\\r|\\\\n/g,\\\"<br>\\\")}(r)):i.textContent=r}else i.value=r})}}function Ye(e,t,n){return\\\"string\\\"!=typeof n||0===n.length?{kind:\\\"none\\\"}:f(n)?{kind:\\\"safe\\\",url:n}:(Bi.has(e)||(Bi.add(e),Ft(`[live-preview] LP0401: refused an unsafe URL for \\\"${t}\\\" on <${e.tagName.toLowerCase()}>; the attribute was cleared.`)),{kind:\\\"unsafe\\\"})}function et(e,t=e=>e){return{name:e,render(e,n,i){let r=e.element;if(de(n)){!function(e){\\\"INPUT\\\"!==e.tagName&&\\\"TEXTAREA\\\"!==e.tagName?(e.removeAttribute(\\\"href\\\"),e.textContent=\\\"\\\"):e.value=\\\"\\\"}(r);return}let l=ue(n);if(\\\"INPUT\\\"!==r.tagName&&\\\"TEXTAREA\\\"!==r.tagName){if(\\\"A\\\"===r.tagName){let n=e.hrefField,o=void 0===n||0===n.length?t(l):B(i.allFields,n,i.locale,void 0!==e.locale),a=Ye(r,e.fieldName,o);\\\"safe\\\"===a.kind?r.setAttribute(\\\"href\\\",a.url):\\\"unsafe\\\"===a.kind&&r.removeAttribute(\\\"href\\\")}r.textContent=l}else r.value=l}}}function tt(e){for(let t of Gi)e.removeAttribute(t)}function nt(e,t,n){e.src=t;let i=function(e){if(void 0===e?.sizes)return;let t=[];for(let n of Object.values(e.sizes))\\\"string\\\"!=typeof n.url||\\\"number\\\"!=typeof n.width||!f(n.url)||t.push(`${it(n.url)} ${String(n.width)}w`);return 0!==t.length?(\\\"number\\\"==typeof e.width&&\\\"string\\\"==typeof e.url&&f(e.url)&&t.push(`${it(e.url)} ${String(e.width)}w`),t.join(\\\", \\\")):void 0}(n);void 0!==i?e.setAttribute(\\\"srcset\\\",i):(e.removeAttribute(\\\"srcset\\\"),e.removeAttribute(\\\"sizes\\\"))}function it(e){return e.replace(/[\\\\s,]/g,encodeURIComponent)}function rt(e){\\\"IMG\\\"===e.tagName?tt(e):e.style.backgroundImage=\\\"\\\"}function lt(e){\\\"IMG\\\"!==e.tagName?(e.removeAttribute(\\\"href\\\"),e.textContent=\\\"\\\"):tt(e)}function ot(e){let t=Pe(e);return void 0===t?ue(e):Ve(t)??\\\"\\\"}function at(e,t){let n=e??\\\"\\\";if(null==t)return n;let i=st(t);return\\\"{}\\\"===i?n:`${n}|${i}`}function st(e){if(null===e||\\\"object\\\"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(e=>st(e)).join(\\\",\\\")}]`;let t=e,n=Object.keys(t).sort(),i=[];for(let e of n){let n=t[e];void 0!==n&&i.push(`${JSON.stringify(e)}:${st(n)}`)}return`{${i.join(\\\",\\\")}}`}function ut(e){for(;e.size>tr;){let t=e.keys().next().value;if(void 0===t)break;e.delete(t)}}function dt(e){return String(e).padStart(2,\\\"0\\\")}function ct(){let e=new WeakMap,t=new WeakSet,n=new WeakMap,i=new WeakMap;return{name:\\\"structural-array\\\",render:g((r,l)=>{let o=de(l)?[]:l;if(!Array.isArray(o))return!1;let a=r.element,s=r.arrayTemplate;if(void 0===s||0===s.length)return function(e,t,n){e.has(t)||(e.add(t),Ft(`[live-preview] LP0403: Skipping structural update for \\\"${n}\\\": <${t.tagName.toLowerCase()} data-payload-structural> needs data-payload-array-template (for example \\\"<li>{{label}}</li>\\\").`))}(t,a,r.fieldName),!1;let u=e.get(a),d=ht(a),h=u?.values??function(e){return e.map((e,t)=>null===e?{__payloadDomPosition:t}:{id:e})}(d),f=c(h,o),p=function(e,t,n){return void 0===e||e.template!==t||!function(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}(e.domSnapshot,n)}(u,s,d);if(0===f.length&&!p)return e.set(a,{values:o.slice(),template:s,domSnapshot:d}),!1;!function(e,t,n,i,r){let l=r.map(ft),o=new Set,a=l.find(e=>!(void 0===e||!o.has(e)&&(o.add(e),1)));if(void 0!==a&&pt(e,t,n,a),l.some(e=>void 0===e)&&gt(e,t,\\\"LP0404\\\",`LP0404: an item of \\\"${n}\\\" has no id and pairs by position, so an insert re-renders every row after it. Give items a stable id.`),i?.length===r.length&&r.length>1){let r=new Set(i.map(ft).filter(e=>void 0!==e)),o=l.some(e=>void 0!==e&&r.has(e));r.size>0&&!o&&gt(e,t,\\\"LP0406\\\",`LP0406: every key of \\\"${n}\\\" changed at once; the source generates ids per message, so no item can be retained across updates.`)}}(n,a,r.fieldName,u?.values,o);let g=he({template:s,container:a,patches:f,nextItems:o,store:i,forceRender:p,onDuplicateKey:(e,t)=>{pt(n,e,r.fieldName,t)}});return null!==g&&(e.set(a,{values:o.slice(),template:s,domSnapshot:ht(a)}),!!g&&void 0)})}}function ht(e){return Array.from(e.children,e=>e.getAttribute(mi))}function ft(e){if(\\\"object\\\"!=typeof e||null===e)return;let t=e.id;return\\\"string\\\"==typeof t||\\\"number\\\"==typeof t?String(t):void 0}function pt(e,t,n,i){gt(e,t,\\\"LP0405\\\",`LP0405: two items of \\\"${n}\\\" share the key \\\"${i}\\\"; later ones pair by position. Make \\\\`id\\\\` unique per item.`)}function gt(e,t,n,i){let r=e.get(t);void 0===r&&(r=new Set,e.set(t,r)),!r.has(n)&&(r.add(n),Ft(`[live-preview] ${i}`))}function mt(){return typeof __LIVE_PREVIEW_CONFIG__>\\\"u\\\"?[]:__LIVE_PREVIEW_CONFIG__}var vt,yt=Object.defineProperty,bt=e=>{throw TypeError(e)},wt=(e,t,n)=>((e,t,n)=>t in e?yt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,\\\"symbol\\\"!=typeof t?t+\\\"\\\":t,n),St=(e,t,n)=>t.has(e)||bt(\\\"Cannot \\\"+n),kt=(e,t,n)=>(St(e,t,\\\"read from private field\\\"),n?n.call(e):t.get(e)),Tt=(e,t,n)=>t.has(e)?bt(\\\"Cannot add the same private member more than once\\\"):t instanceof WeakSet?t.add(e):t.set(e,n),At=(e,t,n,i)=>(St(e,t,\\\"write to private field\\\"),i?i.call(e,n):t.set(e,n),n),Ct=(e,t,n)=>(St(e,t,\\\"access private method\\\"),n),$t=t((...e)=>console.error(...e)),Ft=t((...e)=>console.warn(...e)),Rt=t((...e)=>console.debug(...e)),Nt=class{constructor(){Tt(this,Et);Tt(this,Mt,new Map);Tt(this,xt,new Map)}on(e,t){return Ct(this,Et,Lt).call(this,kt(this,Mt),e,t)}once(e,t){return Ct(this,Et,Lt).call(this,kt(this,xt),e,t)}off(e,t){Ct(this,Et,Ot).call(this,kt(this,Mt),e,t),Ct(this,Et,Ot).call(this,kt(this,xt),e,t)}async emit(e,t){await Ct(this,Et,It).call(this,e,t)}async emitWhile(e,t,n){return Ct(this,Et,It).call(this,e,t,n)}listenerCount(e){return(kt(this,Mt).get(e)?.size??0)+(kt(this,xt).get(e)?.size??0)}removeAllListeners(e){void 0!==e?(kt(this,Mt).delete(e),kt(this,xt).delete(e)):(kt(this,Mt).clear(),kt(this,xt).clear())}eventNames(){let e=new Set;for(let t of kt(this,Mt).keys())e.add(t);for(let t of kt(this,xt).keys())e.add(t);return[...e]}},Mt=new WeakMap,xt=new WeakMap,Et=new WeakSet,It=async function(e,t,n){let i=()=>n?.()??!0;if(!i())return!1;let r=kt(this,Mt).get(e);if(r)for(let n of[...r])if(!i()||(await Ct(this,Et,Ut).call(this,n,t,e),!i()))return!1;if(!i())return!1;let l=kt(this,xt).get(e);if(l&&l.size>0){let n=[...l];kt(this,xt).delete(e);for(let r of n)if(!i()||(await Ct(this,Et,Ut).call(this,r,t,e),!i()))return!1}return i()},Lt=function(e,t,n){let i=e.get(t);return i||(i=new Set,e.set(t,i)),i.add(n),()=>{Ct(this,Et,Ot).call(this,e,t,n)}},Ot=function(e,t,n){let i=e.get(t);void 0!==i&&(i.delete(n),0===i.size&&e.delete(t))},Ut=async function(e,t,n){try{await e(t)}catch(e){let t=\\\"string\\\"==typeof n||\\\"number\\\"==typeof n?String(n):\\\"<event>\\\";$t(`[live-preview] LP0601: handler for \\\"${t}\\\" threw:`,e)}},Pt=\\\"payload-live-preview-a11y\\\",jt=new WeakMap,Wt=class{constructor(e,t){wt(this,\\\"german\\\");wt(this,\\\"document\\\");wt(this,\\\"lease\\\",null);let n=t??(typeof document>\\\"u\\\"?null:document),r=n?.documentElement.getAttribute(\\\"lang\\\")??\\\"\\\";this.german=function(e){return/^de(?:[-_]|$)/i.test(e)}(e??(r.length>0?r:i())),this.document=n}mount(){let e=this.document;if(null==e?.body)return null;this.lease??(this.lease=function(e){let t=jt.get(e);return void 0===t&&(t={element:null,owned:!1,messageNode:null,refs:0,timer:null},jt.set(e,t)),t.refs+=1,t}(e));let t=this.lease,n=t.element;if(n?.isConnected&&n.ownerDocument===e)return n;if(null!==n){let e=t.owned;r(t),e&&n.remove()}let i=e.getElementById(Pt);return t.owned=null===i,null===i&&(i=e.createElement(\\\"div\\\"),i.id=Pt,i.setAttribute(\\\"role\\\",\\\"status\\\"),i.setAttribute(\\\"aria-live\\\",\\\"polite\\\"),i.setAttribute(\\\"aria-atomic\\\",\\\"true\\\"),i.setAttribute(\\\"style\\\",\\\"position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0\\\"),e.body.appendChild(i)),t.element=i,i}announceConnected(){this.say(this.german?\\\"Vorschau verbunden\\\":\\\"Live preview connected\\\")}announceDisconnected(){this.say(this.german?\\\"Vorschau getrennt\\\":\\\"Live preview disconnected\\\")}announceUpdate(e){e<=0||this.say(this.german?`${String(e)} ${1===e?\\\"\\\\xc4nderung\\\":\\\"\\\\xc4nderungen\\\"} angewendet`:`${String(e)} ${1===e?\\\"change\\\":\\\"changes\\\"} applied`)}detach(){let e=this.lease,t=this.document;if(null===e||null===t||(this.lease=null,e.refs-=1,e.refs>0))return;let n=e.element;null!==n&&r(e),e.owned&&n?.remove(),e.element=null,jt.delete(t)}say(e){let t=this.mount(),n=this.lease;if(null===t||null===n)return;let i=n.messageNode;i?.parentNode!==t?(i?.remove(),i=t.ownerDocument.createTextNode(t.hasChildNodes()?` ${e}`:e),n.messageNode=i,t.appendChild(i)):i.data=null===i.previousSibling?e:` ${e}`,null!==n.timer&&clearTimeout(n.timer);let l=setTimeout(()=>{n.timer===l&&n.element===t&&r(n)},1500);n.timer=l}},Dt=new Set([\\\"tabs\\\",\\\"row\\\",\\\"collapsible\\\"]),Vt={text:\\\"text\\\",textarea:\\\"textarea\\\",richText:\\\"richText\\\",email:\\\"email\\\",number:\\\"number\\\",checkbox:\\\"checkbox\\\",date:\\\"date\\\",select:\\\"select\\\",radio:\\\"radio\\\",array:\\\"array\\\",blocks:\\\"blocks\\\",group:\\\"text\\\",tabs:\\\"text\\\",row:\\\"text\\\",collapsible:\\\"text\\\",relationship:\\\"relationship\\\",upload:\\\"upload\\\",point:\\\"text\\\",json:\\\"text\\\",code:\\\"text\\\",ui:\\\"text\\\"},Bt=new Set([\\\"http:\\\",\\\"https:\\\",\\\"mailto:\\\",\\\"tel:\\\"]),_t=/^\\\\s*(?:javascript|data|vbscript|file|blob|about)\\\\s*:/i,Ht=/^(?:\\\\.{1,2}\\\\/|[a-zA-Z0-9_-]+\\\\/?)/,zt=/^[\\\\\\\\/]{2}/,Gt=/[\\\\t\\\\n\\\\r]/g,qt=new Set([\\\"style\\\",\\\"srcdoc\\\",\\\"formaction\\\",\\\"form\\\",\\\"id\\\",\\\"name\\\",\\\"is\\\",\\\"srcset\\\",\\\"imagesrcset\\\"]),Jt=new Set([\\\"href\\\",\\\"src\\\",\\\"poster\\\",\\\"cite\\\",\\\"action\\\",\\\"xlink:href\\\",\\\"data\\\"]),Kt=new WeakSet,Qt=class{constructor(){wt(this,\\\"previous\\\",null)}diff(e,t){let n=this.previous,i=new Map,r=new Set;for(let[t,l]of Object.entries(e)){let e=m(l);i.set(t,e),(null===n||void 0===e||n.get(t)!==e)&&r.add(t)}if(null!==n)for(let e of n.keys())i.has(e)||r.add(e);this.previous=i;let l=new Set;for(let[e,n]of Object.entries(t))if(r.has(e))for(let e of n)l.add(e);return{changed:r,invalidated:l}}reset(){this.previous=null}},Xt={basic:{since:1},\\\"schema-json\\\":{since:2,observed:\\\"schema\\\"},locale:{since:2,observed:\\\"locale\\\"},\\\"preview-token\\\":{since:3,observed:\\\"preview-token\\\"},\\\"nested-arrays\\\":{since:4},\\\"recursive-diffs\\\":{since:4},\\\"document-events\\\":{since:4,observed:\\\"document-event\\\"},\\\"relationship-events\\\":{since:4,observed:\\\"relationship-event\\\"}},Zt=Object.keys(Xt),Yt=class{constructor(){wt(this,\\\"negotiation\\\",v(void 0));wt(this,\\\"observed\\\",new Set)}observe(e,t){let n=e.filter(e=>!this.observed.has(e));if(0!==n.length){for(let e of n)this.observed.add(e);this.negotiation=v(this.negotiation.theirs,this.observed),t(\\\"protocol\\\",`observed=${n.join(\\\",\\\")}`)}}applyVersion(e,t){let n=this.negotiation;if(n.theirs===e)return;let i=v(e,this.observed);this.negotiation=i,i.negotiated!==n.negotiated&&t(\\\"protocol\\\",\\\"ours=4\\\",`theirs=${e}`,`negotiated=${i.negotiated}`)}},en=class{constructor(){Tt(this,tn)}reveal(e,t,n){return e===kt(this,tn)?\\\"skipped-same\\\":(At(this,tn,e),function(e,t){return function(e,t){let n=e.getBoundingClientRect(),i=n.bottom>0&&n.top<t.innerHeight,r=n.right>0&&n.left<t.innerWidth;return i&&r}(e,t)?\\\"already-visible\\\":(e.scrollIntoView({behavior:y(t)?\\\"auto\\\":\\\"smooth\\\",block:\\\"center\\\"}),\\\"revealed\\\")}(t,n))}reset(){At(this,tn,void 0)}},tn=new WeakMap,nn=class{constructor(){wt(this,\\\"started\\\",!1);wt(this,\\\"suspended\\\",!1);wt(this,\\\"deferredStart\\\",null);wt(this,\\\"activeUpdate\\\",null);wt(this,\\\"locale\\\");wt(this,\\\"schema\\\");wt(this,\\\"schemaIndex\\\");wt(this,\\\"updateCount\\\",0);wt(this,\\\"supersededCount\\\",0);wt(this,\\\"completedCount\\\",0);wt(this,\\\"skippedUnchangedCount\\\",0);wt(this,\\\"lastFlush\\\",null);wt(this,\\\"absentFields\\\",new Set);wt(this,\\\"warnedOrphanFields\\\",new Set);wt(this,\\\"warnedStrategy\\\",new WeakSet);wt(this,\\\"warnedUnattributableMessage\\\",!1);wt(this,\\\"warnedVisibilityGate\\\",!1);wt(this,\\\"warnedFragmentFallback\\\",!1);wt(this,\\\"lastAppliedIdentity\\\",new WeakMap);wt(this,\\\"seenFieldIdentity\\\",new Map);wt(this,\\\"fragmentStats\\\",{rendered:0,failed:0,superseded:0});wt(this,\\\"routeStats\\\",{refreshes:0,failed:0,loopStopped:0});wt(this,\\\"fragmentController\\\",null);wt(this,\\\"routeController\\\",null);wt(this,\\\"readyTimers\\\",[]);wt(this,\\\"revealer\\\",new en);wt(this,\\\"changes\\\",new Qt);wt(this,\\\"protocol\\\",new Yt)}isRunning(){return this.started}isCurrent(e){return this.started&&this.activeUpdate===e}complete(e){e.completed||(e.completed=!0,this.completedCount+=1)}abortStrategies(){for(let e of[\\\"fragmentController\\\",\\\"routeController\\\"]){let t=this[e];null!==t&&(this[e]=null,t.abort())}}},rn=class{constructor(e,t){wt(this,\\\"deps\\\",e);wt(this,\\\"state\\\",t)}apply(e){let{deps:t,state:n}=this,i=n.activeUpdate;if(null===i||void 0===e.identity||!b(i.identity,e.identity)||!n.isCurrent(i))return!1;let{target:r,value:l}=e,o=void 0!==i.schemaIndex?function(e,t){if(e.has(t))return e.get(t);let n=t.replace(/\\\\.\\\\d+(?=\\\\.|$)/g,\\\".*\\\");return e.has(n)?e.get(n):void 0}(i.schemaIndex,r.fieldName):void 0,a=function(e,t){if(e.explicitFieldType)return e.fieldType;if(void 0!==t){let e=function(e){if(Object.prototype.hasOwnProperty.call(Vt,e))return Vt[e]}(t);if(void 0!==e)return e}return e.fieldType}(r,o?.type);\\\"text\\\"===a&&!0!==r.explicitFieldType&&function(e){if(\\\"object\\\"!=typeof e||null===e||!(\\\"root\\\"in e))return!1;let t=e.root;return\\\"object\\\"==typeof t&&null!==t&&Array.isArray(t.children)}(l)&&(a=\\\"richText\\\");let s;try{s=t.resolveRenderer(a,r)}catch(e){return this.fail(i,e)}if(!n.isCurrent(i))return!1;let u=t.emitter.listenerCount(\\\"elementUpdate\\\")>0,d=u?function(e){return\\\"INPUT\\\"===e.tagName||\\\"TEXTAREA\\\"===e.tagName?e.value:\\\"IMG\\\"===e.tagName?e.src:e.textContent}(r.element):void 0;if(!n.isCurrent(i))return!1;let c={allFields:e.allFields,locale:r.locale??i.locale,schema:o,...void 0!==t.renderRichText?{renderRichText:t.renderRichText}:{}};!0===r.boundary&&r.element.toggleAttribute(\\\"hidden\\\",function(e){return null==e||(\\\"string\\\"==typeof e?0===e.trim().length:Array.isArray(e)&&0===e.length)}(l));try{if(void 0!==r.targetAttribute){if(\\\"blocked\\\"===function(e,t,n){let i=t.toLowerCase().trim();if(0===i.length||i.startsWith(\\\"on\\\")||qt.has(i))return\\\"blocked\\\";if(null==n)return e.removeAttribute(i),\\\"applied\\\";if(\\\"string\\\"!=typeof n&&\\\"number\\\"!=typeof n&&\\\"boolean\\\"!=typeof n)return\\\"blocked\\\";let r=String(n);return Jt.has(i)&&!f(r)?\\\"blocked\\\":(e.setAttribute(i,r),\\\"applied\\\")}(r.element,r.targetAttribute,l))return t.warn(`[live-preview] LP0401: refused to write \\\"${r.fieldName}\\\" into attribute \\\"${r.targetAttribute}\\\"`),!1}else{if(void 0===s)return t.log(\\\"no renderer for\\\",a),!1;if(!1===function(e,t,n,i){return e.render(t,n,i)}(s,r,l,c)&&function(e){return Kt.has(e.render)}(s))return!1}}catch(e){return this.fail(i,e)}if(!n.isCurrent(i))return!1;u&&t.emitter.emitWhile(\\\"elementUpdate\\\",{element:r.element,fieldName:r.fieldName,previousValue:d,nextValue:l,revision:i.identity.revision,receivedAt:i.receivedAt,source:\\\"patch\\\"},()=>n.isCurrent(i));let h=n.isCurrent(i);return h&&(void 0!==e.valueIdentity?n.lastAppliedIdentity.set(r.element,e.valueIdentity):n.lastAppliedIdentity.delete(r.element)),h}fail(e,t){if(!this.state.isCurrent(e))return!1;let n=t instanceof Error?t:new Error(String(t));return this.deps.emitter.emitWhile(\\\"error\\\",{error:n,context:\\\"renderer\\\",code:\\\"LP0603\\\"},()=>this.state.isCurrent(e)),!1}},ln=\\\"data-payload-island\\\",on=`astro-island, [${ln}]`,an=\\\"data-payload-fragment\\\",sn=\\\"data-payload-strategy\\\",un=\\\"data-payload-field\\\",dn=\\\"data-payload-type\\\",cn=\\\"data-payload-attribute\\\",hn=\\\"data-payload-href\\\",fn=\\\"data-payload-src\\\",pn=\\\"data-payload-alt\\\",gn=\\\"data-payload-array-template\\\",mn=\\\"data-payload-array-separator\\\",vn=\\\"data-payload-locale\\\",yn=\\\"data-payload-richtext\\\",bn=\\\"data-payload-html\\\",wn=\\\"data-payload-array\\\",Sn=\\\"data-payload-structural\\\",kn=\\\"data-payload-owner\\\",Tn=\\\"data-payload-depends\\\",An=\\\"data-payload-strategy\\\",Cn=\\\"data-payload-boundary\\\",$n=[un,dn,cn,hn,fn,pn,gn,mn,vn,yn,bn,wn,Sn,kn,Tn,An,Cn,\\\"type\\\"],Fn=`[${un}]`,Rn=`[${kn}]`,Nn=/^[a-z][a-z0-9-]*:[a-z][a-z0-9-]*$/i,Mn=new Set([\\\"text\\\",\\\"textarea\\\",\\\"richText\\\",\\\"email\\\",\\\"number\\\",\\\"checkbox\\\",\\\"date\\\",\\\"select\\\",\\\"radio\\\",\\\"array\\\",\\\"blocks\\\",\\\"group\\\",\\\"tabs\\\",\\\"row\\\",\\\"collapsible\\\",\\\"relationship\\\",\\\"upload\\\",\\\"point\\\",\\\"json\\\",\\\"code\\\",\\\"ui\\\",\\\"html\\\",\\\"url\\\",\\\"image\\\",\\\"structural-array\\\"]),xn=class{constructor(e={}){wt(this,\\\"entriesByField\\\",new Map);wt(this,\\\"entryByElement\\\",new WeakMap);wt(this,\\\"filter\\\");wt(this,\\\"count\\\",0);wt(this,\\\"dependencies\\\",null);wt(this,\\\"islandRoots\\\",[]);this.filter=e.filter??R}dependencyMap(){if(null!==this.dependencies)return this.dependencies;let e=[];for(let t of this.values())void 0!==t.dependsOn&&e.push(S(t.fieldName,t.dependsOn));return this.dependencies=w(...e),this.dependencies}get islands(){return this.islandRoots}buildFromRoot(e){let t=performance.now();this.clear();let n=0;for(let t of e.querySelectorAll(Fn))void 0!==this.add(t)&&(n+=1);return this.islandRoots=function(e){let t=[];for(let n of e.querySelectorAll(on))T(n)||t.push(n);return t}(e),{elementCount:n,fieldCount:this.entriesByField.size,durationMs:performance.now()-t}}add(e){let t=this.filter(e)?this.resolveBinding(e):void 0,n=this.entryByElement.get(e);if(this.dependencies=null,void 0!==t)return void 0!==n&&this.replaceEntry(n,t)?(this.entryByElement.set(e,t),t):(void 0!==n&&this.removeEntry(e,n),this.append(t),this.entryByElement.set(e,t),t);void 0!==n&&this.removeEntry(e,n)}remove(e){let t=this.entryByElement.get(e);return!!t&&(this.dependencies=null,this.removeEntry(e,t))}get(e){return this.entriesByField.get(e)}getByElement(e){return this.entryByElement.get(e)}get fieldCount(){return this.entriesByField.size}get elementCount(){return this.count}entries(){return this.entriesByField.entries()}*values(){for(let e of this.entriesByField.values())yield*e}has(e){return this.entryByElement.has(e)}clear(){this.entriesByField.clear(),this.entryByElement=new WeakMap,this.count=0,this.dependencies=null,this.islandRoots=[]}replaceEntry(e,t){if(e.fieldName!==t.fieldName)return!1;let n=this.entriesByField.get(e.fieldName),i=void 0===n?-1:n.indexOf(e);return!(void 0===n||i<0||(n[i]=t,0))}removeEntry(e,t){this.entryByElement.delete(e);let n=this.entriesByField.get(t.fieldName),i=void 0===n?-1:n.indexOf(t);return!(void 0===n||i<0||(n.splice(i,1),0===n.length&&this.entriesByField.delete(t.fieldName),this.count-=1,0))}append(e){let t=this.entriesByField.get(e.fieldName);t?t.push(e):this.entriesByField.set(e.fieldName,[e]),this.count+=1}resolveBinding(e){let t=e.getAttribute(un);if(null===t||0===t.length)return;let n=e.getAttribute(dn),i=e.getAttribute(cn),r=e.getAttribute(hn),l=e.getAttribute(fn),o=e.getAttribute(pn),a=e.getAttribute(gn),s=e.getAttribute(mn),u=e.getAttribute(vn),d=function(e){let t=e.closest(Rn)?.getAttribute(kn);return null==t||0===t.length?void 0:t}(e),c=function(e){if(null==e)return[];let t=new Set,n=[];for(let i of e.split(/[\\\\s,]+/)){let e=i.trim();0===e.length||t.has(e)||(t.add(e),n.push(e))}return n}(e.getAttribute(Tn)),h=e.getAttribute(An),f=A(e);return{element:e,fieldName:t,fieldType:F(e),explicitFieldType:null!==n&&$(n),strategyKind:C(e)??\\\"unknown\\\",...null!==f?{fragmentBoundary:f}:{},...null!==i&&i.length>0?{targetAttribute:i}:{},...null!==r&&r.length>0?{hrefField:r}:{},...null!==l&&l.length>0?{srcField:l}:{},...null!==o&&o.length>0?{altField:o}:{},...null!==a?{arrayTemplate:a}:{},...null!==s?{arraySeparator:s}:{},...null!==u&&u.length>0?{locale:u}:{},...void 0!==d?{owner:d}:{},...c.length>0?{dependsOn:c}:{},...null!==h&&h.length>0?{strategy:h}:{},...e.hasAttribute(Cn)?{boundary:!0}:{}}}},En=class{constructor(e){wt(this,\\\"serverURL\\\");wt(this,\\\"apiRoute\\\");wt(this,\\\"depth\\\");wt(this,\\\"fetchFn\\\");wt(this,\\\"log\\\");wt(this,\\\"inflight\\\",null);wt(this,\\\"attempt\\\",0);wt(this,\\\"destroyDepth\\\",0);this.serverURL=e.serverURL.replace(/\\\\/+$/,\\\"\\\");let i=e.apiRoute??\\\"/api\\\";this.apiRoute=i.startsWith(\\\"/\\\")?i:`/${i}`,this.depth=e.depth??1,this.fetchFn=e.fetchFn,this.log=void 0===e.log?n:t(e.log)}canMerge(e){try{return e.globalSlug?M(e.globalSlug):!!M(e.collectionSlug)&&function(e){if(\\\"number\\\"==typeof e)return Number.isFinite(e);if(\\\"string\\\"!=typeof e||0===e.length||e.length>512||\\\".\\\"===e||\\\"..\\\"===e||e.includes(\\\"/\\\")||e.includes(\\\"\\\\\\\\\\\")||N(e))return!1;try{return encodeURIComponent(e),!0}catch{return!1}}(e.data.id)}catch{return!1}}async merge(e){if(this.destroyDepth>0)return{status:\\\"superseded\\\"};let t=this.attempt+=1,n=this.inflight;this.inflight=null;let i=null,r=()=>this.attempt!==t;try{if(n?.abort(),r())return{status:\\\"superseded\\\"};if(!this.canMerge(e))return r()?{status:\\\"superseded\\\"}:{status:\\\"unavailable\\\"};let t=this.fetchFn??(\\\"function\\\"==typeof fetch?fetch:void 0);if(void 0===t)return{status:\\\"unavailable\\\"};i=new AbortController,this.inflight=i;let l=e.globalSlug?`globals/${encodeURIComponent(e.globalSlug)}`:`${encodeURIComponent(e.collectionSlug??\\\"\\\")}/${encodeURIComponent(String(e.data.id))}`,o=`${this.serverURL}${this.apiRoute}/${l}`,a=await t(o,{method:\\\"POST\\\",credentials:\\\"include\\\",headers:{\\\"Content-Type\\\":\\\"application/json\\\",\\\"X-Payload-HTTP-Method-Override\\\":\\\"GET\\\"},body:JSON.stringify({data:e.data,depth:this.depth,flattenLocales:!1,...void 0!==e.locale?{locale:e.locale}:{}}),signal:i.signal});if(r()||x(i.signal))return{status:\\\"superseded\\\"};if(!a.ok)return this.log(\\\"merge HTTP\\\",a.status,o),{status:\\\"unavailable\\\"};let s=await a.json();return r()||x(i.signal)?{status:\\\"superseded\\\"}:null===s||\\\"object\\\"!=typeof s||Array.isArray(s)?(this.log(\\\"merge invalid\\\",o),{status:\\\"unavailable\\\"}):{status:\\\"merged\\\",doc:s}}catch(e){return r()||null!==i&&x(i.signal)?{status:\\\"superseded\\\"}:(this.log(\\\"merge exception\\\",e),{status:\\\"unavailable\\\"})}finally{null!==i&&!r()&&this.inflight===i&&(this.inflight=null)}}destroy(){this.attempt+=1;let e=this.inflight;this.inflight=null,this.destroyDepth+=1;try{e?.abort()}finally{this.destroyDepth-=1}}},In=\\\"2.0.0-beta.0\\\",Ln={name:\\\"payload-2\\\",fieldTyping:\\\"schema\\\",populatesRelationships:\\\"admin\\\",documentEvents:!1},On={name:\\\"payload-3\\\",fieldTyping:\\\"heuristic\\\",populatesRelationships:\\\"server\\\",documentEvents:!0},Un={name:\\\"unknown\\\",fieldTyping:\\\"heuristic\\\",populatesRelationships:\\\"server\\\",documentEvents:!1},Pn=[\\\"data\\\",\\\"fieldSchemaJSON\\\",\\\"globalSlug\\\",\\\"collectionSlug\\\",\\\"locale\\\",\\\"ready\\\",\\\"previewToken\\\",\\\"protocolVersion\\\"],jn=class{constructor(e,t){wt(this,\\\"matcher\\\");wt(this,\\\"handlers\\\");wt(this,\\\"boundListener\\\");wt(this,\\\"attachedTarget\\\");wt(this,\\\"generation\\\",0);wt(this,\\\"revision\\\",0);wt(this,\\\"queue\\\",[]);wt(this,\\\"queueHead\\\",0);this.matcher=e,this.handlers=t}attach(e=window){if(void 0!==this.attachedTarget)return;let t=!1,n=e=>{if(!t||this.boundListener!==n)return;let i=this.generation;try{this.receive(e,i)}catch{let t;try{t=e.origin}catch{t=\\\"\\\"}this.reportInvalid(\\\"shape\\\",t,i)}};this.generation+=1,this.resetQueue(),this.attachedTarget=e,this.boundListener=n;try{e.addEventListener(\\\"message\\\",n)}catch(t){this.boundListener===n&&(this.attachedTarget=void 0,this.boundListener=void 0,this.resetQueue());try{e.removeEventListener(\\\"message\\\",n)}catch{}throw t}if(this.boundListener===n)t=!0;else try{e.removeEventListener(\\\"message\\\",n)}catch{}}detach(){let e=this.attachedTarget,t=this.boundListener;void 0===e||void 0===t||(this.attachedTarget=void 0,this.boundListener=void 0,this.resetQueue(),e.removeEventListener(\\\"message\\\",t))}advanceGeneration(){return void 0!==this.attachedTarget&&(this.generation+=1,this.resetQueue(),!0)}static sendReady(e,t){if(0===e.length||0===t.length)return;let n={type:\\\"payload-live-preview\\\",ready:!0,protocolVersion:4};for(let i of e)for(let e of t)try{i.postMessage(n,e)}catch{}}receive(e,t){if(!this.isCurrentGeneration(t))return;let n=e.origin;if(!this.matchesOrigin(n,t)){this.reportInvalid(\\\"origin\\\",n,t);return}if(!this.matchesSource(e)){this.reportInvalid(\\\"source\\\",n,t);return}let i=e.data;if(function(e){return\\\"object\\\"==typeof e&&null!==e&&\\\"type\\\"in e&&\\\"string\\\"==typeof e.type}(i))switch(i.type){case\\\"payload-live-preview\\\":if(!function(e){let t=e;return!(void 0!==t.data&&null!==t.data&&!O(t.data))&&L(t.fieldSchemaJSON,e=>Array.isArray(e))&&L(t.globalSlug,e=>\\\"string\\\"==typeof e)&&L(t.collectionSlug,e=>\\\"string\\\"==typeof e)&&L(t.locale,e=>\\\"string\\\"==typeof e)&&L(t.ready,e=>\\\"boolean\\\"==typeof e)&&L(t.previewToken,e=>\\\"string\\\"==typeof e)&&L(t.protocolVersion,e=>\\\"number\\\"==typeof e)}(i)){this.reportInvalid(\\\"shape\\\",n,t);return}this.dispatchUpdate(function(e){let t={...e};for(let e of Pn)null===Reflect.get(t,e)&&Reflect.deleteProperty(t,e);if(!Array.isArray(t.fieldSchemaJSON))return t;let n;try{n=l(t.fieldSchemaJSON)}catch{n=[]}return{...t,fieldSchemaJSON:n}}(i),n,t);return;case\\\"payload-document-event\\\":if(!function(e){let t=e;return I(t.action,e=>\\\"updated\\\"===e||\\\"created\\\"===e||\\\"deleted\\\"===e)&&I(t.slug,e=>\\\"string\\\"==typeof e)&&I(t.id,e=>\\\"string\\\"==typeof e||\\\"number\\\"==typeof e&&Number.isFinite(e))}(i)){this.reportInvalid(\\\"shape\\\",n,t);return}this.invokeHandler(t,this.handlers.onDocumentEvent,i,n);return;case\\\"payload-live-preview-focus\\\":{let e=function(e){let t=e.field;return\\\"string\\\"==typeof t&&t.length>0?t:void 0}(i);if(void 0===e){this.reportInvalid(\\\"shape\\\",n,t);return}let r=this.handlers.onFocusField;void 0!==r&&this.invokeHandler(t,r,e,n);return}default:this.reportInvalid(\\\"type\\\",n,t)}else this.reportInvalid(\\\"shape\\\",n,t)}dispatchUpdate(e,t,n){let i=O(e.data);if(!this.isCurrentGeneration(n))return;let r=i?{generation:n,revision:this.revision+=1}:void 0,l=this.handlers.validateToken;if(!this.isCurrentGeneration(n))return;if(void 0===l){this.commitUpdate(e,t,n,r);return}if(!0===e.ready&&void 0===e.data){this.commitUpdate(e,t,n,void 0);return}let o={generation:n,message:e,origin:t,messageRevision:r,settled:!1,approved:!1};this.queue.push(o);let a;try{a=l(e.previewToken,t)}catch{this.settleValidation(o,!1);return}\\\"boolean\\\"!=typeof a?Promise.resolve(a).then(e=>{this.settleValidation(o,!0===e)},()=>{this.settleValidation(o,!1)}):this.settleValidation(o,a)}settleValidation(e,t){this.isCurrentGeneration(e.generation)&&(e.approved=t,e.settled=!0,this.drainQueue(e.generation))}drainQueue(e){for(;this.isCurrentGeneration(e);){let t=this.queue[this.queueHead];if(void 0===t)return;if(this.matchesOrigin(t.origin,e)){if(!t.settled)return;this.dequeue(t)&&(t.approved?this.commitUpdate(t.message,t.origin,t.generation,t.messageRevision):this.reportInvalid(\\\"token\\\",t.origin,t.generation))}else{if(!this.dequeue(t))continue;this.reportInvalid(\\\"origin\\\",t.origin,t.generation)}}}commitUpdate(e,t,n,i){this.isCurrentGeneration(n)&&(void 0===i?this.invokeHandler(n,this.handlers.onUpdate,e,t):this.invokeHandler(n,this.handlers.onUpdate,e,t,i))}reportInvalid(e,t,n){if(!this.isCurrentGeneration(n))return;let i=this.handlers.onInvalid;void 0!==i&&this.invokeHandler(n,i,e,t)}matchesSource(e){if(\\\"parent-or-opener\\\"!==this.handlers.sourcePolicy)return!0;let t=this.attachedTarget;if(void 0===t)return!1;try{let n=e.source;if(null===n)return!1;let i=t.parent;if(i!==t&&n===i)return!0;let r=t.opener;return null!=r&&n===r}catch{return!1}}matchesOrigin(e,t){if(!this.isCurrentGeneration(t))return!1;try{return!0===this.matcher(e)&&this.isCurrentGeneration(t)}catch{return!1}}invokeHandler(t,n,...i){if(this.isCurrentGeneration(t))try{e(n(...i))}catch{}}isCurrentGeneration(e){return void 0!==this.attachedTarget&&this.generation===e}dequeue(e){return this.queue[this.queueHead]===e&&(this.queueHead+=1,this.queueHead===this.queue.length?(this.resetQueue(),!0):(this.queueHead>=1024&&2*this.queueHead>=this.queue.length&&(this.queue=this.queue.slice(this.queueHead),this.queueHead=0),!0))}resetQueue(){this.queue=[],this.queueHead=0}},Wn=1,Dn=class{constructor(e,t={}){wt(this,\\\"callbacks\\\");wt(this,\\\"debounceMs\\\");wt(this,\\\"rootMargin\\\");wt(this,\\\"visible\\\",new Set);wt(this,\\\"mutation\\\",null);wt(this,\\\"intersection\\\",null);wt(this,\\\"debounceTimer\\\",null);wt(this,\\\"generation\\\",0);this.callbacks=e,this.debounceMs=t.mutationDebounceMs??100,this.rootMargin=t.intersectionRootMargin??\\\"200px\\\"}start(e){let t=this.generation;this.stop();let n=t+1;if(this.generation!==n)return;let i=null,r=null;try{i=new MutationObserver(e=>{this.handleMutations(e,n)}),r=new IntersectionObserver(e=>{this.handleIntersection(e,n)},{rootMargin:this.rootMargin,threshold:0}),i.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...$n]})}catch(e){throw i?.disconnect(),r?.disconnect(),e}this.generation===n?(this.mutation=i,this.intersection=r):(i.disconnect(),r.disconnect())}observeElement(e){this.intersection?.observe(e)}unobserveElement(e){this.intersection?.unobserve(e),this.visible.delete(e)}markVisible(e,t){t?this.visible.add(e):this.visible.delete(e)}isVisible(e){return this.visible.has(e)}stop(){this.generation+=1;let e=this.debounceTimer,t=this.mutation,n=this.intersection;this.debounceTimer=null,this.mutation=null,this.intersection=null,this.visible.clear(),null!==e&&clearTimeout(e);try{t?.disconnect()}finally{n?.disconnect()}}handleMutations(e,t){if(!this.isCurrentGeneration(t)||!function(e){for(let t of e){if(\\\"attributes\\\"===t.type&&null!==t.attributeName&&$n.includes(t.attributeName)&&(t.attributeName===un||t.attributeName===kn||t.target.nodeType===Wn&&t.target.hasAttribute(un)))return!0;for(let e of t.addedNodes)if(U(e))return!0;for(let e of t.removedNodes)if(U(e))return!0}return!1}(e))return;null!==this.debounceTimer&&clearTimeout(this.debounceTimer);let n=setTimeout(()=>{!this.isCurrentGeneration(t)||this.debounceTimer!==n||(this.debounceTimer=null,this.callbacks.onStructuralChange())},this.debounceMs);this.debounceTimer=n}handleIntersection(e,t){for(let n of e){if(!this.isCurrentGeneration(t))return;let{target:e}=n;if(n.isIntersecting){if(this.visible.has(e))continue;this.visible.add(e),this.callbacks.onVisibilityChange(e,!0)}else this.visible.has(e)&&(this.visible.delete(e),this.callbacks.onVisibilityChange(e,!1))}}isCurrentGeneration(e){return this.generation===e&&null!==this.intersection}},Vn=class{constructor(e){wt(this,\\\"timeoutMs\\\");wt(this,\\\"onTimeout\\\");wt(this,\\\"handle\\\",null);wt(this,\\\"lastKick\\\",0);this.timeoutMs=e.timeoutMs??0,this.onTimeout=e.onTimeout}kick(){if(this.lastKick=Date.now(),this.timeoutMs<=0)return;null!==this.handle&&clearTimeout(this.handle);let e=setTimeout(()=>{this.handle===e&&(this.handle=null,this.onTimeout())},this.timeoutMs);this.handle=e}stop(){null!==this.handle&&(clearTimeout(this.handle),this.handle=null)}get lastKickAt(){return this.lastKick}get pending(){return null!==this.handle}},Bn=class{constructor(){wt(this,\\\"current\\\",\\\"disconnected\\\")}get status(){return this.current}markConnected(){return this.transition(\\\"connected\\\")}markDisconnected(){return this.transition(\\\"disconnected\\\")}transition(e){return this.current!==e&&(this.current=e,!0)}},_n=new Set([\\\"__proto__\\\",\\\"prototype\\\",\\\"constructor\\\"]),Hn=new Set([\\\"id\\\",\\\"_id\\\",\\\"createdAt\\\",\\\"updatedAt\\\",\\\"createdBy\\\",\\\"updatedBy\\\",\\\"_status\\\",\\\"globalType\\\",\\\"collection\\\",\\\"locale\\\",\\\"localized\\\"]),zn=\\\"payload-live-preview\\\",Gn=\\\"data-payload-owned\\\",qn=new Set([\\\"open\\\",\\\"value\\\",\\\"checked\\\",\\\"selected\\\"]),Jn=new Set([\\\"p\\\",\\\"br\\\",\\\"strong\\\",\\\"b\\\",\\\"em\\\",\\\"i\\\",\\\"u\\\",\\\"s\\\",\\\"strike\\\",\\\"mark\\\",\\\"small\\\",\\\"h1\\\",\\\"h2\\\",\\\"h3\\\",\\\"h4\\\",\\\"h5\\\",\\\"h6\\\",\\\"ul\\\",\\\"ol\\\",\\\"li\\\",\\\"dl\\\",\\\"dt\\\",\\\"dd\\\",\\\"blockquote\\\",\\\"code\\\",\\\"pre\\\",\\\"kbd\\\",\\\"samp\\\",\\\"var\\\",\\\"a\\\",\\\"span\\\",\\\"div\\\",\\\"section\\\",\\\"article\\\",\\\"aside\\\",\\\"header\\\",\\\"footer\\\",\\\"nav\\\",\\\"figure\\\",\\\"figcaption\\\",\\\"img\\\",\\\"picture\\\",\\\"source\\\",\\\"audio\\\",\\\"video\\\",\\\"sub\\\",\\\"sup\\\",\\\"hr\\\",\\\"time\\\",\\\"abbr\\\",\\\"cite\\\",\\\"q\\\",\\\"table\\\",\\\"thead\\\",\\\"tbody\\\",\\\"tfoot\\\",\\\"tr\\\",\\\"th\\\",\\\"td\\\",\\\"caption\\\",\\\"colgroup\\\",\\\"col\\\"]),Kn=new Set([\\\"input\\\",\\\"button\\\",\\\"textarea\\\",\\\"select\\\",\\\"option\\\",\\\"label\\\"]),Qn=new Set([\\\"script\\\",\\\"style\\\",\\\"iframe\\\",\\\"object\\\",\\\"embed\\\",\\\"link\\\",\\\"meta\\\",\\\"base\\\",\\\"form\\\",\\\"input\\\",\\\"button\\\",\\\"select\\\",\\\"textarea\\\",\\\"svg\\\",\\\"math\\\",\\\"template\\\",\\\"frame\\\",\\\"frameset\\\",\\\"noframes\\\",\\\"noscript\\\"]),Xn=new Set([\\\"id\\\",\\\"class\\\",\\\"lang\\\",\\\"dir\\\",\\\"title\\\",\\\"role\\\",\\\"tabindex\\\"]),Zn=\\\"aria-\\\",Yn=\\\"data-\\\",ei=\\\"data-payload-\\\",ti={a:new Set([\\\"href\\\",\\\"target\\\",\\\"rel\\\",\\\"download\\\",\\\"hreflang\\\",\\\"type\\\"]),img:new Set([\\\"src\\\",\\\"srcset\\\",\\\"sizes\\\",\\\"alt\\\",\\\"width\\\",\\\"height\\\",\\\"loading\\\",\\\"decoding\\\"]),picture:new Set([]),source:new Set([\\\"src\\\",\\\"srcset\\\",\\\"sizes\\\",\\\"type\\\",\\\"media\\\"]),audio:new Set([\\\"src\\\",\\\"controls\\\",\\\"autoplay\\\",\\\"loop\\\",\\\"muted\\\",\\\"preload\\\"]),video:new Set([\\\"src\\\",\\\"poster\\\",\\\"controls\\\",\\\"autoplay\\\",\\\"loop\\\",\\\"muted\\\",\\\"preload\\\",\\\"width\\\",\\\"height\\\",\\\"playsinline\\\"]),time:new Set([\\\"datetime\\\"]),abbr:new Set([\\\"title\\\"]),q:new Set([\\\"cite\\\"]),blockquote:new Set([\\\"cite\\\"]),table:new Set([\\\"summary\\\"]),th:new Set([\\\"colspan\\\",\\\"rowspan\\\",\\\"scope\\\",\\\"headers\\\",\\\"abbr\\\"]),td:new Set([\\\"colspan\\\",\\\"rowspan\\\",\\\"headers\\\"]),col:new Set([\\\"span\\\"]),colgroup:new Set([\\\"span\\\"]),ol:new Set([\\\"start\\\",\\\"reversed\\\",\\\"type\\\"]),li:new Set([\\\"value\\\"]),code:new Set([\\\"class\\\"]),pre:new Set([\\\"class\\\"])},ni=new Set([\\\"href\\\",\\\"src\\\",\\\"cite\\\",\\\"poster\\\"]),ii=1,ri=8,li=(Error,new Set([\\\"id\\\",\\\"name\\\",\\\"data-payload-key\\\",\\\"data-payload-nested-key\\\",\\\"data-payload-nested-template\\\"])),oi=\\\"strict\\\",ai=(Object.freeze({allowedTags:Jn,removeCompletely:Qn,globalAttributes:Xn,attributesByTag:ti,urlAttributes:ni}),Object.freeze({\\\"&\\\":\\\"&amp;\\\",\\\"<\\\":\\\"&lt;\\\",\\\">\\\":\\\"&gt;\\\",'\\\"':\\\"&quot;\\\",\\\"'\\\":\\\"&#x27;\\\",\\\"/\\\":\\\"&#x2F;\\\",\\\"`\\\":\\\"&#x60;\\\",\\\"=\\\":\\\"&#x3D;\\\"})),si=/[&<>\\\"'/`=]/g,ui=Object.freeze({\\\"&\\\":\\\"&amp;\\\",\\\"<\\\":\\\"&lt;\\\",\\\">\\\":\\\"&gt;\\\",'\\\"':\\\"&quot;\\\",\\\"'\\\":\\\"&#x27;\\\"}),di=/[&<>\\\"']/g,ci=/\\\\{\\\\{([\\\\s\\\\S]*?)\\\\}\\\\}/g,hi=[\\\"input\\\",\\\"textarea\\\",\\\"select\\\",\\\"option\\\",\\\"button\\\",\\\"label\\\",\\\"details\\\",\\\"summary\\\",\\\"dialog\\\",\\\"video\\\",\\\"audio\\\",\\\"progress\\\",\\\"meter\\\"],fi=[\\\"type\\\",\\\"name\\\",\\\"placeholder\\\",\\\"open\\\",\\\"disabled\\\",\\\"readonly\\\",\\\"required\\\",\\\"checked\\\",\\\"selected\\\",\\\"value\\\",\\\"min\\\",\\\"max\\\",\\\"step\\\",\\\"rows\\\",\\\"cols\\\",\\\"for\\\",\\\"controls\\\",\\\"muted\\\",\\\"loop\\\",\\\"poster\\\",\\\"src\\\"],pi=/<([a-z][a-z0-9]*(?:-[a-z0-9]+)+)\\\\b/gi,gi=new Map,mi=\\\"data-payload-key\\\",vi=\\\"data-payload-nested-key\\\",yi=\\\"data-payload-nested-template\\\",bi=class{constructor(e,t,n){wt(this,\\\"deps\\\",e);wt(this,\\\"state\\\",t);wt(this,\\\"host\\\",n)}planFragments(e){let t=this.deps.strategies.fragment;if(void 0===t)return null;let n=t.plan(this.deps.root,e),i=new Set(n);return{boundaries:n,strategy:t,covers:e=>void 0!==e.fragmentBoundary&&i.has(e.fragmentBoundary)}}hasRouteBinding(e){for(let[t,n]of this.deps.cache.entries())if(e.has(t)&&n.some(e=>\\\"route\\\"===e.strategyKind))return!0;return!1}async runFragments(e,t,n){let{deps:i,state:r}=this,l=new AbortController;r.fragmentController=l;let o=()=>r.isCurrent(e)&&!l.signal.aborted,{emitter:a}=i,{message:s}=e,u=e.identity.revision,d=e.receivedAt,c={root:i.root,revision:u,receivedAt:d,fields:t.fields,locale:e.locale,collectionSlug:\\\"string\\\"==typeof s.collectionSlug?s.collectionSlug:void 0,globalSlug:\\\"string\\\"==typeof s.globalSlug?s.globalSlug:void 0,signal:l.signal,isCurrent:o,log:(e,t)=>{i.log(\\\"fragment\\\",e,t)},morph:(e,t)=>{!function(e,t){let n=e.ownerDocument.createElement(\\\"template\\\");n.innerHTML=J(t);let i=e.cloneNode(!1);i.append(n.content),X(e,i,{keyAttributes:[mi]})}(e,t)},patch:n=>{this.patchFallback(e,t,n)},rendered:(t,n,i)=>{e.pendingFragments-=1,a.emitWhile(\\\"fragmentRender\\\",{element:t,id:n,key:i,status:\\\"rendered\\\",revision:u,receivedAt:d},o)},failed:(t,n,i,r,l)=>{e.pendingFragments-=1,a.emitWhile(\\\"error\\\",{error:new Error(`fragment \\\"${n}\\\" fell back to patch: ${l}`),context:\\\"fragment\\\",code:r},o),a.emitWhile(\\\"fragmentRender\\\",{element:t,id:n,key:i,status:\\\"failed\\\",code:r,revision:u,receivedAt:d},o)}},h={rendered:0,failed:0,superseded:0};try{h=await n.strategy.render(c,n.boundaries)}catch(r){if(i.log(\\\"fragment\\\",\\\"LP0801\\\",r),o()){for(let i of n.boundaries)this.patchFallback(e,t,i);h={rendered:0,failed:n.boundaries.length,superseded:0}}}r.fragmentStats.rendered+=h.rendered,r.fragmentStats.failed+=h.failed,r.fragmentStats.superseded+=h.superseded,o()&&(r.fragmentController===l&&(r.fragmentController=null),e.pendingFragments=0,0===i.scheduler.pendingCount&&r.complete(e),this.host.revealPending(e),o()&&(0===h.rendered||0===a.listenerCount(\\\"afterUpdate\\\")||a.emitWhile(\\\"afterUpdate\\\",{data:t,updatedCount:h.rendered,durationMs:Date.now()-d,revision:u,receivedAt:d,source:\\\"fragment\\\"},o)))}async refreshRoute(e,t,n){let{deps:i,state:r}=this,l=r.routeStats;if(e.routeRefreshed){l.loopStopped+=1,i.log(\\\"route\\\",\\\"LP0805\\\",`revision ${String(e.identity.revision)} asked for a second refresh`);return}e.routeRefreshed=!0;let o=new AbortController;r.routeController=o;let a,s=()=>r.isCurrent(e)&&!o.signal.aborted;try{a=await n.refresh({revision:e.identity.revision,receivedAt:e.receivedAt,signal:o.signal,isCurrent:s,log:(e,t)=>{i.log(\\\"route\\\",e,t)}})}catch(e){i.log(\\\"route\\\",\\\"LP0801\\\",e),a=\\\"failed\\\"}if(s()){if(r.routeController===o&&(r.routeController=null),\\\"refreshed\\\"===a){if(l.refreshes+=1,r.lastAppliedIdentity=new WeakMap,this.host.rebuildCache(),!s())return;this.host.reapply(e,t),i.emitter.listenerCount(\\\"afterUpdate\\\")>0&&i.emitter.emitWhile(\\\"afterUpdate\\\",{data:t,updatedCount:i.cache.elementCount,durationMs:Date.now()-e.receivedAt,revision:e.identity.revision,receivedAt:e.receivedAt,source:\\\"route\\\"},s);return}\\\"failed\\\"===a&&(l.failed+=1),this.host.reapply(e,t)}}warnFragmentFallback(e){this.state.warnedFragmentFallback||(this.state.warnedFragmentFallback=!0,this.deps.warn(`[live-preview] LP0806: \\\"${e.fieldName}\\\" asks for the fragment strategy but no handler is configured; patching instead`))}warnUnsupportedStrategy(e){this.state.warnedStrategy.has(e.element)||(this.state.warnedStrategy.add(e.element),this.deps.warn(`[live-preview] LP0407: \\\"${e.fieldName}\\\" asks for strategy \\\"${String(e.strategy)}\\\"; only patch, fragment and route exist`))}patchFallback(e,t,n){for(let[i,r]of this.deps.cache.entries())for(let l of r){if(l.fragmentBoundary!==n)continue;let r=B(t.fields,i,l.locale??e.locale,void 0!==l.locale);void 0!==r&&this.deps.scheduler.schedule({target:l,value:this.host.transform(l,r,t.fields,()=>!0),allFields:t.fields,identity:e.identity,data:t})}}},wi=class{constructor(e,t,n){wt(this,\\\"deps\\\",e);wt(this,\\\"state\\\",t);wt(this,\\\"strategies\\\");this.strategies=new bi(e,t,{reapply:(e,t)=>{this.scheduleAllFields(e,t)},transform:(e,t,n,i)=>this.transformForBinding(e,t,n,i),rebuildCache:n,revealPending:e=>{this.revealPending(e)}})}handleUpdate(e,t,n){let{deps:i,state:r}=this;if(i.heartbeat.kick(),r.protocol.observe(function(e){let t=[];return Array.isArray(e.fieldSchemaJSON)&&t.push(\\\"schema-json\\\"),\\\"string\\\"==typeof e.locale&&t.push(\\\"locale\\\"),\\\"string\\\"==typeof e.previewToken&&t.push(\\\"preview-token\\\"),\\\"object\\\"==typeof e.externallyUpdatedRelationship&&null!==e.externallyUpdatedRelationship&&t.push(\\\"relationship-events\\\"),t}(e),i.log),void 0===e.data){void 0!==e.protocolVersion&&r.protocol.applyVersion(e.protocolVersion,i.log);return}if(void 0===n)return;let l=e.externallyUpdatedRelationship,o=\\\"object\\\"==typeof l&&null!==l;o&&i.emitter.emit(\\\"relationshipUpdate\\\",{detail:l,timestamp:Date.now()}),\\\"string\\\"==typeof e.locale&&(r.locale=e.locale),Array.isArray(e.fieldSchemaJSON)&&(r.schema=e.fieldSchemaJSON,r.schemaIndex=a(e.fieldSchemaJSON));let s={identity:n,message:e,locale:r.locale,schema:r.schema,schemaIndex:r.schemaIndex,receivedAt:Date.now(),forceRender:o,touched:new Set,invalidated:new Set,revealTarget:void 0,revealIdentities:[],pendingFragments:0,routeRefreshed:!1,cancelled:!1,completed:!1},u=r.activeUpdate;r.abortStrategies(),null!==u&&!u.completed&&(r.supersededCount+=1),r.activeUpdate=s,i.scheduler.acceptRevision(n),r.updateCount+=1,(void 0===e.protocolVersion||(r.protocol.applyVersion(e.protocolVersion,i.log),r.isCurrent(s)))&&(i.connection.markConnected()&&(i.a11y?.announceConnected(),i.emitter.emit(\\\"connect\\\",{origin:t,timestamp:Date.now()}),!r.isCurrent(s)||(i.log(\\\"connection\\\",\\\"disconnected\\\",\\\"\\\\u2192\\\",\\\"connected\\\"),!r.isCurrent(s)))||this.processUpdate(s).catch(e=>{i.log(\\\"update failed:\\\",e)}))}async processUpdate(e){let{deps:t,state:n}=this,i=await this.resolveIncomingFields(e);if(null===i||!n.isCurrent(e))return;let{message:r}=e,l={fields:i,...void 0!==e.schema?{schema:e.schema}:{},...\\\"string\\\"==typeof r.globalSlug?{globalSlug:r.globalSlug}:{},...\\\"string\\\"==typeof r.collectionSlug?{collectionSlug:r.collectionSlug}:{},...void 0!==e.locale?{locale:e.locale}:{}};if(t.emitter.listenerCount(\\\"beforeUpdate\\\")>0&&(!await t.emitter.emitWhile(\\\"beforeUpdate\\\",{data:l,revision:e.identity.revision,receivedAt:e.receivedAt,source:\\\"patch\\\",cancel:()=>{e.cancelled=!0,t.scheduler.cancelRevision(e.identity)}},()=>!e.cancelled&&n.isCurrent(e))||e.cancelled||!n.isCurrent(e)))return;let o=w(t.dependencies,t.cache.dependencyMap()),a=n.changes.diff(i,o);e.invalidated=a.invalidated,e.touched=new Set([...a.changed,...a.invalidated]),this.scheduleAllFields(e,l)}async resolveIncomingFields(e){let{deps:t,state:n}=this,i=e.message.data??{};if(null===t.merger||\\\"admin\\\"===E(n.protocol.observed).populatesRelationships)return i;let{message:r}=e,l=await t.merger.merge({collectionSlug:r.collectionSlug,globalSlug:r.globalSlug,data:i,locale:e.locale});return n.isCurrent(e)?\\\"merged\\\"===l.status?l.doc:\\\"superseded\\\"===l.status?null:i:null}scheduleAllFields(e,t){let{deps:n,state:i}=this;if(!i.isCurrent(e))return;let r=()=>i.isCurrent(e),l=this.ownerKeysForUpdate(e,t.fields),{touched:o}=e,a=n.strategies.route;if(void 0!==a&&!e.routeRefreshed&&(a.plan(n.root,o)||this.strategies.hasRouteBinding(o))){this.strategies.refreshRoute(e,t,a);return}let s=this.strategies.planFragments(o),u=n.skipUnchanged,d=0;for(let[o,a]of n.cache.entries()){if(!r())return;for(let c of a){if(!1!==l&&!D(c.owner,l))continue;if(!0===s?.covers(c)){n.revealEditedField&&this.noteRevealCandidate(e,c,this.rawValue(e,c,t));continue}let a=c.strategyKind??C(c.element)??\\\"unknown\\\";if(\\\"unknown\\\"===a){this.strategies.warnUnsupportedStrategy(c);continue}\\\"fragment\\\"===a&&null===s&&this.strategies.warnFragmentFallback(c);let h=B(t.fields,o,c.locale??e.locale,void 0!==c.locale);if(void 0===h){i.absentFields.add(o);continue}if(this.noteRevealCandidate(e,c,h),!r())return;let f=this.transformForBinding(c,h,t.fields,r);if(!r())return;let p=u?Ce(c,f,t.fields,e.locale):void 0,g=i.lastAppliedIdentity.get(c.element);if(!e.forceRender&&n.skipUnchanged&&void 0!==p&&g===p&&!e.invalidated.has(o)){i.skippedUnchangedCount+=1;continue}let m={target:c,value:f,allFields:t.fields,identity:e.identity,data:t,valueIdentity:p};n.scheduler.schedule(m),d+=1}}(function(e,t,n,i){let{cache:r,warned:l,warn:o}=e;if(0===r.fieldCount||!1!==i&&!function(e,t){for(let n of e.values())if(D(n.owner,t))return!0;return!1}(r,i))return;let a;for(let[e,s]of Object.entries(t)){if(l.has(e)||Hn.has(e)||!G(s))continue;let t=q(e,n);H(r,e,i)||t!==e&&H(r,t,i)||(a??(a=z(r,i)),!a.has(e)&&(l.add(e),o(`[live-preview] LP0201: no <\\\\u2026 data-payload-field=\\\"${t}\\\"> for field \\\"${e}\\\"; render the anchor unconditionally so edits to an empty field have somewhere to land.`)))}})({cache:n.cache,warned:i.warnedOrphanFields,warn:n.warn},t.fields,e.locale,l),null!==s&&s.boundaries.length>0&&(e.pendingFragments=s.boundaries.length,this.strategies.runFragments(e,t,s)),0===d&&0===e.pendingFragments&&(i.complete(e),this.revealPending(e))}rawValue(e,t,n){return B(n.fields,t.fieldName,t.locale??e.locale,void 0!==t.locale)}noteRevealCandidate(e,t,n){let{deps:i,state:r}=this;if(!i.revealEditedField)return;let l=m(n);if(void 0===l)return;let o=`${t.owner??\\\"\\\"}\\\\0${t.locale??\\\"\\\"}\\\\0${t.fieldName}`,a=r.seenFieldIdentity.get(o);void 0!==a?a!==l&&(e.revealIdentities.push([o,l]),e.revealTarget??(e.revealTarget=t)):r.seenFieldIdentity.set(o,l)}ownerKeysForUpdate(e,t){let{deps:n,state:i}=this;if(!n.scopeBindingsByOwner)return!1;let{message:r}=e,l=function(e){if(W(e.globalSlug))return[P(e.globalSlug)];if(!W(e.collectionSlug))return null;let t=j(e.collectionSlug);return W(e.documentId)?[t,j(e.collectionSlug,e.documentId)]:[t]}({globalSlug:\\\"string\\\"==typeof r.globalSlug?r.globalSlug:void 0,collectionSlug:\\\"string\\\"==typeof r.collectionSlug?r.collectionSlug:void 0,documentId:V(t)});return null===l&&!i.warnedUnattributableMessage&&(i.warnedUnattributableMessage=!0,n.warn(\\\"[live-preview] LP0202: scopeBindingsByOwner: update names no document; nothing applied\\\")),l}transformForBinding(t,n,i,r){let l=this.deps.transformValue;if(void 0===l)return n;try{let o=l(t.fieldName,n,{element:t.element,allFields:i},r),a=e(o);if(!r())return n;if(a)throw new TypeError(`Transform for \\\"${t.fieldName}\\\" returned a thenable; transforms must be synchronous`);return o}catch(e){if(!r())return n;let t=e instanceof Error?e:new Error(String(e));return this.deps.emitter.emit(\\\"error\\\",{error:t,context:\\\"transform\\\",code:\\\"LP0602\\\"}),n}}onFlush(e){let{deps:t,state:n}=this;n.lastFlush=e,e.deferred>0&&!n.warnedVisibilityGate&&(n.warnedVisibilityGate=!0,t.warn(`[live-preview] LP0301: visibility gate held ${String(e.deferred)} off-screen update(s) until scrolled into view; see visibilityGateThreshold`));let{identity:i,data:r}=e;if(void 0===i)return;let l=n.activeUpdate;if(null===l||!n.isCurrent(l)||!b(l.identity,i))return;0===l.pendingFragments&&n.complete(l);let o=()=>n.isCurrent(l)&&b(l.identity,i);this.revealPending(l),o()&&(0===e.applied||void 0===r||(t.a11y?.announceUpdate(e.applied),o()&&(function(e,t){for(let n of e)n.dispatchEvent(new CustomEvent(\\\"payload-live-preview:update\\\",{detail:t,bubbles:!1}));e.length}(t.cache.islands,{fields:r.fields,revision:i.revision,receivedAt:l.receivedAt,locale:l.locale}),o()&&0!==t.emitter.listenerCount(\\\"afterUpdate\\\")&&t.emitter.emitWhile(\\\"afterUpdate\\\",{data:r,updatedCount:e.applied,durationMs:e.durationMs,revision:i.revision,receivedAt:l.receivedAt,source:\\\"patch\\\"},o))))}revealPending(e){for(let[t,n]of e.revealIdentities)this.state.seenFieldIdentity.set(t,n);e.revealIdentities=[];let t=e.revealTarget;if(void 0!==t){e.revealTarget=void 0;try{this.revealBinding(t)}catch(e){this.deps.log(\\\"reveal\\\",e)}}}revealField(e){let t=this.deps.cache.get(e)?.[0];return void 0===t?\\\"no-element\\\":this.revealBinding(t)}revealBinding(e){let{element:t}=e,n=t.ownerDocument.defaultView;if(null===n)return\\\"no-element\\\";let i=`${e.owner??\\\"\\\"} ${e.fieldName}`;return this.state.revealer.reveal(i,t,n)}},Si=class{constructor(e,t){wt(this,\\\"apply\\\");wt(this,\\\"debounceMs\\\");wt(this,\\\"maxWaitMs\\\");wt(this,\\\"isVisible\\\");wt(this,\\\"gateThresholdValue\\\");wt(this,\\\"gateDisabled\\\");wt(this,\\\"getCacheSize\\\");wt(this,\\\"onFlush\\\");wt(this,\\\"scheduleFrame\\\");wt(this,\\\"cancelFrame\\\");wt(this,\\\"pending\\\",new Map);wt(this,\\\"replay\\\",new Map);wt(this,\\\"activeFlushes\\\",new Set);wt(this,\\\"debounceTimer\\\",null);wt(this,\\\"debounceToken\\\",0);wt(this,\\\"deadlineTimer\\\",null);wt(this,\\\"frameHandle\\\",null);wt(this,\\\"frameToken\\\",0);wt(this,\\\"activeIdentity\\\",null);wt(this,\\\"activeRevisionCancelled\\\",!1);this.apply=e,this.debounceMs=t.debounceMs??50,this.maxWaitMs=t.maxWaitMs??4*this.debounceMs,this.isVisible=t.isVisible,this.gateThresholdValue=t.visibilityGateThreshold??50,this.gateDisabled=t.disableVisibilityGate??!1,this.getCacheSize=t.getCacheSize,this.onFlush=t.onFlush,this.scheduleFrame=t.scheduleFrame??(\\\"function\\\"==typeof requestAnimationFrame?requestAnimationFrame.bind(globalThis):e=>setTimeout(()=>{e(performance.now())},0)),this.cancelFrame=t.cancelFrame??(\\\"function\\\"==typeof cancelAnimationFrame?cancelAnimationFrame.bind(globalThis):e=>{clearTimeout(e)})}schedule(e){if(void 0!==e.identity&&(this.activeRevisionCancelled||!$e(e.identity,this.activeIdentity)))return;let t=this.pending.get(e.target.element);t?(t.value=e.value,t.allFields=e.allFields,t.identity=e.identity,t.data=e.data,t.valueIdentity=e.valueIdentity):this.pending.set(e.target.element,{target:e.target,value:e.value,allFields:e.allFields,identity:e.identity,data:e.data,valueIdentity:e.valueIdentity}),this.armDebounce()}acceptRevision(e){$e(e,this.activeIdentity)||null!==this.activeIdentity&&function(e,t){return e.generation!==t.generation?e.generation-t.generation:e.revision-t.revision}(e,this.activeIdentity)<0||(this.cancelScheduledWork(),this.clearWork(),this.activeIdentity=e,this.activeRevisionCancelled=!1)}cancelRevision(e){$e(e,this.activeIdentity)&&(this.cancelScheduledWork(),this.clearWork(),this.activeRevisionCancelled=!0)}flushNow(){return this.cancelScheduledWork(),this.flush()}notifyVisible(e){let t=this.replay.get(e);if(!t||(this.replay.delete(e),!this.isCurrent(t)))return;let n=performance.now(),i=this.didApply(t)?1:0;this.onFlush?.(this.statsFor(t,i,0,performance.now()-n,1===i?[t.target.fieldName]:[]))}retarget(e){this.retargetBuffer(this.pending,e),this.retargetBuffer(this.replay,e);for(let t of this.activeFlushes)this.retargetBuffer(t,e)}forget(e){this.pending.delete(e),this.replay.delete(e);for(let t of this.activeFlushes)t.delete(e)}destroy(){this.cancelScheduledWork(),this.clearWork(),this.activeIdentity=null,this.activeRevisionCancelled=!1}get pendingCount(){return this.pending.size}get replayCount(){return this.replay.size}get gateThreshold(){return this.gateThresholdValue}get gateActive(){return!this.gateDisabled&&this.getCacheSize()>this.gateThresholdValue}armDebounce(){let e=this.debounceToken+=1,t=this.debounceTimer;if(this.debounceTimer=null,null!==t&&clearTimeout(t),this.debounceToken!==e)return;let n=setTimeout(()=>{this.debounceToken===e&&(this.debounceTimer=null,this.requestFrame())},this.debounceMs);this.debounceToken===e&&(this.debounceTimer=n),null===this.deadlineTimer&&this.maxWaitMs>this.debounceMs&&(this.deadlineTimer=setTimeout(()=>{this.deadlineTimer=null,this.pending.size>0&&this.requestFrame()},this.maxWaitMs))}requestFrame(){let e=this.frameToken+=1,t=this.frameHandle;if(this.frameHandle=null,null!==t&&this.cancelFrame(t),this.frameToken!==e)return;let n=!1,i=this.scheduleFrame(()=>{this.frameToken===e&&(n=!0,this.frameHandle=null,this.flush())});!n&&this.frameToken===e&&(this.frameHandle=i)}flush(){let e=performance.now();this.clearDeadline();let t=this.gateActive,n=this.pending;this.pending=new Map;let i,r=0,l=[],o=0;this.activeFlushes.add(n);try{for(let e of n.values()){if(!this.isCurrent(e))continue;let n=!t||this.isVisible(e.target.element);if(this.isCurrent(e)){if(i??(i=e),!n){this.replay.set(e.target.element,e),o+=1;continue}this.replay.delete(e.target.element),this.didApply(e)&&(r+=1,l.push(e.target.fieldName))}}}finally{this.activeFlushes.delete(n)}let a=this.statsFor(i,r,o,performance.now()-e,l);return this.onFlush?.(a),a}isCurrent(e){return void 0===e.identity||!this.activeRevisionCancelled&&$e(e.identity,this.activeIdentity)}didApply(e){return!1!==this.apply(e)||!function(e){return Kt.has(e)}(this.apply)}retargetBuffer(e,t){let n=e.get(t.element);if(void 0!==n){if(n.target.fieldName!==t.fieldName||n.target.locale!==t.locale){e.delete(t.element);return}n.target=t}}clearWork(){this.pending.clear(),this.replay.clear();for(let e of this.activeFlushes)e.clear()}statsFor(e,t,n,i,r){return{applied:t,appliedFields:r,deferred:n,durationMs:i,...void 0!==e?.identity?{identity:e.identity}:{},...void 0!==e?.data?{data:e.data}:{}}}clearDeadline(){null!==this.deadlineTimer&&(clearTimeout(this.deadlineTimer),this.deadlineTimer=null)}cancelScheduledWork(){let e=this.debounceTimer,t=this.frameHandle;this.debounceToken+=1,this.frameToken+=1,this.debounceTimer=null,this.frameHandle=null,this.clearDeadline(),null!==e&&clearTimeout(e),null!==t&&this.cancelFrame(t)}},ki=[0,500,1e3,2e3],Ti=class{constructor(e){wt(this,\\\"deps\\\");wt(this,\\\"state\\\",new nn);wt(this,\\\"pipeline\\\");wt(this,\\\"writer\\\");wt(this,\\\"rootSentinel\\\",null);wt(this,\\\"observedRoot\\\",null);let{emitter:i,renderers:r}=e,l=void 0===e.log?n:t(e.log),o=void 0===e.warn?Ft:t(e.warn),a=e.root??(typeof document<\\\"u\\\"?document:null),s=new xn({filter:e=>!function(e){let t=e;for(;null!==t;){if(k(t)&&!T(t))return!0;t=t.parentElement}return!1}(e)}),u=new Dn({onStructuralChange:()=>{this.rebuildCache()},onVisibilityChange:(e,t)=>{t&&d.notifyVisible(e)}},void 0!==e.intersectionRootMargin?{intersectionRootMargin:e.intersectionRootMargin}:{}),d=new Si(g(e=>this.writer.apply(e)),{...void 0!==e.debounceMs?{debounceMs:e.debounceMs}:{},...void 0!==e.disableVisibilityGate?{disableVisibilityGate:e.disableVisibilityGate}:{},...void 0!==e.visibilityGateThreshold?{visibilityGateThreshold:e.visibilityGateThreshold}:{},isVisible:e=>u.isVisible(e),getCacheSize:()=>s.elementCount,onFlush:e=>{this.pipeline.onFlush(e)}}),c=new jn(e.originMatcher,{onUpdate:(e,t,n)=>{this.pipeline.handleUpdate(e,t,n)},onDocumentEvent:()=>{this.state.protocol.observe([\\\"document-events\\\"],l),i.emit(\\\"documentSave\\\",{timestamp:Date.now()})},onFocusField:e=>{this.deps.revealEditedField&&this.pipeline.revealField(e)},onInvalid:(e,t)=>{if(\\\"token\\\"===e){let e=new Error(`Preview token rejected (origin: ${t})`);i.emit(\\\"error\\\",{error:e,context:\\\"token\\\",code:\\\"LP0502\\\"})}l(\\\"LP0501 message rejected:\\\",e,t)},...void 0!==e.validateToken?{validateToken:e.validateToken}:{},...void 0!==e.eventSourcePolicy?{sourcePolicy:e.eventSourcePolicy}:{}}),h=e.dataMerge;this.deps={emitter:i,cache:s,observers:u,scheduler:d,bus:c,connection:new Bn,heartbeat:new Vn({...void 0!==e.heartbeatMs?{timeoutMs:e.heartbeatMs}:{},onTimeout:()=>{this.onHeartbeatTimeout()}}),renderers:r,resolveRenderer:e.resolveRenderer??(e=>r[e]),transformValue:e.transformValue,renderRichText:e.renderRichText,root:a,readyTargets:\\\"function\\\"==typeof e.readyTargets?e.readyTargets:(e=>()=>e)(e.readyTargets),sendReady:e.sendReady??Me,onHeartbeatTimeout:e.onHeartbeatTimeout,log:l,warn:o,a11y:Fe(e),merger:void 0===h?null:new En({serverURL:h.serverURL,...void 0!==h.apiRoute?{apiRoute:h.apiRoute}:{},...void 0!==h.depth?{depth:h.depth}:{},...void 0!==h.fetchFn?{fetchFn:h.fetchFn}:{},log:l}),scopeBindingsByOwner:!0===e.scopeBindingsByOwner,lockedOrigin:e.lockedOrigin??(()=>{}),skipUnchanged:!0===e.skipUnchanged,dependencies:e.dependencies??{},strategies:e.strategies??{},revealEditedField:!0===e.revealEditedField},this.writer=new rn(this.deps,this.state),this.pipeline=new wi(this.deps,this.state,()=>{this.rebuildCache()})}start(){let{state:e,deps:t}=this;if(e.isRunning())return!1;if(e.started=!0,e.suspended=!1,Re(t.root)&&\\\"loading\\\"===t.root.readyState){let n=()=>{if(e.isRunning()){e.deferredStart=null;try{this.startNow()}catch(e){this.rollbackFailedStart(),this.reportError(e,\\\"startup\\\",\\\"LP0605\\\")}}};e.deferredStart=n;try{t.root.addEventListener(\\\"DOMContentLoaded\\\",n,{once:!0})}catch(e){throw this.rollbackFailedStart(),e}return!0}try{return this.startNow(),!0}catch(e){throw this.rollbackFailedStart(),e}}startNow(){let{state:e,deps:t}=this;if(!e.isRunning())return;let n=Re(t.root)?Ne(t.root):t.root;if(null===n)throw new Error(\\\"LivePreviewRuntime: document.body unavailable\\\");if(t.observers.start(n),this.observedRoot=n,this.watchRootReplacement(),this.buildCacheAndObserve(),e.isRunning()&&(t.bus.attach(),t.emitter.emitWhile(\\\"init\\\",{timestamp:Date.now()},()=>e.isRunning()),e.isRunning()))for(let n of ki){if(!e.isRunning())return;0===n?t.sendReady(t.readyTargets()):e.readyTimers.push(setTimeout(()=>{e.isRunning()&&this.sendReadyAfterStart()},n))}}suspend(){if(!this.state.isRunning())return!1;let e=this.release();return this.state.suspended=!0,e&&this.deps.emitter.emit(\\\"disconnect\\\",{reason:\\\"unload\\\",timestamp:Date.now()}),!0}destroy(){let{state:e,deps:t}=this;if(!e.isRunning()&&!e.suspended)return;let n=!!e.isRunning()&&this.release();e.suspended=!1,n&&t.emitter.emit(\\\"disconnect\\\",{reason:\\\"destroy\\\",timestamp:Date.now()}),t.a11y?.detach(),t.emitter.emit(\\\"destroy\\\",{timestamp:Date.now()})}release(){let{state:e,deps:t}=this;e.activeUpdate=null,e.started=!1;let n=e.deferredStart;e.deferredStart=null,null!==n&&Re(t.root)&&this.runCleanup(()=>{t.root.removeEventListener(\\\"DOMContentLoaded\\\",n)});for(let t of e.readyTimers)this.runCleanup(()=>{clearTimeout(t)});return e.readyTimers.length=0,this.runCleanup(()=>{t.heartbeat.stop()}),this.runCleanup(()=>{t.bus.detach()}),e.abortStrategies(),this.runCleanup(()=>{this.rootSentinel?.disconnect(),this.rootSentinel=null,this.observedRoot=null}),this.runCleanup(()=>{t.observers.stop()}),this.runCleanup(()=>{t.scheduler.destroy()}),this.runCleanup(()=>{t.merger?.destroy()}),t.cache.clear(),t.connection.markDisconnected()}rollbackFailedStart(){this.release(),this.runCleanup(()=>{this.deps.a11y?.detach()})}runCleanup(e){try{e()}catch(e){this.deps.log(\\\"cleanup failed:\\\",e)}}refreshCache(){this.state.isRunning()&&(this.state.revealer.reset(),this.followReplacedRoot()||this.rebuildCache())}watchRootReplacement(){let{root:e}=this.deps;!Re(e)||typeof MutationObserver>\\\"u\\\"||(this.rootSentinel?.disconnect(),this.rootSentinel=new MutationObserver(()=>{this.followReplacedRoot()}),this.rootSentinel.observe(e.documentElement,{childList:!0}))}followReplacedRoot(){let{root:e}=this.deps;if(!this.state.isRunning()||!Re(e))return!1;let t=Ne(e);return null!==t&&t!==this.observedRoot&&(this.observedRoot=t,this.deps.observers.start(t),this.rebuildCache(),!0)}get status(){return this.deps.connection.status}get cache(){return this.deps.cache}get updateCount(){return this.state.updateCount}get protocol(){return this.state.protocol.negotiation}inspect(){return function(e,t){let{cache:n,scheduler:i}=e,r=t.protocol.negotiation,l=t.activeUpdate,o=t.lastFlush,a=[],s=new Set;for(let[e,t]of n.entries()){a.push(e);for(let e of t)void 0!==e.owner&&s.add(e.owner)}return{version:In,started:t.started,status:e.connection.status,origins:{trusted:[...e.readyTargets()],locked:e.lockedOrigin()},protocol:{ours:r.ours,theirs:r.theirs,negotiated:r.negotiated,capabilities:[...r.capabilities].sort(),observed:[...r.observed].sort(),profile:E(r.observed).name},revisions:{accepted:t.updateCount,superseded:t.supersededCount,completed:t.completedCount,skippedUnchanged:t.skippedUnchangedCount,active:null===l?void 0:l.identity.revision},bindings:{elements:n.elementCount,fields:n.fieldCount,fieldNames:a.sort(),absentFields:[...t.absentFields].sort(),orphanFields:[...t.warnedOrphanFields].sort(),ownerScoped:e.scopeBindingsByOwner,owners:[...s].sort()},route:{handler:void 0!==e.strategies.route,...t.routeStats},fragments:{handler:void 0!==e.strategies.fragment,inFlight:l?.pendingFragments??0,...t.fragmentStats},scheduler:{pending:i.pendingCount,deferred:i.replayCount,visibilityGateThreshold:i.gateThreshold,visibilityGateActive:i.gateActive,lastFlush:null===o?void 0:{applied:o.applied,appliedFields:o.appliedFields,deferred:o.deferred,durationMs:o.durationMs}},plugins:[],renderers:Object.keys(e.renderers).sort()}}(this.deps,this.state)}buildCacheAndObserve(){let{state:e,deps:t}=this;if(!e.isRunning())return;let n=t.cache.buildFromRoot(t.root);if(t.log(\\\"cache\\\",n),e.isRunning()&&(t.emitter.emitWhile(\\\"cacheRefresh\\\",n,()=>e.isRunning()),e.isRunning()))for(let n of t.cache.values()){if(!e.isRunning())return;t.observers.observeElement(n.element)}}rebuildCache(){let{state:e,deps:t}=this;if(!e.isRunning())return;let n=new Map;for(let e of t.cache.values())n.set(e.element,e),t.observers.unobserveElement(e.element);if(this.buildCacheAndObserve(),e.isRunning()){for(let e of t.cache.values())n.get(e.element)?.fieldName===e.fieldName?t.scheduler.retarget(e):t.scheduler.forget(e.element),n.delete(e.element);for(let e of n.values())t.scheduler.forget(e.element)}}onHeartbeatTimeout(){let{state:e,deps:t}=this;if(!e.isRunning())return;t.bus.advanceGeneration();let n=e.activeUpdate;e.activeUpdate=null,null!==n&&t.scheduler.cancelRevision(n.identity),t.merger?.destroy();let i=t.connection.markDisconnected();try{t.onHeartbeatTimeout?.()}catch(e){t.log(\\\"heartbeat:\\\",e)}e.isRunning()&&(i&&this.isIdleDisconnected()&&(t.a11y?.announceDisconnected(),t.emitter.emitWhile(\\\"disconnect\\\",{reason:\\\"timeout\\\",timestamp:Date.now()},()=>this.isIdleDisconnected()),!e.isRunning()||(this.isIdleDisconnected()&&t.log(\\\"connection\\\",\\\"connected\\\",\\\"\\\\u2192\\\",\\\"disconnected\\\"),!e.isRunning()))||this.sendReadyAfterStart())}sendReadyAfterStart(){try{this.deps.sendReady(this.deps.readyTargets())}catch(e){this.reportError(e,\\\"ready\\\",\\\"LP0606\\\")}}reportError(e,t,n){let i=e instanceof Error?e:new Error(String(e));this.deps.emitter.emit(\\\"error\\\",{error:i,context:t,code:n})}isIdleDisconnected(){return this.state.isRunning()&&\\\"disconnected\\\"===this.deps.connection.status&&null===this.state.activeUpdate}},Ai=/^https?:\\\\/\\\\/(localhost|127\\\\.0\\\\.0\\\\.1)(?::\\\\d+)?$/i,Ci=/^https?:\\\\/\\\\/[^/?#\\\\s]+$/i,$i=[3e3,3001,3333,4e3,4321,5e3,5173,5174,8e3,8080,8888,9e3],Fi=class{constructor(e={}){Tt(this,Ri);let t=new Set;for(let n of e.additionalOrigins??[]){let e=Ee(n);void 0!==e&&t.add(e)}let n;if(e.enableReferrerDetection??1){let t=e.referrer??(typeof document<\\\"u\\\"?document.referrer:\\\"\\\");if(t.length>0)try{let e=new URL(t).origin;e&&\\\"null\\\"!==e&&(n=e)}catch{}}let i=(e.enableLocalhostMatching??!0)&&(e.forceDevMode??function(){let e=function(){if(!(typeof process>\\\"u\\\"))return\\\"production\\\"}();if(void 0!==e)return\\\"production\\\"!==e;if(typeof window<\\\"u\\\"){let e=window.location.hostname;return\\\"localhost\\\"===e||\\\"127.0.0.1\\\"===e}return!1}());At(this,Ri,[t,n,i,void 0!==n,void 0])}matches(e){return 0!==e.length&&\\\"null\\\"!==e&&(void 0!==kt(this,Ri)[4]?e===kt(this,Ri)[4]:!!(kt(this,Ri)[0].has(e)||0===kt(this,Ri)[0].size&&void 0!==kt(this,Ri)[1]&&e===kt(this,Ri)[1]||kt(this,Ri)[2]&&Ai.test(e)))}lockOrigin(e){return!!this.matches(e)&&(kt(this,Ri)[4]=e,!0)}unlockOrigin(){let e=kt(this,Ri)[4];return kt(this,Ri)[4]=void 0,e}get lockedOrigin(){return kt(this,Ri)[4]}enumerate(){if(void 0!==kt(this,Ri)[4])return[kt(this,Ri)[4]];let e=new Set(kt(this,Ri)[0]);if(0===kt(this,Ri)[0].size&&void 0!==kt(this,Ri)[1]&&e.add(kt(this,Ri)[1]),kt(this,Ri)[2])for(let t of $i)e.add(`http://localhost:${String(t)}`),e.add(`http://127.0.0.1:${String(t)}`);return[...e]}get referrerWasAvailable(){return kt(this,Ri)[3]}get isProductionUnconfigured(){return!(!xe()||kt(this,Ri)[0].size>0||kt(this,Ri)[2]||void 0!==kt(this,Ri)[1])}get isReferrerOnlyTrust(){return!(kt(this,Ri)[0].size>0||kt(this,Ri)[2])&&void 0!==kt(this,Ri)[1]}},Ri=new WeakMap,Ni={1:\\\"left\\\",2:\\\"center\\\",3:\\\"right\\\",4:\\\"justify\\\"},Mi=new Set([\\\"left\\\",\\\"center\\\",\\\"right\\\",\\\"justify\\\",\\\"start\\\",\\\"end\\\"]),xi=new Set([\\\"h1\\\",\\\"h2\\\",\\\"h3\\\",\\\"h4\\\",\\\"h5\\\",\\\"h6\\\"]),Ei=' target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\"',Ii=(e,t)=>{let n=t.renderChildren(e.children??[]),i=Pe(e.fields),r=function(e,t){if(\\\"internal\\\"===t?.linkType)return function(e){let t=Pe(Pe(e)?.value),n=t?.url;if(\\\"string\\\"==typeof n&&n.length>0)return n;let i=t?.slug;return\\\"string\\\"==typeof i&&i.length>0?`/${i}`:void 0}(t.doc);let n=t?.url??e.url;return\\\"string\\\"==typeof n&&n.length>0?n:void 0}(e,i);if(void 0===r||!f(r))return n;let l=\\\"string\\\"==typeof e.title?` title=\\\"${oe(e.title)}\\\"`:\\\"\\\";return`<a href=\\\"${ae(r)}\\\"${function(e,t,n){if(!0===t?.newTab||p(n))return Ei;let i=\\\"string\\\"==typeof e.target?e.target:\\\"\\\";return\\\"\\\"===i?\\\"\\\":\\\"_blank\\\"===i?Ei:` target=\\\"${oe(i)}\\\"`}(e,i,r)}${l}>${n}</a>`},Li=new Map,Oi={text:e=>{let t=oe(\\\"string\\\"==typeof e.text?e.text:\\\"\\\"),n=\\\"number\\\"==typeof e.format?e.format:0;return!!(16&n)&&(t=`<code>${t}</code>`),!!(1&n)&&(t=`<strong>${t}</strong>`),!!(2&n)&&(t=`<em>${t}</em>`),!!(8&n)&&(t=`<u>${t}</u>`),!!(4&n)&&(t=`<s>${t}</s>`),!!(32&n)&&(t=`<sub>${t}</sub>`),!!(64&n)&&(t=`<sup>${t}</sup>`),!!(128&n)&&(t=`<mark>${t}</mark>`),t},paragraph:(e,t)=>{let n=t.renderChildren(e.children??[]);return`<p${Oe(e)}${Ue(e)}>${n}</p>`},heading:(e,t)=>{let n=\\\"string\\\"==typeof e.tag?e.tag.toLowerCase():\\\"h2\\\",i=xi.has(n)?n:\\\"h2\\\",r=t.renderChildren(e.children??[]);return`<${i}${Oe(e)}${Ue(e)}>${r}</${i}>`},list:(e,t)=>{let n=\\\"string\\\"==typeof e.listType?e.listType:\\\"bullet\\\",i=\\\"number\\\"===n?\\\"ol\\\":\\\"ul\\\",r=\\\"number\\\"===n&&\\\"number\\\"==typeof e.start&&e.start>1?` start=\\\"${String(e.start)}\\\"`:\\\"\\\",l=\\\"check\\\"===n?' role=\\\"list\\\"':\\\"\\\",o=t.renderChildren(e.children??[]);return`<${i}${Oe(e)}${Ue(e)}${r}${l}>${o}</${i}>`},listitem:(e,t)=>{let n=t.renderChildren(e.children??[]);if(\\\"boolean\\\"==typeof e.checked)return`<li role=\\\"checkbox\\\" aria-checked=\\\"${e.checked?\\\"true\\\":\\\"false\\\"}\\\"${Ue(e)}>${n}</li>`;let i=\\\"number\\\"==typeof e.value?` value=\\\"${oe(String(e.value))}\\\"`:\\\"\\\";return`<li${Oe(e)}${Ue(e)}${i}>${n}</li>`},link:Ii,autolink:Ii,quote:(e,t)=>{let n=t.renderChildren(e.children??[]);return`<blockquote${Oe(e)}${Ue(e)}>${n}</blockquote>`},code:e=>{let t=We(\\\"string\\\"==typeof e.language?e.language:\\\"\\\");return`<pre><code${\\\"\\\"===t?\\\"\\\":` class=\\\"language-${t}\\\"`}>${oe(Be(e))}</code></pre>`},\\\"code-highlight\\\":e=>{let t=\\\"string\\\"==typeof e.text?e.text:\\\"\\\";return`<span${\\\"string\\\"==typeof e.highlightType?` class=\\\"token-${We(e.highlightType)}\\\"`:\\\"\\\"}>${oe(t)}</span>`},linebreak:()=>\\\"<br>\\\",horizontalrule:()=>\\\"<hr>\\\",tab:()=>\\\"\\\\t\\\",upload:e=>{let t=je(e.value);if(void 0===t)return\\\"\\\";let n=t.url;if(\\\"string\\\"!=typeof n||!f(n))return\\\"\\\";let i=\\\"string\\\"==typeof t.mimeType?t.mimeType:\\\"\\\";return i.startsWith(\\\"video/\\\")?function(e,t){return`<video controls${_e(e)}><source src=\\\"${ae(t)}\\\"${He(e)}></video>`}(t,n):i.startsWith(\\\"audio/\\\")?function(e,t){return`<audio controls><source src=\\\"${ae(t)}\\\"${He(e)}></audio>`}(t,n):\\\"\\\"===i||i.startsWith(\\\"image/\\\")?function(e,t){let n=\\\"string\\\"==typeof e.alt?oe(e.alt):\\\"\\\";return`<img src=\\\"${ae(t)}\\\" alt=\\\"${n}\\\"${_e(e)} loading=\\\"lazy\\\" decoding=\\\"async\\\">`}(t,n):function(e,t){let n=\\\"string\\\"==typeof e.filename?oe(e.filename):oe(t);return`<a href=\\\"${ae(t)}\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">${n}</a>`}(t,n)},relationship:e=>{let t=\\\"string\\\"==typeof e.relationTo?e.relationTo:\\\"\\\",n=Pe(e.value),i=oe((n&&Ve(n))??`#${t}`),r=We(t),l=\\\"\\\"===r?' class=\\\"lp-relation\\\"':` class=\\\"lp-relation lp-relation--${r}\\\"`,o=n?.url;return\\\"string\\\"==typeof o&&f(o)?`<a href=\\\"${ae(o)}\\\"${l}>${i}</a>`:`<span${l}>${i}</span>`},block:(e,t)=>Ge(e,t,\\\"div\\\",\\\"lp-block\\\"),inlineBlock:(e,t)=>Ge(e,t,\\\"span\\\",\\\"lp-inline-block\\\"),table:(e,t)=>`<table${Oe(e)}><tbody>${t.renderChildren(e.children??[])}</tbody></table>`,tablerow:(e,t)=>`<tr>${t.renderChildren(e.children??[])}</tr>`,tablecell:(e,t)=>{let n=\\\"number\\\"==typeof e.headerState?e.headerState:0,i=3&n?\\\"th\\\":\\\"td\\\";return`<${i}${1===n?' scope=\\\"col\\\"':2===n?' scope=\\\"row\\\"':\\\"\\\"}${qe(\\\"colspan\\\",e.colSpan)}${qe(\\\"rowspan\\\",e.rowSpan)}>${t.renderChildren(e.children??[])}</${i}>`}},Ui=new Map,Pi={renderChildren:Ke,resolveAlignment:Ie,resolveIndent:Le},ji=!1,Wi=\\\"data-payload-text\\\",Di={name:\\\"richText\\\",render:g((e,t,n)=>{let i=e.element;if(de(t))i.textContent=\\\"\\\";else{if(void 0!==n.renderRichText){let r=n.renderRichText(t,{fieldName:e.fieldName,element:i,locale:n.locale});i.innerHTML=J(te(r));return}if(Je(t))i.innerHTML=J(function(e,t={}){if(!Je(e))return\\\"\\\";let n=Ke(e.root.children);return!1===t.sanitize?n:void 0!==ne()?te(n):(function(){if(!ji){ji=!0;try{console.warn(\\\"[live-preview] lexicalToHtml() has no sanitizer document and returned unsanitised HTML; call setSanitizerDocument() (linkedom/jsdom) for server rendering, see docs/security.md \\\\xa73.\\\")}catch{}}}(),n)}(t));else{if(\\\"string\\\"!=typeof t)return!1;i.innerHTML=J(te(t))}}})},Vi={name:\\\"html\\\",render(e,t){if(de(t)){e.element.textContent=\\\"\\\";return}let n=\\\"string\\\"==typeof t?t:ue(t);e.element.innerHTML=J(te(n))}},Bi=new WeakSet,_i=et(\\\"url\\\"),Hi=/^[a-zA-Z][a-zA-Z0-9+.-]*:/,zi=et(\\\"email\\\",function(e){let t=e.trim();return Hi.test(t)||!t.includes(\\\"@\\\")?t:`mailto:${t}`}),Gi=[\\\"src\\\",\\\"srcset\\\",\\\"sizes\\\"],qi={name:\\\"image\\\",render:g((e,t,n)=>{let i=e.element;if(de(t)){rt(i);return}let r=void 0!==e.locale,{media:l,candidate:o}=function(e,t,n,i){let r=void 0!==e.srcField&&e.srcField.length>0?B(n.allFields,e.srcField,n.locale,i):t,l=je(r);return{media:l,candidate:void 0===l?r:l.url}}(e,t,n,r),a=Ye(i,e.fieldName,o);if(\\\"none\\\"===a.kind)return!1;if(\\\"unsafe\\\"!==a.kind){if(\\\"IMG\\\"===i.tagName){let t=i;nt(t,a.url,l);let o=function(e,t,n,i,r){if(void 0!==t&&t.length>0){let e=B(n,t,i,r);return\\\"string\\\"==typeof e?e:void 0}return e?.alt}(l,e.altField,n.allFields,n.locale,r);void 0!==o&&(t.alt=o);return}i.style.backgroundImage=`url('${function(e){return e.replace(/['\\\"()\\\\\\\\]/g,\\\"\\\\\\\\$&\\\")}(a.url)}')`}else rt(i)})},Ji={name:\\\"upload\\\",render:g((e,t)=>{let n=e.element;if(de(t)){lt(n);return}let i=je(t);if(void 0===i)return!1;let r=Ye(n,e.fieldName,i.url);if(\\\"none\\\"===r.kind)return!1;if(\\\"unsafe\\\"===r.kind){lt(n);return}let l=r.url;if(\\\"IMG\\\"===n.tagName){let e=n;nt(e,l,i),void 0!==i.alt&&(e.alt=i.alt);return}if(\\\"A\\\"===n.tagName){n.setAttribute(\\\"href\\\",l),n.textContent=i.filename??l;return}let o=oe(i.filename??l);n.innerHTML=J(`<a href=\\\"${ae(l)}\\\">${o}</a>`)})},Ki={name:\\\"relationship\\\",render(e,t){let n=e.element;if(de(t))n.removeAttribute(\\\"href\\\"),n.textContent=\\\"\\\";else{if(\\\"A\\\"===n.tagName&&!Array.isArray(t)){let i=Ye(n,e.fieldName,Pe(t)?.url);\\\"safe\\\"===i.kind?n.setAttribute(\\\"href\\\",i.url):\\\"unsafe\\\"===i.kind&&n.removeAttribute(\\\"href\\\")}n.textContent=Array.isArray(t)?t.map(ot).join(\\\", \\\"):ot(t)}}},Qi={name:\\\"select\\\",render(e,t,n){let i=e.element,r=de(t)?[]:function(e){return Array.isArray(e)?e.map(ue):[ue(e)]}(t);if(\\\"SELECT\\\"!==i.tagName){if(\\\"INPUT\\\"===i.tagName&&\\\"radio\\\"===i.type){let e=i;e.checked=r.includes(e.value);return}i.textContent=r.map(e=>function(e,t){let n=t.schema?.options;if(!Array.isArray(n))return e;for(let t of n){let n=Pe(t);if(void 0!==n&&ue(n.value)===e)return\\\"string\\\"==typeof n.label?n.label:e}return e}(e,n)).join(\\\", \\\")}else!function(e,t){if(e.multiple)for(let n of Array.from(e.options))n.selected=t.includes(n.value);else e.value=t[0]??\\\"\\\"}(i,r)}},Xi=new Set([\\\"\\\",\\\"false\\\",\\\"0\\\",\\\"off\\\",\\\"no\\\"]),Zi={name:\\\"checkbox\\\",render(e,t){let n=e.element,i=function(e){return\\\"boolean\\\"==typeof e?e:\\\"string\\\"==typeof e?!Xi.has(e.trim().toLowerCase()):\\\"number\\\"==typeof e?0!==e:null!=e}(t);\\\"INPUT\\\"!==n.tagName||\\\"checkbox\\\"!==n.type?n.hasAttribute(\\\"aria-checked\\\")?n.setAttribute(\\\"aria-checked\\\",i?\\\"true\\\":\\\"false\\\"):n.textContent=i?\\\"true\\\":\\\"false\\\":n.checked=i}},Yi=new Map,er=new Map,tr=64,nr={name:\\\"date\\\",render(e,t,n){let r=e.element;if(de(t)){\\\"INPUT\\\"===r.tagName?r.value=\\\"\\\":(r.removeAttribute(\\\"datetime\\\"),r.textContent=\\\"\\\");return}let l=\\\"number\\\"==typeof t?t:ue(t),o=new Date(l),a=!Number.isNaN(o.getTime()),s=String(l);\\\"INPUT\\\"!==r.tagName?(\\\"TIME\\\"===r.tagName&&r.setAttribute(\\\"datetime\\\",a?o.toISOString():s),r.textContent=a?function(e,t){let n=t.locale??i();try{return function(e,t){let n=at(e,t),i=er.get(n);if(void 0!==i)return er.delete(n),er.set(n,i),i;let r=new Intl.DateTimeFormat(e,t);return er.set(n,r),ut(er),r}(n,{dateStyle:\\\"medium\\\",timeStyle:\\\"short\\\"}).format(e)}catch{return e.toISOString()}}(o,n):s):r.value=a?function(e,t){let n=`${String(t.getFullYear()).padStart(4,\\\"0\\\")}-${dt(t.getMonth()+1)}-${dt(t.getDate())}`,i=`${dt(t.getHours())}:${dt(t.getMinutes())}`;return\\\"date\\\"===e?n:\\\"datetime-local\\\"===e?`${n}T${i}`:\\\"time\\\"===e?i:t.toISOString()}(r.type,o):s}},ir={name:\\\"number\\\",render(e,t,n){let r=e.element;if(de(t)){\\\"INPUT\\\"===r.tagName?r.value=\\\"\\\":r.textContent=\\\"\\\";return}let l=\\\"number\\\"==typeof t?t:Number(ue(t));Number.isNaN(l)?r.textContent=ue(t):\\\"INPUT\\\"!==r.tagName?r.textContent=function(e,t){let n=t.locale??i();try{return function(e,t){let n=at(e,t),i=Yi.get(n);if(void 0!==i)return Yi.delete(n),Yi.set(n,i),i;let r=new Intl.NumberFormat(e,t);return Yi.set(n,r),ut(Yi),r}(n).format(e)}catch{return String(e)}}(l,n):r.value=String(l)}},rr={name:\\\"array\\\",render:g((e,t)=>{let n=e.element;if(de(t)){n.textContent=\\\"\\\";return}if(!Array.isArray(t))return!1;let i=e.arrayTemplate;if(void 0!==i&&i.length>0){let e=function(e,t){let n=\\\"\\\";for(let i=0;i<t.length;i+=1)n+=se(e,t[i],i,ue);return n}(i,t);n.innerHTML=J(te(e,ce(i)));return}n.textContent=t.map(ue).join(e.arraySeparator??\\\", \\\")})},lr=new Map;!function(){if(typeof window>\\\"u\\\"||!xe()&&(typeof window>\\\"u\\\"||null==window.opener))return;let e=window.__livePreview,t=JSON.stringify(mt());if(void 0!==e&&(void 0===e.configSignature||e.configSignature===t))return e.refresh(),e;let[n=[],i=\\\"\\\",r=\\\"/api\\\",l=1,o=!1,a=50,s=!0,u=0,d=!1,c=50,h=\\\"200px\\\",f=!0,p=!1,g=!1,m=!0,v=\\\"parent-or-opener\\\",y=\\\"strict\\\",b,w=!1]=mt(),S=typeof __LIVE_PREVIEW_FRAGMENT__<\\\"u\\\"&&\\\"string\\\"==typeof b&&b.length>0?{fragment:__LIVE_PREVIEW_FRAGMENT__.createFragmentStrategy({endpoint:b}),route:__LIVE_PREVIEW_FRAGMENT__.createRouteStrategy()}:void 0;!function(e){oi=e}(y);let k=new Fi({additionalOrigins:n,enableReferrerDetection:!f,enableLocalhostMatching:!p});k.isProductionUnconfigured?Ft(\\\"[live-preview] LP0101: No trusted origin. Pass allowedOrigins to generateInlineScript() (or to the adapter) \\\\u2014 the runtime reads no environment variable in the browser.\\\"):k.isReferrerOnlyTrust&&Ft(\\\"[live-preview] LP0102: document.referrer fallback trusts any framing site. Set allowedOrigins and a frame-ancestors CSP in production.\\\");let T=new Nt,A=function(){let e=[Di,Vi,_i,zi,qi,Ji,Ki,Qi,{...Qi,name:\\\"radio\\\"},Zi,nr,ir,rr,{...rr,name:\\\"blocks\\\"}];return function(e=[]){let t={};for(let n of e)t[n.name]=n;for(let[e,n]of lr)t[e]=n;return Object.freeze(t)}([Ze(\\\"text\\\"),Ze(\\\"textarea\\\"),...e,ct()])}(),C=new Ti({renderers:A,originMatcher:e=>k.matches(e),lockedOrigin:()=>k.lockedOrigin,readyTargets:()=>k.enumerate(),emitter:T,eventSourcePolicy:v,...\\\"\\\"!==i?{dataMerge:{serverURL:i,apiRoute:r,depth:l}}:{},debounceMs:a,heartbeatMs:u,intersectionRootMargin:h,disableVisibilityGate:d,visibilityGateThreshold:c,enableA11y:s,scopeBindingsByOwner:g,skipUnchanged:m,revealEditedField:w,...void 0!==S?{strategies:S}:{},onHeartbeatTimeout:()=>{k.unlockOrigin()},...o?{log:(...e)=>{Rt(\\\"[live-preview]\\\",...e)}}:{}});T.on(\\\"connect\\\",e=>{k.lockOrigin(e.origin)}),C.start(),e?.destroy();let $=function(e,t={}){let n=t.windowTarget??globalThis.window,i=t.documentTarget??globalThis.document,r=t.softNavigationEvents??[],l=()=>{e.suspend()},o=t=>{!0===t.persisted&&e.resume()},a=()=>{e.refreshCache()};n?.addEventListener(\\\"pagehide\\\",l),n?.addEventListener(\\\"pageshow\\\",o);for(let e of r)i?.addEventListener(e,a);let s=!1;return()=>{if(!s){s=!0,n?.removeEventListener(\\\"pagehide\\\",l),n?.removeEventListener(\\\"pageshow\\\",o);for(let e of r)i?.removeEventListener(e,a)}}}({suspend:()=>C.suspend(),resume:()=>C.start(),refreshCache:()=>{C.refreshCache()}}),F=Object.freeze({version:In,configSignature:t,destroy:()=>{$(),C.destroy();let e=window;e.__livePreview===F&&delete e.__livePreview},refresh:()=>{C.refreshCache()},enumerateOrigins:()=>k.enumerate(),inspect:()=>C.inspect()});try{Object.defineProperty(window,\\\"__livePreview\\\",{value:F,writable:!1,configurable:!0})}catch(e){throw $(),C.destroy(),e}}()})();\";\nexport const RUNTIME_CONTENT_HASH = \"1185dfbfe640ed73\";\nexport const RUNTIME_INTEGRITY = \"sha384-I9LyG2ZEhry95cbM0dFAWbkM9q9GaWoapFEJ00ko1Xzv+rrGIl0X/yUSu1QLDOI+\";\nexport const RUNTIME_BUILD_INFO: RuntimeBuildInfo = { generatedAt: \"2026-09-04T21:17:52.000Z\", size: 93041 };\n","// Auto-generated by scripts/build-runtime.ts — do not edit.\nexport const FRAGMENT_SOURCE = \"\\\"use strict\\\";var __LIVE_PREVIEW_FRAGMENT__=(()=>{var N=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var Z=Object.prototype.hasOwnProperty;var ee=(e,n)=>{for(var t in n)N(e,t,{get:n[t],enumerable:!0})},ne=(e,n,t,o)=>{if(n&&typeof n==\\\"object\\\"||typeof n==\\\"function\\\")for(let r of Q(n))!Z.call(e,r)&&r!==t&&N(e,r,{get:()=>n[r],enumerable:!(o=J(n,r))||o.enumerable});return e};var te=e=>ne(N({},\\\"__esModule\\\",{value:!0}),e);var De={};ee(De,{createFragmentStrategy:()=>z,createRouteStrategy:()=>X});var R=\\\"data-payload-island\\\",Pe=`astro-island, [${R}]`;function re(e){return e.tagName.toLowerCase()===\\\"astro-island\\\"||e.hasAttribute(R)}function oe(e){return e.getAttribute(R)===\\\"patch\\\"}function _(e){let n=e;for(;n!==null;){if(re(n)&&!oe(n))return!0;n=n.parentElement}return!1}function w(e){if(e==null)return[];let n=new Set,t=[];for(let o of e.split(/[\\\\s,]+/)){let r=o.trim();r.length===0||n.has(r)||(n.add(r),t.push(r))}return t}var b=\\\"data-payload-fragment\\\";var D=\\\"data-payload-fragment-key\\\",ae=\\\"data-payload-depends\\\";function M(e){let n=e.getAttribute(b);if(n===null||n.length===0)return null;let t=e.getAttribute(D);return{element:e,id:n,key:t===null||t.length===0?void 0:t,dependsOn:w(e.getAttribute(ae))}}function L(e,n){let t=[];for(let o of e.querySelectorAll(`[${b}]`)){let r=M(o);r===null||_(o)||r.dependsOn.length>0&&!r.dependsOn.some(a=>n.has(a))||t.push(r)}return t}var B=\\\"x-payload-fragment-version\\\";function v(e){return typeof e==\\\"object\\\"&&e!==null&&!Array.isArray(e)}function C(e){if(!v(e))return null;let{html:n,boundary:t,revision:o,metadata:r}=e;return typeof n!=\\\"string\\\"||!v(t)||typeof t.id!=\\\"string\\\"||t.key!==void 0&&typeof t.key!=\\\"string\\\"||typeof o!=\\\"number\\\"||!v(r)||typeof r.renderedAt!=\\\"string\\\"||typeof r.renderer!=\\\"string\\\"?null:e}function U(e){let n={};for(let[t,o]of Object.entries(e))o!==void 0&&(n[t]=o);return n}function H(e){let n=0,t=[],o=()=>{let r=t.shift();r===void 0?n-=1:r()};return async r=>{n<e?n+=1:await new Promise(a=>{t.push(a)});try{return await r()}finally{o()}}}var le=5e3,se=4,de=512*1024,A={status:\\\"superseded\\\"};function h(e,n){return{status:\\\"failed\\\",code:e,reason:n}}function ue(e){return e instanceof Error?e.message:String(e)}function ce(e){let n=()=>{throw new TypeError('createFragmentStrategy: endpoint must be a same-origin path starting with \\\"/\\\"')};if((typeof e!=\\\"string\\\"||!e.startsWith(\\\"/\\\")||e.startsWith(\\\"//\\\")||e.includes(\\\"\\\\\\\\\\\"))&&n(),typeof location<\\\"u\\\"){let t;try{t=new URL(e,location.href)}catch{t=void 0}t?.origin!==location.origin&&n()}return e}function fe(e){return typeof e==\\\"object\\\"&&e!==null&&typeof e.getReader==\\\"function\\\"}async function me(e,n,t){let o=e.body;if(!fe(o)){let s=await e.text();return new TextEncoder().encode(s).byteLength>n?null:s}let r=o.getReader(),a=()=>{r.cancel().catch(()=>{})};t.addEventListener(\\\"abort\\\",a,{once:!0});let l=new TextDecoder,i=\\\"\\\",u=0;try{for(;;){let{done:s,value:y}=await r.read();if(s)break;if(u+=y.byteLength,u>n)return a(),null;i+=l.decode(y,{stream:!0})}}finally{t.removeEventListener(\\\"abort\\\",a)}return i+l.decode()}function K(e){let n=ce(e.endpoint),t=e.timeoutMs??le,o=e.maxResponseBytes??de,r=H(Math.max(1,e.maxConcurrent??se)),a=new Map;async function l(i,u){let s=()=>i.signal.aborted;if(s())return A;let y=e.location??location,m=U({fragment:u.id,key:u.key,route:y.pathname,search:y.search,revision:i.revision,locale:i.locale,collectionSlug:i.collectionSlug,globalSlug:i.globalSlug,fields:i.fields}),d=new AbortController,f=()=>{d.abort()};i.signal.addEventListener(\\\"abort\\\",f,{once:!0});let g={timedOut:!1},E=setTimeout(()=>{g.timedOut=!0,d.abort()},t),c=p=>s()?A:g.timedOut?h(\\\"LP0801\\\",`timeout after ${String(t)} ms`):h(\\\"LP0801\\\",ue(p));try{let p;try{p=await(e.fetch??fetch)(n,{method:\\\"POST\\\",credentials:\\\"same-origin\\\",headers:{...e.headers,accept:\\\"application/json\\\",\\\"content-type\\\":\\\"application/json\\\",[B]:String(1)},body:JSON.stringify(m),signal:d.signal})}catch(O){return c(O)}if(s())return A;if(p.status===401||p.status===403)return h(\\\"LP0803\\\",`endpoint refused the preview (${String(p.status)})`);if(!p.ok)return h(\\\"LP0801\\\",`endpoint answered ${String(p.status)}`);let T=p.headers.get(\\\"content-type\\\")??\\\"\\\";if(!T.toLowerCase().startsWith(\\\"application/json\\\"))return h(\\\"LP0802\\\",`unexpected content type \\\"${T}\\\"`);if(Number(p.headers.get(\\\"content-length\\\")??\\\"0\\\")>o)return h(\\\"LP0802\\\",\\\"response exceeds the size limit\\\");let k;try{k=await me(p,o,d.signal)}catch(O){return c(O)}if(s())return A;if(g.timedOut)return h(\\\"LP0801\\\",`timeout after ${String(t)} ms`);if(k===null)return h(\\\"LP0802\\\",\\\"response exceeds the size limit\\\");let I;try{I=JSON.parse(k)}catch{return h(\\\"LP0802\\\",\\\"response is not JSON\\\")}let S=C(I);return S===null?h(\\\"LP0802\\\",\\\"response has the wrong shape\\\"):S.boundary.id!==u.id?h(\\\"LP0802\\\",\\\"response is for another boundary\\\"):S.revision!==i.revision?A:{status:\\\"rendered\\\",html:S.html,metadata:S.metadata}}finally{clearTimeout(E),i.signal.removeEventListener(\\\"abort\\\",f)}}return(i,u)=>{let s=`${u.id} ${u.key??\\\"\\\"} ${String(i.revision)}`,y=a.get(s);if(y!==void 0)return y;let m=r(()=>l(i,u));a.set(s,m);let d=()=>{a.get(s)===m&&a.delete(s)};return m.then(d,d),m}}var F=\\\"data-payload-owned\\\",ye=new Set([\\\"open\\\",\\\"value\\\",\\\"checked\\\",\\\"selected\\\"]);function q(e,n){for(let t of n.keyAttributes){let o=e.getAttribute(t);if(o!==null&&o.length>0)return`${t}=${o}`}}function x(e){if(e.tagName.toLowerCase().includes(\\\"-\\\")||e.hasAttribute(R)||e.hasAttribute(F))return!0;let n=e.getAttribute(\\\"contenteditable\\\");return n!==null&&n!==\\\"false\\\"}function ge(e,n){return e.tagName===n.tagName&&e.namespaceURI===n.namespaceURI&&!x(e)&&!x(n)}function P(e,n,t){if(!ge(e,n))return n;let o=Se(e);return pe(e,n),t.retainChildrenOf?.(e,n)!==!0&&he(e,n,t),Re(o),e}function pe(e,n){for(let t of Array.from(e.attributes))n.hasAttribute(t.name)||ye.has(t.name.toLowerCase())||e.removeAttribute(t.name);for(let t of Array.from(n.attributes))e.getAttribute(t.name)!==t.value&&e.setAttribute(t.name,t.value)}function he(e,n,t){let o=be(e,t),r=new Set(o.values()),a=Array.from(e.childNodes).filter(m=>!r.has(m)),l=new Set,i=new Set,u=Array.from(n.childNodes),s=e.firstChild,y=0;for(let m=0;m<u.length;m+=1){let d=u[m],f=null,g=d instanceof Element?q(d,t):void 0;if(g!==void 0&&i.has(g)&&(g=void 0),g!==void 0){i.add(g);let c=o.get(g);if(c!==void 0&&!l.has(c)&&(f=$(c,d,t)===c?c:null,f===null)){c.replaceWith(d),l.add(d),s=d.nextSibling;continue}}else{for(;y<a.length;){let c=a[y];if(y+=1,!l.has(c)){if(G(c,d)){f=$(c,d,t)===c?c:null,f===null&&(e.replaceChild(d,c),l.add(d),s=d.nextSibling);break}if(c instanceof Element){let p=u[m+1];if(!(d instanceof Element)||p!==void 0&&G(c,p)){y-=1;break}e.replaceChild(d,c),l.add(d),s=d.nextSibling;break}if(!(d instanceof Element)){e.replaceChild(d,c),l.add(d),s=d.nextSibling;break}}}if(f===null&&l.has(d))continue}let E=f??d;for(l.add(E);s!==null&&s!==E&&!l.has(s)&&Ee(s);)s=s.nextSibling;E!==s&&e.insertBefore(E,s),s=E.nextSibling}for(let m of Array.from(e.childNodes))l.has(m)||m.remove()}function $(e,n,t){return e instanceof Element&&n instanceof Element?x(e)&&x(n)?e:P(e,n,t):(e.nodeValue!==n.nodeValue&&(e.nodeValue=n.nodeValue),e)}function Ee(e){return e.nodeType===Node.TEXT_NODE&&(e.nodeValue??\\\"\\\").trim().length===0}function G(e,n){return e.nodeType!==n.nodeType?!1:e instanceof Element&&n instanceof Element?e.tagName===n.tagName&&e.namespaceURI===n.namespaceURI:!0}function be(e,n){let t=new Map,o;for(let r of Array.from(e.children)){let a=q(r,n);if(a!==void 0){if(t.has(a)){o??(o=a.slice(a.indexOf(\\\"=\\\")+1));continue}t.set(a,r)}}return o!==void 0&&n.onDuplicateKey?.(e,o),t}function Se(e){let n=e.ownerDocument.activeElement;if(!(n instanceof HTMLElement)||!e.contains(n))return null;let t=n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement?[n.selectionStart,n.selectionEnd]:null;return{element:n,selection:t}}function Re(e){if(e===null)return;let{element:n,selection:t}=e;if(!(n.ownerDocument.activeElement===n||!n.isConnected))try{n.focus({preventScroll:!0});let[o,r]=t??[null,null];o!==null&&r!==null&&n.setSelectionRange(o,r)}catch{}}var V=\\\"data-payload-key\\\";var W=\\\"data-payload-strategy\\\",Y=\\\"data-payload-field\\\",Ae=\\\"data-payload-depends\\\",Te=\\\"x-payload-live-preview\\\",we=8e3,xe=1e3;function Fe(e){let n=e.getAttribute(W);return n!==null?n===\\\"route\\\":e.closest(\\\"head\\\")!==null}function ke(e){let n=e.getAttribute(Y),t=w(e.getAttribute(Ae));return n===null||n.length===0?t:[n,...t]}function j(e){if(e.tagName===\\\"META\\\"){let n=e.getAttribute(\\\"name\\\")??e.getAttribute(\\\"property\\\");return n===null?null:`meta:${n}`}return e.tagName===\\\"LINK\\\"&&e.getAttribute(\\\"rel\\\")===\\\"canonical\\\"?\\\"link:canonical\\\":null}function Oe(e,n){n.title!==e.title&&(e.title=n.title);let t=new Map;for(let r of e.head.querySelectorAll(\\\"meta, link\\\")){let a=j(r);a!==null&&!t.has(a)&&t.set(a,r)}let o=new Set;for(let r of n.head.querySelectorAll(\\\"meta, link\\\")){let a=j(r);if(a===null)continue;o.add(a);let l=t.get(a);if(l===void 0){e.head.append(e.importNode(r,!0));continue}if(!l.hasAttribute(F))for(let i of Array.from(r.attributes))l.getAttribute(i.name)!==i.value&&l.setAttribute(i.name,i.value)}for(let[r,a]of t)!o.has(r)&&!a.hasAttribute(F)&&a.remove()}function X(e={}){let n=e.timeoutMs??we,t=e.minIntervalMs??xe,o=-1/0;return{plan(r,a){for(let l of r.querySelectorAll(`[${Y}], [${W}=\\\"route\\\"]`)){if(!Fe(l))continue;let i=ke(l);if(i.length===0||i.some(u=>a.has(u)))return!0}return!1},async refresh(r){let a=Date.now();if(a-o<t)return r.log(\\\"LP0805\\\",`route refresh for revision ${String(r.revision)} refused: the previous one was ${String(a-o)} ms ago`),\\\"failed\\\";o=a;let l=e.document??document,i=e.location??location,u=e.window??window,s=new AbortController,y=()=>{s.abort()};r.signal.addEventListener(\\\"abort\\\",y,{once:!0});let m=setTimeout(()=>{s.abort()},n),d=f=>r.signal.aborted?\\\"superseded\\\":(r.log(\\\"LP0801\\\",f instanceof Error?f.message:String(f)),\\\"failed\\\");try{let f;try{f=await(e.fetch??fetch)(i.href,{method:\\\"GET\\\",credentials:\\\"same-origin\\\",cache:\\\"no-store\\\",headers:{accept:\\\"text/html\\\",[Te]:\\\"route\\\"},signal:s.signal})}catch(g){return d(g)}if(r.signal.aborted)return\\\"superseded\\\";if(!f.ok||!(f.headers.get(\\\"content-type\\\")??\\\"\\\").includes(\\\"text/html\\\"))return r.log(\\\"LP0802\\\",`route answered ${String(f.status)} ${f.headers.get(\\\"content-type\\\")??\\\"\\\"}`),\\\"failed\\\";try{let g=await f.text();if(!r.isCurrent())return\\\"superseded\\\";let E=new DOMParser().parseFromString(g,\\\"text/html\\\"),c=u.scrollX,p=u.scrollY;return Oe(l,E),P(l.body,E.body,{keyAttributes:[V,D,b],retainChildrenOf:T=>T.hasAttribute(b)}),u.scrollTo(c,p),\\\"refreshed\\\"}catch(g){return d(g)}}finally{clearTimeout(m),r.signal.removeEventListener(\\\"abort\\\",y)}}}}function Ne(e){return{plan:(n,t)=>L(n,t).map(o=>o.element),async render(n,t){let o={rendered:0,failed:0,superseded:0},r={revision:n.revision,receivedAt:n.receivedAt,fields:n.fields,locale:n.locale,collectionSlug:n.collectionSlug,globalSlug:n.globalSlug,signal:n.signal};return await Promise.all(t.map(async a=>{let l=M(a);if(l===null)return;let i;try{i=await e(r,l)}catch(u){i={status:\\\"failed\\\",code:\\\"LP0801\\\",reason:u instanceof Error?u.message:String(u)}}if(!n.isCurrent()||i.status===\\\"superseded\\\"){o.superseded+=1,n.log(\\\"LP0804\\\",`fragment \\\"${l.id}\\\" for revision ${String(r.revision)} discarded as superseded`);return}if(i.status===\\\"rendered\\\"){n.morph(a,i.html),n.rendered(a,l.id,l.key),o.rendered+=1;return}n.failed(a,l.id,l.key,i.code,i.reason),n.isCurrent()&&n.patch(a),o.failed+=1})),o}}}function z(e){return Ne(K(e))}return te(De);})();\";\n","/**\n * The inline script's configuration and its positional wire order: the\n * generator writes the tuple, `src/core/runtime.ts` destructures it, and\n * `INLINE_CONFIG_KEYS` is where they agree. Append only, never reorder.\n */\n\nimport type { DefaultsProfile } from '@core/defaults-profile';\n\nexport interface InlineScriptConfig {\n /** Trusted admin origins, merged with the detected ones. */\n readonly allowedOrigins?: readonly string[];\n /** Payload origin; every update is then re-fetched through the REST API with credentials. Requires `mergeDepth`. */\n readonly serverURL?: string;\n /** REST route prefix used with `serverURL`. Default `/api`. */\n readonly apiRoute?: string;\n /** Population depth used with `serverURL`. Required with `serverURL` unless `defaults: 'v1'`. */\n readonly mergeDepth?: number;\n /** Verbose console logging. Default `false`. */\n readonly debug?: boolean;\n /** Debounce window for incoming updates in ms. Default `50`. */\n readonly debounceMs?: number;\n /** Mount the screen-reader live region. Default `true`. */\n readonly enableA11y?: boolean;\n /** Heartbeat timeout in ms; `0` disables it (default), because the admin posts only on edits. */\n readonly heartbeatMs?: number;\n /** Apply every update regardless of viewport position. Default `false`. */\n readonly disableVisibilityGate?: boolean;\n /** Cache size above which off-screen updates wait for intersection. Default `50`. */\n readonly visibilityGateThreshold?: number;\n /** `rootMargin` of the IntersectionObserver. Default `'200px'`. */\n readonly intersectionRootMargin?: string;\n /** Ignore `document.referrer` as an origin source. Default `true`; `defaults: 'v1'` sets `false`. */\n readonly disableReferrerDetection?: boolean;\n /** Disable the dev-mode localhost matcher (any port on `localhost`/`127.0.0.1`). Default `false`. */\n readonly disableLocalhostMatching?: boolean;\n /** Update only bindings under a matching `data-payload-owner`. Default `false`. */\n readonly scopeBindingsByOwner?: boolean;\n /** Skip bindings whose value did not change. Default `true`; `defaults: 'v1'` sets `false`. */\n readonly skipUnchanged?: boolean;\n /** Scroll the preview to the field being edited. Default `false`. */\n readonly revealEditedField?: boolean;\n /** Which windows may post updates. Default `'parent-or-opener'`; `defaults: 'v1'` sets `'any'`. */\n readonly eventSourcePolicy?: 'any' | 'parent-or-opener';\n /** Sanitizer policy for rich text and HTML writes. Default `'strict'`; `defaults: 'v1'` sets `'compat'`. */\n readonly sanitizerPolicy?: 'compat' | 'strict';\n /** Same-origin path of a fragment endpoint; the script then carries the fragment client ahead of the runtime (ADR 0011). */\n readonly fragmentEndpoint?: string;\n /** Which defaults the omitted options fall back to. Not serialized: `'v1'` only relaxes the generator's `mergeDepth` check. */\n readonly defaults?: DefaultsProfile;\n}\n\n/** Keys that travel in the wire tuple, in slot order. */\nexport const INLINE_CONFIG_KEYS = [\n 'allowedOrigins',\n 'serverURL',\n 'apiRoute',\n 'mergeDepth',\n 'debug',\n 'debounceMs',\n 'enableA11y',\n 'heartbeatMs',\n 'disableVisibilityGate',\n 'visibilityGateThreshold',\n 'intersectionRootMargin',\n 'disableReferrerDetection',\n 'disableLocalhostMatching',\n 'scopeBindingsByOwner',\n 'skipUnchanged',\n 'eventSourcePolicy',\n 'sanitizerPolicy',\n 'fragmentEndpoint',\n 'revealEditedField',\n] as const satisfies readonly Exclude<keyof InlineScriptConfig, 'defaults'>[];\n","/**\n * Wraps the build-time runtime IIFE with the consumer's configuration; a page\n * with a fragment endpoint gets the fragment prelude ahead of it.\n */\n\nimport { RUNTIME_SOURCE, RUNTIME_BUILD_INFO, type RuntimeBuildInfo } from './runtime.generated';\nimport { FRAGMENT_SOURCE } from './fragment.generated';\nimport { LOADER_SOURCE } from './loader.generated';\nimport { INLINE_CONFIG_KEYS, type InlineScriptConfig } from '@/types/inline-config';\n\nexport type { InlineScriptConfig } from '@/types/inline-config';\n\nfunction assertBuilt(source: string, artifact: string): void {\n if (source.length === 0) {\n throw new Error(\n `[live-preview] ${artifact} is empty. Run \\`npm run build:runtime\\` before bundling.`,\n );\n }\n}\n\n/** The inline script body without `<script>` tags; see `wrapWithScriptTag()`. */\nexport function generateInlineScript(config: InlineScriptConfig = {}): string {\n assertBuilt(RUNTIME_SOURCE, 'runtime.generated.ts');\n return [configStatement(config), ...fragmentPrelude(config), RUNTIME_SOURCE].join('\\n');\n}\n\nfunction fragmentPrelude(config: InlineScriptConfig): readonly string[] {\n if (config.fragmentEndpoint == null) return [];\n assertBuilt(FRAGMENT_SOURCE, 'fragment.generated.ts');\n return [FRAGMENT_SOURCE];\n}\n\n// `__LIVE_PREVIEW_CONFIG__` is a public presence signal: consumers' integration\n// tests grep for it, so the name outlives any refactor.\nfunction configStatement(config: InlineScriptConfig): string {\n return `var __LIVE_PREVIEW_CONFIG__=${buildConfigLiteral(config)};`;\n}\n\n/** The positional wire literal the runtime destructures; shared by the inline script and the loader. */\nfunction buildConfigLiteral(config: InlineScriptConfig): string {\n if (config.defaults !== 'v1' && (config.serverURL ?? '') !== '' && config.mergeDepth == null) {\n throw new Error(\n 'payload-live-preview: `serverURL` needs an explicit `mergeDepth` under the 2.0 defaults — ' +\n \"choose the population depth deliberately (0 for none), or pass `defaults: 'v1'` to keep \" +\n 'the 1.x default of 1 while migrating (ADR 0007, entry 10).',\n );\n }\n // `null` counts as omitted, and omitted slots stay empty (`[,,1]`): a JSON\n // `null` would bypass the runtime's destructuring defaults.\n const values: unknown[] = INLINE_CONFIG_KEYS.map((key) => config[key] ?? undefined);\n while (values.length > 0 && values.at(-1) === undefined) values.pop();\n // `<` is escaped so a value containing `</script>` cannot end the tag.\n return `[${values\n .map((value) => (value === undefined ? '' : JSON.stringify(value)))\n .join(',')}]`.replace(/</g, '\\\\u003C');\n}\n\n/** Where the runtime asset lives, and how the browser should verify it. */\nexport interface LoaderScriptTarget {\n /** URL the bootstrap appends. Same-origin or absolute; hashed by the caller. */\n readonly runtimeSrc: string;\n /** Subresource-integrity value, e.g. `sha384-…`; empty drops the check and the `crossorigin` it requires. */\n readonly integrity?: string;\n}\n\n/**\n * The static-delivery bootstrap: the configuration plus a few hundred bytes\n * appending the runtime inside a preview. The asset stays configuration-free.\n */\nexport function generateLoaderScript(\n config: InlineScriptConfig = {},\n target: LoaderScriptTarget,\n): string {\n assertBuilt(LOADER_SOURCE, 'loader.generated.ts');\n if (target.runtimeSrc === '') {\n throw new Error('[live-preview] generateLoaderScript needs a runtimeSrc.');\n }\n const encode = (value: string): string => JSON.stringify(value).replace(/</gu, '\\\\u003C');\n return [\n configStatement(config),\n `var __LP_RUNTIME_SRC__=${encode(target.runtimeSrc)};`,\n `var __LP_RUNTIME_INTEGRITY__=${encode(target.integrity ?? '')};`,\n ...fragmentPrelude(config),\n LOADER_SOURCE,\n ].join('\\n');\n}\n\n/** Wrap a script body in `<script>`, with the CSP nonce attribute when given. */\nexport function wrapWithScriptTag(body: string, options: { nonce?: string } = {}): string {\n const nonceAttr = options.nonce !== undefined ? ` nonce=\"${escapeNonce(options.nonce)}\"` : '';\n return `<script${nonceAttr}>${body}</script>`;\n}\n\nexport function runtimeBuildInfo(): RuntimeBuildInfo {\n return RUNTIME_BUILD_INFO;\n}\n\nfunction escapeNonce(nonce: string): string {\n if (!/^[A-Za-z0-9+/=_-]+$/.test(nonce)) {\n throw new RangeError('wrapWithScriptTag: nonce contains invalid characters');\n }\n return nonce;\n}\n","/**\n * The two defaults profiles, row by row. 2.0 ships `v2`; `defaults: 'v1'` opts\n * back into the 1.x table for a staged migration. Each row belongs to exactly\n * one side — the adapter's request decision or the browser runtime — and a\n * test asserts the profile assigns every readiness row that has an option, so\n * a row added later cannot be forgotten. See ADR 0007.\n */\n\n/** `'v2'` is the 2.0 default; `'v1'` is the 1.x table. */\nexport type DefaultsProfile = 'v1' | 'v2';\n\n/** How the runtime decides which windows may post updates. */\nexport type EventSourcePolicy = 'any' | 'parent-or-opener';\n\n/** Readiness rows that are options, keyed by the option they set. */\nexport const READINESS_ROWS = Object.freeze({\n strict: 'production response changes require an authorized context',\n previewSignals: 'query-only intent signal',\n disableReferrerDetection: 'referrer trust off outside local dev',\n eventSourcePolicy: 'messages must come from parent/opener',\n skipUnchanged: 'skip unchanged bindings by default',\n sanitizerPolicy: 'hardened sanitizer id/data-* policy',\n} as const);\n\n/** Options an adapter's request decision reads from the profile. */\nexport interface AdapterProfileDefaults {\n readonly strict: boolean;\n readonly previewSignals: readonly ('query' | 'fetch-dest' | 'referer')[];\n}\n\n/** Options the browser runtime reads from the profile (through the inline configuration). */\nexport interface RuntimeProfileDefaults {\n readonly disableReferrerDetection: boolean;\n readonly eventSourcePolicy: EventSourcePolicy;\n readonly skipUnchanged: boolean;\n readonly sanitizerPolicy: 'compat' | 'strict';\n}\n\nexport const V2_ADAPTER_DEFAULTS: AdapterProfileDefaults = Object.freeze({\n strict: true,\n previewSignals: Object.freeze(['query'] as const),\n});\n\nexport const V2_RUNTIME_DEFAULTS: RuntimeProfileDefaults = Object.freeze({\n disableReferrerDetection: true,\n eventSourcePolicy: 'parent-or-opener',\n skipUnchanged: true,\n sanitizerPolicy: 'strict',\n});\n\n/** The 1.x table, spelled out so the profiles compare row by row. */\nexport const V1_ADAPTER_DEFAULTS: AdapterProfileDefaults = Object.freeze({\n strict: false,\n previewSignals: Object.freeze(['query', 'fetch-dest', 'referer'] as const),\n});\n\nexport const V1_RUNTIME_DEFAULTS: RuntimeProfileDefaults = Object.freeze({\n disableReferrerDetection: false,\n eventSourcePolicy: 'any',\n skipUnchanged: false,\n sanitizerPolicy: 'compat',\n});\n\n/** Only an explicit `'v1'` opts out; everything else gets the hardened rows. */\nexport function adapterDefaultsFor(profile: DefaultsProfile | undefined): AdapterProfileDefaults {\n return profile === 'v1' ? V1_ADAPTER_DEFAULTS : V2_ADAPTER_DEFAULTS;\n}\n\nexport function runtimeDefaultsFor(profile: DefaultsProfile | undefined): RuntimeProfileDefaults {\n return profile === 'v1' ? V1_RUNTIME_DEFAULTS : V2_RUNTIME_DEFAULTS;\n}\n","/**\n * Server-side preview-intent detection. Every signal here is client-controlled:\n * a positive result is a delivery hint, never proof of identity or permission.\n * Verify with `authorizePreviewRequest()` before anything privileged.\n */\n\n/** `query`: `?preview=true`; `fetch-dest`: `Sec-Fetch-Dest: iframe`; `referer`: an admin-origin Referer. */\nexport type PreviewSignal = 'query' | 'fetch-dest' | 'referer';\n\nexport interface PreviewRequestOptions {\n /** Which signals count. Default: all three. `['query']` is the adapters' 2.0 default. */\n readonly signals?: readonly PreviewSignal[];\n /** Query parameters (value `true` or `1`) that signal intent. Default `['preview', 'draft', 'livePreview']`. */\n readonly queryParams?: readonly string[];\n /** Admin origins whose Referer signals intent, e.g. `['https://cms.example.com']`. */\n readonly adminOrigins?: readonly string[];\n}\n\nconst DEFAULT_QUERY_PARAMS = ['preview', 'draft', 'livePreview'] as const;\n\n/** The request surface the predicate reads; `Request` satisfies it, Nitro/H3 events need a shim. */\nexport interface PreviewRequestLike {\n readonly url: string;\n readonly headers: { get(name: string): string | null };\n}\n\n/** Whether `request` carries live-preview intent. Intent, not authorization. */\nexport function hasPreviewIntent(\n request: PreviewRequestLike,\n options: PreviewRequestOptions = {},\n): boolean {\n const signals = new Set<PreviewSignal>(options.signals ?? ['query', 'fetch-dest', 'referer']);\n const queryParams = options.queryParams ?? DEFAULT_QUERY_PARAMS;\n\n if (signals.has('query')) {\n let url: URL | undefined;\n try {\n url = new URL(request.url);\n } catch {\n url = undefined;\n }\n if (url !== undefined) {\n for (const param of queryParams) {\n const value = url.searchParams.get(param);\n if (value === 'true' || value === '1') return true;\n }\n }\n }\n\n if (signals.has('fetch-dest') && request.headers.get('sec-fetch-dest') === 'iframe') {\n return true;\n }\n\n const adminOrigins = signals.has('referer') ? (options.adminOrigins ?? []) : [];\n if (adminOrigins.length > 0) {\n const referer = request.headers.get('referer');\n if (referer !== null) {\n try {\n const refererOrigin = new URL(referer).origin;\n for (const adminOrigin of adminOrigins) {\n try {\n if (new URL(adminOrigin).origin === refererOrigin) return true;\n } catch {\n // A malformed configured origin matches nothing.\n }\n }\n } catch {\n // A malformed referer is not a signal.\n }\n }\n }\n\n return false;\n}\n","/**\n * One development warning per process. The set of issued keys lives on\n * `globalThis` so two package copies in one process still warn once.\n */\n\nconst WARNED_KEY = '__payloadLivePreviewDeprecationsWarned';\n\n/** `true` outside a production build; `false` when `NODE_ENV` is production or unknown. */\nexport function isDevelopmentProcess(): boolean {\n try {\n const env = (globalThis as { process?: { env?: Record<string, string | undefined> } }).process\n ?.env;\n if (env === undefined) return false;\n return env['NODE_ENV'] !== 'production';\n } catch {\n return false;\n }\n}\n\n/** Warn once per process for `key`, outside production only. */\nexport function warnOnce(key: string, message: string): void {\n if (!isDevelopmentProcess()) return;\n const holder = globalThis as unknown as Record<string, Set<string> | undefined>;\n const warned = (holder[WARNED_KEY] ??= new Set<string>());\n if (warned.has(key)) return;\n warned.add(key);\n try {\n console.warn(`[payload-live-preview] ${message}`);\n } catch {\n // A console that throws must not break a request.\n }\n}\n\n/** Test hook: forget every warning issued so far. */\nexport function resetDevWarnings(): void {\n const holder = globalThis as unknown as Record<string, Set<string> | undefined>;\n holder[WARNED_KEY] = undefined;\n}\n","/**\n * The preview policy every framework adapter applies: intent, authorization,\n * injection, CSP. Pure — it reads a `{ url, headers.get }` request shape and\n * never touches a response; the adapter translates both ends. See ADR 0006.\n */\n\nimport {\n buildFrameAncestors,\n buildScriptSrcWithNonce,\n generateCspNonce,\n mergeCspHeader,\n} from '@security/csp';\nimport { isPreviewConfigurationError } from '@security/preview-verdict';\nimport type { PreviewAuthorizationOutcome } from '@security/preview-verdict';\n// From the leaf `types` domain on purpose: the security module would pull the\n// HMAC and session code into every adapter bundle for a ten-line brand check.\nimport {\n isAuthorizedPreviewContext,\n type AuthorizedPreviewContext,\n} from '@/types/authorized-preview';\nimport { generateInlineScript, wrapWithScriptTag } from '@inline/generator';\nimport {\n adapterDefaultsFor,\n runtimeDefaultsFor,\n V2_RUNTIME_DEFAULTS,\n} from '@core/defaults-profile';\nimport { hasPreviewIntent, type PreviewRequestLike, type PreviewSignal } from './preview-request';\nimport { isDevelopmentProcess, warnOnce } from './dev-warning';\nimport type { PreviewAdapterOptions, PreviewAuthorizationHookResult } from './options';\n\nexport type { PreviewAuthorizationHookResult } from './options';\n\n/** How the adapter manages Content-Security-Policy, normalised. */\nexport type CspMode = false | 'frame-ancestors' | 'full';\n\n/** The structural subset of any adapter's options the policy reads; hooks are bound per request. */\nexport interface PreviewPolicyOptions extends PreviewAdapterOptions<never> {\n /** Server-rendered fragment boundaries (ADR 0011): the same-origin endpoint the runtime posts to. */\n readonly fragments?: { readonly endpoint: string };\n}\n\n/** The opening `<head>` tag the runtime script is inserted into. */\nexport const HEAD_INSERT = /<head(\\s[^>]*)?>/i;\n\n/** `text/html` with or without parameters. */\nexport const HTML_CONTENT_TYPE = /text\\/html/i;\n\n// Browsers prescan only the first 1024 bytes for the encoding; a script\n// inserted ahead of `<meta charset>` would push it out of that window.\nconst META_CHARSET =\n /<meta\\s+(?:[^>]*\\s)?(?:charset\\s*=|http-equiv\\s*=\\s*[\"']?content-type)[^>]*>/i;\n\n/** The options after the `defaults` profile: explicit options win, the profile fills the rest. */\nexport interface ResolvedPolicyOptions {\n readonly strict: boolean;\n readonly previewSignals: readonly PreviewSignal[] | undefined;\n readonly skipUnchanged: boolean | undefined;\n readonly disableReferrerDetection: boolean | undefined;\n readonly disableLocalhostMatching: boolean | undefined;\n readonly eventSourcePolicy: 'any' | 'parent-or-opener' | undefined;\n readonly sanitizerPolicy: 'compat' | 'strict' | undefined;\n}\n\nexport function resolvePolicyOptions(options: PreviewPolicyOptions): ResolvedPolicyOptions {\n const adapter = adapterDefaultsFor(options.defaults);\n const runtime = runtimeDefaultsFor(options.defaults);\n // The inline runtime already defaults to the v2 rows, so only a differing\n // profile — an explicit `defaults: 'v1'` — needs a row on the wire.\n const runtimeRow = <K extends keyof typeof V2_RUNTIME_DEFAULTS>(\n key: K,\n ): (typeof V2_RUNTIME_DEFAULTS)[K] | undefined =>\n runtime[key] !== V2_RUNTIME_DEFAULTS[key] ? runtime[key] : undefined;\n return {\n strict: options.strict ?? adapter.strict,\n previewSignals: options.previewSignals ?? adapter.previewSignals,\n skipUnchanged: options.skipUnchanged ?? runtimeRow('skipUnchanged'),\n disableReferrerDetection:\n options.disableReferrerDetection ?? runtimeRow('disableReferrerDetection'),\n disableLocalhostMatching: options.disableLocalhostMatching,\n eventSourcePolicy: options.eventSourcePolicy ?? runtimeRow('eventSourcePolicy'),\n sanitizerPolicy: options.sanitizerPolicy ?? runtimeRow('sanitizerPolicy'),\n };\n}\n\n/** The inline-script configuration; only given options travel, so the runtime's own defaults stay the single source of them. */\nexport function inlineScriptConfig(\n options: PreviewPolicyOptions,\n): Parameters<typeof generateInlineScript>[0] {\n assertMergeDepthExplicit(options);\n const resolved = resolvePolicyOptions(options);\n return {\n // Not a wire slot: it tells the generator an omitted `mergeDepth` is deliberate.\n ...(options.defaults !== undefined ? { defaults: options.defaults } : {}),\n ...(options.allowedOrigins !== undefined ? { allowedOrigins: options.allowedOrigins } : {}),\n ...(options.serverURL !== undefined ? { serverURL: options.serverURL } : {}),\n ...(options.apiRoute !== undefined ? { apiRoute: options.apiRoute } : {}),\n ...(options.mergeDepth !== undefined ? { mergeDepth: options.mergeDepth } : {}),\n ...(options.revealEditedField !== undefined\n ? { revealEditedField: options.revealEditedField }\n : {}),\n ...(options.debug !== undefined ? { debug: options.debug } : {}),\n ...(options.debounceMs !== undefined ? { debounceMs: options.debounceMs } : {}),\n ...(options.heartbeatMs !== undefined ? { heartbeatMs: options.heartbeatMs } : {}),\n ...(resolved.skipUnchanged !== undefined ? { skipUnchanged: resolved.skipUnchanged } : {}),\n ...(options.scopeBindingsByOwner !== undefined\n ? { scopeBindingsByOwner: options.scopeBindingsByOwner }\n : {}),\n ...(resolved.disableReferrerDetection !== undefined\n ? { disableReferrerDetection: resolved.disableReferrerDetection }\n : {}),\n ...(resolved.disableLocalhostMatching !== undefined\n ? { disableLocalhostMatching: resolved.disableLocalhostMatching }\n : {}),\n ...(resolved.eventSourcePolicy !== undefined\n ? { eventSourcePolicy: resolved.eventSourcePolicy }\n : {}),\n ...(resolved.sanitizerPolicy !== undefined\n ? { sanitizerPolicy: resolved.sanitizerPolicy }\n : {}),\n ...(options.fragments !== undefined ? { fragmentEndpoint: options.fragments.endpoint } : {}),\n };\n}\n\n/** `manageCsp` normalised: unset and `true` both mean frame-ancestors only. */\nexport function normalizeCspMode(value: PreviewPolicyOptions['manageCsp']): CspMode {\n if (value === false) return false;\n if (value === 'full') return 'full';\n return 'frame-ancestors';\n}\n\n/** Whether the request shows preview intent under the options; `inject: 'always'` counts as intent. */\nexport function previewIntentFor(\n request: PreviewRequestLike,\n options: PreviewPolicyOptions,\n): boolean {\n const signals = resolvePolicyOptions(options).previewSignals;\n return (\n (options.inject ?? 'preview-only') === 'always' ||\n hasPreviewIntent(request, {\n ...(options.previewQueryParams !== undefined\n ? { queryParams: options.previewQueryParams }\n : {}),\n ...(signals !== undefined ? { signals } : {}),\n adminOrigins: options.allowedOrigins ?? [],\n })\n );\n}\n\n/** The CSP header after merging: `frame-ancestors` always, a nonce'd `script-src` only in `'full'` mode. */\nexport function buildPreviewCsp(\n options: PreviewPolicyOptions,\n nonce: string,\n existing: string,\n mode: Exclude<CspMode, false>,\n): string {\n const additions: Record<string, string> = {\n 'frame-ancestors': buildFrameAncestors({\n self: true,\n origins: [...(options.allowedOrigins ?? []), ...(options.frameAncestorsExtra ?? [])],\n }),\n };\n if (mode === 'full') {\n additions['script-src'] = buildScriptSrcWithNonce(nonce, {\n self: true,\n strictDynamic: options.strictDynamic ?? false,\n ...(options.scriptSrcExtra !== undefined ? { extra: options.scriptSrcExtra } : {}),\n });\n }\n return mergeCspHeader(existing, additions);\n}\n\n/**\n * `html` with the script tag after `<meta charset>`, else right after\n * `<head>`; `undefined` when there is no `<head>` to insert into.\n */\nexport function injectIntoHead(html: string, scriptTag: string): string | undefined {\n const head = HEAD_INSERT.exec(html);\n if (head === null) return undefined;\n const headEnd = head.index + head[0].length;\n const headClose = html.indexOf('</head', headEnd);\n const meta = META_CHARSET.exec(html.slice(headEnd, headClose === -1 ? undefined : headClose));\n const at = meta === null ? headEnd : headEnd + meta.index + meta[0].length;\n return `${html.slice(0, at)}${scriptTag}${html.slice(at)}`;\n}\n\n/** `serverURL` needs an explicit `mergeDepth` (ADR 0007, entry 10); `defaults: 'v1'` keeps the old default of 1. */\nexport function assertMergeDepthExplicit(options: PreviewPolicyOptions): void {\n if (options.defaults === 'v1') return;\n if (options.serverURL !== undefined && options.mergeDepth === undefined) {\n throw new Error(\n 'payload-live-preview: `serverURL` needs an explicit `mergeDepth` under the 2.0 defaults — ' +\n 'choose the relationship population depth deliberately (0 for none). ' +\n \"Pass `defaults: 'v1'` to keep the 1.x default of 1 while migrating (ADR 0007, entry 10).\",\n );\n }\n}\n\n/** The configuration errors `strict` exists to raise, at startup rather than on a public response. */\nexport function assertStrictConfiguration(options: PreviewPolicyOptions): void {\n if (typeof options.authorizePreview !== 'function') {\n throw new Error(\n 'payload-live-preview: strict mode requires `authorizePreview` — response changes ' +\n 'must be gated on a verified context, not on intent (ADR 0006).',\n );\n }\n const origins = options.allowedOrigins ?? [];\n if (origins.length === 0) {\n throw new Error(\n 'payload-live-preview: strict mode requires explicit, non-empty `allowedOrigins`.',\n );\n }\n if (!isDevelopmentProcess()) {\n for (const origin of origins) {\n let protocol: string | undefined;\n try {\n protocol = new URL(origin).protocol;\n } catch {\n protocol = undefined;\n }\n if (protocol !== 'https:') {\n throw new Error(\n `payload-live-preview: strict mode requires https admin origins in production; got \"${origin}\".`,\n );\n }\n }\n }\n // The resolved signals, not the option: `defaults: 'v1'` fills in `referer`.\n if (resolvePolicyOptions(options).previewSignals?.includes('referer') === true) {\n throw new Error(\n \"payload-live-preview: strict mode disables referrer trust; remove 'referer' from \" +\n \"`previewSignals` (the 'v1' profile includes it).\",\n );\n }\n}\n\n/** What the policy decided for one request. */\nexport interface PreviewDecision {\n /** The request shows preview intent (or the adapter injects always). */\n readonly isPreview: boolean;\n /** The verified context, or `null` when there was no hook or it refused. */\n readonly authorization: AuthorizedPreviewContext | null;\n /** The hook's verdict, or `undefined` when no hook ran (no intent, or none configured). */\n readonly outcome: PreviewAuthorizationOutcome | undefined;\n /** Intent, authorization, `autoInject` and the adapter's content filter all agreed. */\n readonly inject: boolean;\n /** CSP directives to add, or `false`. Never set without intent, never after a refusal. */\n readonly cspMode: CspMode;\n /** Whether the request-scoped nonce may be handed to templates. */\n readonly exposeNonce: boolean;\n}\n\n/** The per-request hooks an adapter binds to its own request type. */\nexport interface PreviewDecisionHooks {\n /** The adapter's content filter, evaluated lazily once injection is otherwise decided. */\n readonly shouldInject?: () => boolean;\n /** The adapter's `authorizePreview` option, bound to the framework request. Called only on intent. */\n readonly authorize?: () =>\n PreviewAuthorizationHookResult | Promise<PreviewAuthorizationHookResult>;\n}\n\n/** A policy bound to one adapter's options. The script body depends on the options only and is built once. */\nexport interface PreviewPolicy {\n /**\n * Decide for a request: `hooks.authorize` runs only on intent, and a\n * `PreviewConfigurationError` from it is re-thrown while any other failure\n * becomes the `'unavailable'` refusal.\n */\n decide(request: PreviewRequestLike, hooks?: PreviewDecisionHooks): Promise<PreviewDecision>;\n /** The `<script>` tag for this policy's runtime, carrying `nonce`. */\n scriptTag(nonce: string): string;\n /** CSP header value for a decision that has a mode. */\n csp(existing: string, nonce: string, mode: Exclude<CspMode, false>): string;\n /** A fresh nonce. */\n nonce(): string;\n /** Whether `authorizePreview` is configured; `decide()` then requires the bound hook. */\n readonly authorizes: boolean;\n}\n\nconst NONE: PreviewDecision = Object.freeze({\n isPreview: false,\n authorization: null,\n outcome: undefined,\n inject: false,\n cspMode: false,\n exposeNonce: false,\n});\n\nfunction contextFrom(result: PreviewAuthorizationHookResult): {\n readonly context: AuthorizedPreviewContext | null;\n readonly outcome: PreviewAuthorizationOutcome;\n} {\n if (isAuthorizedPreviewContext(result)) return { context: result, outcome: 'authorized' };\n if (typeof result === 'object' && result !== null && 'authorized' in result) {\n if (result.authorized && isAuthorizedPreviewContext(result.context)) {\n return { context: result.context, outcome: 'authorized' };\n }\n return { context: null, outcome: result.authorized ? 'invalid' : result.outcome };\n }\n // `null`, `undefined`, a boolean, a look-alike literal: refused.\n return { context: null, outcome: 'invalid' };\n}\n\nexport function createPreviewPolicy(options: PreviewPolicyOptions): PreviewPolicy {\n const resolved = resolvePolicyOptions(options);\n assertMergeDepthExplicit(options);\n const authorizes = typeof options.authorizePreview === 'function';\n if (resolved.strict) {\n assertStrictConfiguration(options);\n } else if (!authorizes) {\n warnOnce(\n 'intent-only-preview',\n 'preview responses are gated on client-controlled intent only. Configure `authorizePreview` ' +\n '(see authorizePreviewRequest) before production; `strict: true` enforces it. ' +\n 'ADR 0006 explains why intent is not authorization.',\n );\n }\n const cspMode = normalizeCspMode(options.manageCsp);\n const autoInject = options.autoInject ?? true;\n let body: string | undefined;\n const scriptBody = (): string => {\n body ??= generateInlineScript(inlineScriptConfig(options));\n return body;\n };\n return {\n authorizes,\n async decide(request, hooks = {}) {\n if (authorizes && hooks.authorize === undefined) {\n throw new Error(\n 'payload-live-preview: `authorizePreview` is configured but decide() was called ' +\n 'without an `authorize` hook; bind the hook to the request (bindDecisionHooks).',\n );\n }\n const isPreview = previewIntentFor(request, options);\n if (!isPreview) return NONE;\n let authorization: AuthorizedPreviewContext | null = null;\n let outcome: PreviewAuthorizationOutcome | undefined;\n if (hooks.authorize !== undefined) {\n let result: PreviewAuthorizationHookResult;\n try {\n result = await hooks.authorize();\n } catch (error) {\n if (isPreviewConfigurationError(error)) throw error;\n result = { authorized: false, outcome: 'unavailable', context: null };\n }\n ({ context: authorization, outcome } = contextFrom(result));\n if (authorization === null) {\n return {\n isPreview,\n authorization,\n outcome,\n inject: false,\n cspMode: false,\n exposeNonce: false,\n };\n }\n }\n return {\n isPreview,\n authorization,\n outcome,\n inject: autoInject && (hooks.shouldInject?.() ?? true),\n cspMode,\n exposeNonce: true,\n };\n },\n scriptTag: (nonce) => wrapWithScriptTag(scriptBody(), { nonce }),\n csp: (existing, nonce, mode) => buildPreviewCsp(options, nonce, existing, mode),\n nonce: () => generateCspNonce(),\n };\n}\n","/** What a decision publishes for templates on `locals` (Astro, SvelteKit) or `event.context` (Nuxt). */\n\nimport type { PreviewDecision } from './policy';\n\n/** The request-scoped nonce, for templates that nonce their own scripts. */\nexport const NONCE_LOCALS_KEY = 'livePreviewNonce';\n\n/** The verified `AuthorizedPreviewContext`; absent unless `authorizePreview` authorized. */\nexport const AUTHORIZATION_LOCALS_KEY = 'livePreviewAuthorization';\n\n/** The hook's `PreviewAuthorizationOutcome`; absent when no hook ran. */\nexport const AUTHORIZATION_OUTCOME_LOCALS_KEY = 'livePreviewAuthorizationOutcome';\n\n/** Publish what templates may read; after a refusal the nonce is withheld like every other preview artefact. */\nexport function exposeDecision(\n locals: Record<string, unknown>,\n decision: PreviewDecision,\n nonce: string,\n): void {\n if (decision.exposeNonce || !decision.isPreview) locals[NONCE_LOCALS_KEY] = nonce;\n if (decision.authorization !== null) locals[AUTHORIZATION_LOCALS_KEY] = decision.authorization;\n if (decision.outcome !== undefined) locals[AUTHORIZATION_OUTCOME_LOCALS_KEY] = decision.outcome;\n}\n","/**\n * Entrypoint for `mode: 'middleware'`. `addMiddleware()` takes a module\n * specifier, so the options arrive through a virtual module. Not for consumers.\n */\n\nimport { createLivePreviewMiddleware } from './middleware';\nimport type { LivePreviewAstroOptions } from './types';\n\n// @ts-expect-error — virtual module, provided at build time\nimport options from 'virtual:payload-live-preview/options';\n\nexport const onRequest = createLivePreviewMiddleware(options as LivePreviewAstroOptions);\n","/**\n * Astro middleware: decides before rendering so templates can read\n * `Astro.locals`, then injects into the HTML response and merges CSP.\n * Prerendered pages are skipped — there is no request to decide for at build time.\n */\n\nimport { createPreviewPolicy } from '@adapters/shared/policy';\nimport { applyDecision, bindDecisionHooks } from '@adapters/shared/response';\nimport { exposeDecision, NONCE_LOCALS_KEY } from '@adapters/shared/locals';\nimport type { LivePreviewAstroOptions } from './types';\n\nexport {\n AUTHORIZATION_LOCALS_KEY,\n AUTHORIZATION_OUTCOME_LOCALS_KEY,\n NONCE_LOCALS_KEY,\n} from '@adapters/shared/locals';\n\n// Local shims keep `astro` a runtime-optional peer; the runtime signature matches.\ntype MiddlewareNext = () => Promise<Response>;\ninterface MiddlewareContext {\n readonly request: Request;\n readonly locals: Record<string, unknown>;\n /** Astro ≥ 5: `true` while prerendering at build time. */\n readonly isPrerendered?: boolean;\n}\nexport type LivePreviewMiddleware = (\n context: MiddlewareContext,\n next: MiddlewareNext,\n) => Promise<Response>;\n\n/** Build the middleware; it publishes the nonce, the context and the outcome on `Astro.locals`. */\nexport function createLivePreviewMiddleware(\n options: LivePreviewAstroOptions = {},\n): LivePreviewMiddleware {\n const policy = createPreviewPolicy(options);\n return async (context, next) => {\n const nonce = policy.nonce();\n if (context.isPrerendered === true) {\n context.locals[NONCE_LOCALS_KEY] = nonce;\n return next();\n }\n const decision = await policy.decide(\n context.request,\n bindDecisionHooks(policy, options, context.request),\n );\n exposeDecision(context.locals, decision, nonce);\n const response = await next();\n if (!decision.isPreview) return response;\n return applyDecision(response, policy, decision, nonce);\n };\n}\n","/**\n * Applying a decision to a fetch-style `Response`, and the request-side\n * glue every adapter repeats: hook binding and the manual script tag.\n */\n\nimport { generateInlineScript, wrapWithScriptTag } from '@inline/generator';\nimport {\n HTML_CONTENT_TYPE,\n injectIntoHead,\n inlineScriptConfig,\n type PreviewDecision,\n type PreviewDecisionHooks,\n type PreviewPolicy,\n type PreviewPolicyOptions,\n} from './policy';\nimport type { PreviewAdapterOptions } from './options';\n\n/** The header surface shared by `Headers` and a Node response. */\nexport interface HeaderSink {\n get(name: string): string | null | undefined;\n set(name: string, value: string): void;\n}\n\n/** Bind an adapter's per-request hooks to `request`. */\nexport function bindDecisionHooks<Req>(\n policy: PreviewPolicy,\n options: Pick<PreviewAdapterOptions<Req>, 'authorizePreview' | 'shouldInject'>,\n request: Req,\n): PreviewDecisionHooks {\n return {\n shouldInject: () => options.shouldInject?.(request) ?? true,\n ...(policy.authorizes ? { authorize: () => options.authorizePreview?.(request) } : {}),\n };\n}\n\n/** The `<script>` tag for manual embedding, with `nonce` when given. */\nexport function renderScriptTag(\n options: PreviewPolicyOptions & { readonly nonce?: string },\n): string {\n const body = generateInlineScript(inlineScriptConfig(options));\n return wrapWithScriptTag(body, options.nonce !== undefined ? { nonce: options.nonce } : {});\n}\n\n/** A changed response must never be stored as the public page, nor shared across sessions. */\nexport function markUncacheable(headers: HeaderSink): void {\n const cacheControl = headers.get('cache-control') ?? '';\n if (!/\\bno-store\\b/i.test(cacheControl)) headers.set('cache-control', 'private, no-store');\n const vary = (headers.get('vary') ?? '').trim();\n const listed = vary.split(',').map((token) => token.trim().toLowerCase());\n if (listed.includes('*') || listed.includes('cookie')) return;\n headers.set('vary', vary.length === 0 ? 'Cookie' : `${vary}, Cookie`);\n}\n\n/**\n * `response` with the script tag in its `<head>`, untouched when it has no\n * body (204/304/HEAD), is not HTML, or has no `<head>`. Headers describing\n * the old body — length, encoding, ETag — are dropped.\n */\nexport async function injectIntoResponse(response: Response, scriptTag: string): Promise<Response> {\n if (response.body === null) return response;\n if (!HTML_CONTENT_TYPE.test(response.headers.get('content-type') ?? '')) return response;\n const injected = injectIntoHead(await response.clone().text(), scriptTag);\n if (injected === undefined) return response;\n const headers = new Headers(response.headers);\n headers.delete('content-length');\n headers.delete('content-encoding');\n headers.delete('etag');\n return new Response(injected, {\n status: response.status,\n statusText: response.statusText,\n headers,\n });\n}\n\n/** Run `apply` on the response headers, cloning first when they are immutable (responses passed through from `fetch()`). */\nexport function withHeaders(response: Response, apply: (headers: Headers) => void): Response {\n try {\n apply(response.headers);\n return response;\n } catch {\n const headers = new Headers(response.headers);\n apply(headers);\n return new Response(response.body, {\n status: response.status,\n statusText: response.statusText,\n headers,\n });\n }\n}\n\n/** Set the merged CSP header for `mode` and mark the response uncacheable. */\nexport function withCspHeader(\n response: Response,\n policy: PreviewPolicy,\n decision: PreviewDecision,\n nonce: string,\n): Response {\n const mode = decision.cspMode;\n return withHeaders(response, (headers) => {\n if (mode !== false) {\n const existing = headers.get('content-security-policy') ?? '';\n headers.set('content-security-policy', policy.csp(existing, nonce, mode));\n }\n markUncacheable(headers);\n });\n}\n\n/** Apply a decision end to end: inject, then CSP and cache headers. The response is returned as-is when nothing changes. */\nexport async function applyDecision(\n response: Response,\n policy: PreviewPolicy,\n decision: PreviewDecision,\n nonce: string,\n): Promise<Response> {\n if (!decision.inject && decision.cspMode === false) return response;\n const injected = decision.inject\n ? await injectIntoResponse(response, policy.scriptTag(nonce))\n : response;\n return withCspHeader(injected, policy, decision, nonce);\n}\n"],"mappings":"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","ignoreList":[]}