payload-live-preview 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -18
- package/dist/adapters/astro/index.js +1 -1
- package/dist/adapters/astro/index.js.map +1 -1
- package/dist/adapters/astro/middleware-entry.js +1 -1
- package/dist/adapters/astro/middleware-entry.js.map +1 -1
- package/dist/adapters/nextjs/index.js +1 -1
- package/dist/adapters/nextjs/index.js.map +1 -1
- package/dist/adapters/nuxt/index.js +1 -1
- package/dist/adapters/nuxt/index.js.map +1 -1
- package/dist/adapters/react/index.d.ts +2 -2
- package/dist/adapters/react/index.js +1 -1
- package/dist/adapters/react/index.js.map +1 -1
- package/dist/adapters/sveltekit/index.js +1 -1
- package/dist/adapters/sveltekit/index.js.map +1 -1
- package/dist/adapters/vue/index.d.ts +2 -2
- package/dist/adapters/vue/index.js +1 -1
- package/dist/adapters/vue/index.js.map +1 -1
- package/dist/annotate.d.ts +22 -15
- package/dist/annotate.js +1 -1
- package/dist/annotate.js.map +1 -1
- package/dist/client.cjs +1 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +112 -112
- package/dist/client.d.ts +112 -112
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/codegen-cli.js +1 -1
- package/dist/codegen-cli.js.map +1 -1
- package/dist/codegen.cjs +1 -1
- package/dist/codegen.cjs.map +1 -1
- package/dist/codegen.d.cts +14 -16
- package/dist/codegen.d.ts +14 -16
- package/dist/codegen.js +1 -1
- package/dist/codegen.js.map +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +176 -170
- package/dist/core.d.ts +176 -170
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/dist/doctor-cli.d.ts +1 -1
- package/dist/doctor-cli.js +1 -1
- package/dist/doctor-cli.js.map +1 -1
- package/dist/doctor.d.ts +2 -2
- package/dist/doctor.js +1 -1
- package/dist/doctor.js.map +1 -1
- package/dist/{document-session-DWi9H3Qk.d.ts → document-session-Bkd181PV.d.ts} +3 -2
- package/dist/fragment.cjs.map +1 -1
- package/dist/fragment.d.cts +1 -1
- package/dist/fragment.d.ts +1 -1
- package/dist/fragment.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +181 -175
- package/dist/index.d.ts +181 -175
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lean.cjs +1 -1
- package/dist/lean.cjs.map +1 -1
- package/dist/lean.js +1 -1
- package/dist/lean.js.map +1 -1
- package/dist/lexical.cjs +1 -1
- package/dist/lexical.cjs.map +1 -1
- package/dist/lexical.js +1 -1
- package/dist/lexical.js.map +1 -1
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.cjs.map +1 -1
- package/dist/plugins.d.cts +1 -1
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.js +1 -1
- package/dist/plugins.js.map +1 -1
- package/dist/{probe-DpMZ4fOS.d.ts → probe-D-IHg9dF.d.ts} +1 -1
- package/dist/structural.cjs +2 -2
- package/dist/structural.cjs.map +1 -1
- package/dist/structural.d.cts +27 -27
- package/dist/structural.d.ts +27 -27
- package/dist/structural.js +2 -2
- package/dist/structural.js.map +1 -1
- package/package.json +7 -6
package/dist/lean.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=/* @__PURE__ */['(()=>{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(...i)=>{try{e(t(...i))}catch{}}}function i(){}function n(e){return e.onUnfaithfulPatch??("ignore"===e.onUnboundChange?"ignore":"escalate")}function r(e,t,i,n){let r=e.onUnfaithfulPatch,s=t.reportedUnfaithful.has(i.element);if((s||"escalate"!==r)&&t.display.shortfall(t.activeUpdate,{kind:"unfaithful",field:i.fieldName}),!s&&(t.reportedUnfaithful.add(i.element),t.unfaithfulCount+=1,t.unfaithfulFields.add(i.fieldName),"ignore"!==r)){if("warn"===r){e.warn(`[live-preview] LP0411: "${i.fieldName}" ${n}`);return}e.log("LP0411",i.fieldName,n),t.unfaithfulPatches.push(i)}}function s(e,t){return!e.unfaithfulFields.has(t)&&(e.unfaithfulFields.add(t),e.unfaithfulCount+=1,!0)}function a(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value:e.textContent}function l(e){let t=e.trim();return JSON.stringify(t.length>vi?`${t.slice(0,vi)}\\u2026`:t)}function o(){return function(){if(typ','eof 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 d(e){if(++e.nodes>1e4)throw new Error("invalid or oversized field schema")}function u(e,t,i){if(d(t),i>64||t.active.has(e))throw new Error("invalid or oversized field schema");t.active.add(e)}function c(e){try{return h(e,{nodes:0,active:new WeakSet},0)}catch{return[]}}function h(e,t,i){if(!Array.isArray(e))return[];u(e,t,i);let n=[];for(let r of e){let e=f(r,t,i);e&&n.push(e)}return t.active.delete(e),n}function f(e,t,i){if(d(t),"object"!=typeof e||null===e)return;let n=e,r=n.name,s=n.type;if("string"!=typeof r||0===r.length||"string"!=typeof s||0===s.length)return;let a=h(n.fields,t,i+1),l=function(e,t,i){if("object"==typeof e&&null!==e&&!Array.isArray(e)){u(e,t,i);let n=[];for(let r in e){if(!Object.hasOwn(e,r))continue;d(t);let s=Reflect.get(e,r);"object"!=typeof s||null===s||["__proto__","constructor","prototype"].includes(r)||n.push({...s,slug:r,fields:h(s.fields,t,i+1)})}return t.active.delete(e),n}if(!Array.isArray(e))return[];u(e,t,i);let n=[];for(let r of e){if(d(t),"object"!=typeof r||null===r)continue;let e=r,s=e.slug;if("string"!=typeof s||0===s.length)continue;let a=h(e.fields,t,i+1);n.push({...e,slug:s,fields:a})}return t.active.delete(e),n}(n.blocks,t,i+1),o={...n,name:r,type:s},c=n.relationTo;if(Array.isArray(c)){let e=[];for(let i of c)d(t),e.push(i);o.relationTo=e}return a.length>0?o.fields=a:delete o.fields,l.length>0?o.blocks=l:delete o.blocks,o}function p(e,t){return void 0===e||t(e)}function g(e,t){return null==e||t(e)}function m(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}function v(e,t=[]){let i="number"==typeof e&&Number.isFinite(e)&&e>=1?Math.floor(e):void 0,n=Math.min(4,i??1),r=new Set(t),s=new Set;for(let e of wi)(n>=bi[e].since||r.has(e))&&s.add(e);return{ours:4,...void 0!==i?{theirs:i}:{theirs:void 0},negotiated:n,capabilities:s,observed:r}}function y(e,t){return e.generation===t.generation&&e.revision===t.revision}function b(e){Ti.has(e)||(Ti.add(e),ai(`[live-preview] LP0104: this page carries the lean runtime, which leaves out ${e} (${ki[e]}). The elements are left as the server rendered them. Remove \\`runtime: LEAN_RUNTIME\\` to get the full runtime.`))}function w(e){return function(e){return!1!==e.enableA11y&&b("screen-reader announcements"),null}(e)}function S(e){if(typ','eof window>"u")return;let t=[];window.parent!==window&&t.push(window.parent),window.opener instanceof Window&&t.push(window.opener),Si.sendReady(t,e)}function k(e,t,i,n){for(let r of e){if(Ai.has(r.type)){let e=r.fields;e&&k(e,n&&"tabs"===r.type?""===t?r.name:`${t}.${r.name}`:t,i,n);continue}let e=""===t?r.name:`${t}.${r.name}`;if(i.set(e,r),"group"===r.type)r.fields&&k(r.fields,e,i,n);else if("array"===r.type&&r.fields)k(r.fields,`${e}.*`,i,n);else if("blocks"===r.type&&r.blocks)for(let t of r.blocks)k(t.fields,`${e}.*.${t.slug}`,i,n)}}function T(e,t){if(e.has(t))return e.get(t);let i=t.replace(/\\.\\d+(?=\\.|$)/g,".*");return e.has(i)?e.get(i):void 0}function A(e){if("string"!=typeof e)return!1;let t=e.trim().replace(Ni,"");if(0===t.length)return!1;if(t.startsWith("#")||t.startsWith("?")||Fi.test(t)||t.startsWith("/"))return!0;try{let e=new URL(t);return Ci.has(e.protocol)}catch{return $i.test(t)&&!function(e){let t=Mi.exec(e.replace(Oi,""))?.[1];return void 0!==t&&!Ci.has(`${t.toLowerCase()}:`)}(t)}}function R(e){let t=e.trim().replace(Ni,"");return/^https?:\\/\\//i.test(t)||Fi.test(t)}function C(e){return Pi.add(e),e}function $(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 F(){return!0}function N(e,t,i,n=!1){if(n&&void 0!==i){let n=O(e,`${t}_${i}`);if(void 0!==n)return n}let r=O(e,t);if(void 0!==r)return r;if(t.includes(".")){let i=e,n=!0;for(let e of t.split(".")){if(Ei.has(e)||null===i||"object"!=typeof i){n=!1;break}if(i=O(i,e),void 0===i){n=!1;break}}if(n)return i}return void 0===i?void 0:O(e,`${t}_${i}`)}function O(e,t){if(!Ei.has(t)&&Object.prototype.hasOwnProperty.call(e,t))return e[t]}function M(e,t,i,n){return N(e,i,t.locale??n,void 0!==t.locale)}function L(e,t,i,n){let r=$(t);if(void 0===r)return;let s=[e.hrefField,e.srcField,e.altField],a=r;for(let t of s){if(void 0===t||0===t.length)continue;let r=$(M(i,e,t,n));if(void 0===r)return;a+=`|${t}=${r}`}return a}function U(e){return e.closest(`[${Ii}]`)}function P(e){let t=e.getAttribute(_i);return null!==t&&t.length>0?"patch"===t||"fragment"===t||"route"===t?t:void 0:null!==U(e)?"fragment":null!==e.closest("head")?"route":"patch"}function x(e){return`global:${e}`}function E(e,t){return void 0===t||""===t?`collection:${e}`:`collection:${e}:${t}`}function I(e){return"string"==typeof e&&e.length>0}function _(e,t){return null!==t&&void 0!==e&&t.includes(e)}function B(e){let t=e.id;return"string"==typeof t&&t.length>0?t:"number"==typeof t&&Number.isFinite(t)?String(t):void 0}function j(e){return"object"==typeof e&&null!==e}function W(e){return Array.isArray(e)?"array":j(e)?"object":"scalar"}function D(e,t){return j(e)?e[t]:void 0}function z(e,t,i,n){let r=[],s=0,a=(e,t,i,l)=>{if(s+=1,n.covers(e))return;let o=$(i);if(void 0!==o&&o===$(t))return;if(!((void 0===t||W(t)===W(i))&&j(i)&&n.reachesBelow(e)&&l<Bi)){r.push({path:e,value:i});return}let d=function(e,t){let i=new Set(Object.keys(t));if(j(e))for(let t of Object.keys(e))i.add(t);return[...i]}(t,i);0===d.length&&r.push({path:e,value:i});for(let n of d){if(s>=ji){r.push({path:e,value:i});return}a(`${e}.${n}`,D(t,n),D(i,n),l+1)}};return a(e,t,i,0),r}function q(e,t,i={}){let n=e=>!1===t||_(e,t),r=[];for(let[t,i]of e.entries())i.some(e=>n(e.owner))&&r.push(t);let s=e.rendered.filter(e=>void 0!==i[e.strategy]);return function(e,t){let i=new Set(e),n=[...t],r=(e,t)=>{let i=`${t}.`;for(let t of e)if(t.startsWith(i))return!0;return!1};return{covers:e=>i.has(e)||n.some(t=>t===e||e.startsWith(`${t}.`)),reachesBelow:e=>r(i,e)||r(n,e)}}(r,[...e.covers,...s].filter(e=>n(e.owner)).flatMap(e=>e.paths))}function V(e,t){if(void 0===t||0===t.length)return e;let i=`_${t}`;return e.endsWith(i)?e.slice(0,-i.length):e}function H(e,t,i,n=q(e,i)){let r,s=n.covers,a=n.reachesBelow;return n=>{let l=V(n,t);return s(n)||l!==n&&s(l)||(r??(r=function(e,t){let i=new Set;for(let[n,r]of e.entries())for(let e of r)!1!==t&&!_(e.owner,t)||void 0!==e.locale&&i.add(`${n}_${e.locale}`);return i}(e,i)),r.has(n))?"whole":a(n)||l!==n&&a(l)?"below":"none"}}function G(e,t,i,n,r){return Q(i)?!Q(t)||function(e,t,i){let n=void 0===i?void 0:T(i,e);return void 0!==n&&!Di.has(n.type)||!0===t.get(e)?.some(J)||function(e,t){let i=`${t}.`;for(let[t,n]of e.entries())if(t.startsWith(i))return!0;return!1}(t,e)}(e,n,r)?"keep":null==t?"ask":"own":"ask"}function J(e){return!Di.has(e.fieldType)}function K(e){let t=[e],i=new Set;for(let e=t.pop();void 0!==e;e=t.pop()){if("object"!=typeof e||null===e||i.has(e))continue;i.add(e);let{type:n,fields:r,children:s}=e;if(!zi.has(n)||"internal"===r?.linkType)return!0;if(Array.isArray(s))for(let e of s)t.push(e)}return!1}function Q(e){return null===e||"object"!=typeof e&&"function"!=typeof e}function X(e){return!0===e?.includes(".")}function Z(e,t){let i=t.globalSlug??t.collectionSlug;if("string"!=typeof i||e.entitySlug!==i)return!0;let n=B(e),r=B(t.data??{});return void 0!==n&&void 0!==r&&n!==r}function Y(e){return null!==e&&e.forceRender&&!e.completed}function ee(e){try{return!0===e.matchMedia?.("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function te(e,t){let i=t.element.ownerDocument.defaultView;return null===i?"no-element":e.reveal(`${t.owner??""} ${t.fieldName}`,t.element,i)}function ie(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)}function ne(e){if(null==e)return[];let t=new Set,i=[];for(let n of e.split(/[\\s,]+/)){let e=n.trim();0===e.length||t.has(e)||(t.add(e),i.push(e))}return i}function re(...e){let t=new Map;for(let i of e)for(let[e,n]of Object.entries(i)){let i=t.get(e);void 0===i&&(i=new Set,t.set(e,i));for(let e of n)i.add(e)}let i={};for(let[e,n]of t)i[e]=[...n];return i}function se(e,t){let i={};for(let n of t)n!==e&&(i[n]=[e]);return i}function ae(e){return"patch"===e.getAttribute(nn)}function le(e){return function(e){return"astro-island"===e.tagName.toLowerCase()||e.hasAttribute(nn)}(e)&&!ae(e)}function oe(e){return"astro-island"===e.tagName.toLowerCase()&&e.hasAttribute("ssr")}function de(e){let t=e.closest(Rn)?.getAttribute(yn);return null==t||0===t.length?void 0:t}function ue(e){return Fn.has(e)||$n.test(e)}function ce(e,t){return e.fieldName===t.fieldName&&e.locale===t.locale&&e.owner===t.owner&&e.strategyKind===t.strategyKind&&e.fragmentBoundary===t.fragmentBoundary}function he(e){let t=e.getAttribute(an);if(null!==t&&ue(t))return t;if(e.hasAttribute(pn))return"richText";if(e.hasAttribute(gn))return"html";if(e.hasAttribute(vn))return"structural-array";if(e.hasAttribute(mn))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 fe(){return!0}function pe(){throw new Error("invalid or oversized legacy population")}function ge(e){for(let t=0;t<e.length;t+=1){let i=e.charCodeAt(t);if(i<=31||127===i)return!0}return!1}function me(e,t){if("string"!=typeof e||0===e.length||e.length>t||"."===e||".."===e||e.includes("/")||e.includes("\\\\")||ge(e))return!1;try{return encodeURIComponent(e),!0}catch{return!1}}function ve(e){return me(e,128)&&!/[?#%]/u.test(e)&&!_n.has(e)}function ye(e){return Number.isFinite(e)?String(e):me(e,512)?e:pe()}function be(e,t){return Object.hasOwn(e,t)?Reflect.get(e,t):void 0}function we(e,t,i){Object.defineProperty(e,t,{value:i,writable:!0,configurable:!0,enumerable:!0})}function Se(e){let t=e.length;for(;t>0&&47===e.charCodeAt(t-1);)t-=1;return e.slice(0,t)}function ke(e){let t=new WeakSet,i=0,n=0;return function e(r,s){if(++i>Mn||s>On)return pe();if("string"==typeof r)return n+=r.length,n>xn&&pe(),r;if(null==r||"boolean"==typeof r)return r;if("number"==typeof r)return Number.isFinite(r)?r:pe();if(!Array.isArray(r)&&!m(r))return pe();if(Array.isArray(r)){r.length>Mn&&pe();for(let e=0;e<r.length;e+=1)Object.hasOwn(r,e)||pe()}if(t.has(r))return pe();t.add(r);let a=Array.isArray(r)?[]:{};for(let t of Object.keys(r))we(a,t,e(Reflect.get(r,t),s+1));return t.delete(r),a}(e,0)}function Te(e,t,i,n,r,s){function a(e,t,i,n){if(null==n||""===n)return;let s=m(n)?be(n,"id"):n,a=ye(s);if(0===r){we(e,t,s);return}let l=JSON.stringify([i,a]);c.add(l),c.size>Ln&&pe();let o=u.get(i)??[];o.push({owner:e,key:t,id:a}),u.set(i,o)}function l(e,t,i){void 0!==i.hasMany&&"boolean"!=typeof i.hasMany&&pe();let n=i.relationTo,r=be(e,t);if(Array.isArray(n)){0===n.length&&pe();let e,t=m(r)?be(r,"relationTo"):void 0;for(let i of n)p(0),ve(i)||pe(),i===t&&(e=i);if(null==r||""===r)return;(!m(r)||void 0===e)&&pe(),a(r,"value",e,be(r,"value"))}else ve(n)||pe(),a(e,t,n,r)}function o(e,t){if(p(t),Array.isArray(e)||m(e)){if(m(e)&&Object.hasOwn(e,"relationTo")&&Object.hasOwn(e,"value")){let t=be(e,"relationTo");ve(t)||pe(),a(e,"value",t,be(e,"value"));return}for(let i of Object.keys(e))o(Reflect.get(e,i),t+1)}}if(!Number.isSafeInteger(r)||r<0||r>On)return pe();void 0!==s&&("string"!=typeof s||s.length>128||ge(s))&&pe();let d=ke(e);if(!m(d))return pe();let u=new Map,c=new Set,h=0,f=new WeakSet,p=e=>{(++h>Mn||e>On)&&pe()};(function e(t,i,n){p(n),f.has(t)&&pe(),f.add(t);for(let r of t){p(n),(!m(r)||!me(r.name,512)||_n.has(r.name))&&pe();let t=be(i,r.name);if("relationship"===r.type||"upload"===r.type)if(r.hasMany)if(null!=t&&!Array.isArray(t)&&pe(),Array.isArray(t))for(let e=0;e<t.length;e+=1)l(t,e,r);else l(i,r.name,r);else l(i,r.name,r);else if("group"===r.type||"tabs"===r.type)null!=t&&!m(t)&&pe(),m(t)&&r.fields&&e(r.fields,t,n+1);else if("row"===r.type||"collapsible"===r.type)r.fields&&e(r.fields,i,n+1);else if("array"===r.type||"blocks"===r.type){if(0===t?we(i,r.name,[]):null!=t&&!Array.isArray(t)&&pe(),Array.isArray(t))for(let i of t)if(m(i)||pe(),"array"===r.type&&r.fields)e(r.fields,i,n+1);else if("blocks"===r.type){let t=be(i,"blockType"),s=r.blocks?.find(e=>(p(n),e.slug===t));void 0===s&&pe(),e(s.fields,i,n+1)}}else"richText"===r.type&&o(t,n+1)}f.delete(t)})(t,d,0),u.size>25&&pe();let g=[];if(0===u.size)return{doc:d,requests:g};let v=new URL(i);(!["http:","https:"].includes(v.protocol)||v.username||v.password||v.search||v.hash)&&pe(),(!n.startsWith("/")||n.includes("\\\\")||/[%?#]/u.test(n)||ge(n))&&pe(),n.split("/").some(e=>"."===e||".."===e)&&pe();let y=`${Se(i)}${Se(n)}/`;for(let[e,t]of u){let i=[...new Set(t.map(e=>e.id))],n=0;for(;n<i.length;){let a=i[n];void 0===a&&pe();let l=a.includes(","),o=[],d="";for(;n<i.length&&o.length<In;){let t=i[n];if(void 0===t||o.length>0&&(l||t.includes(",")))break;let a=[...o,t],u=new URLSearchParams({depth:String(r),limit:String(a.length)});void 0!==s&&u.set("locale",s),u.set(l?"where[id][equals]":"where[id][in]",l?t:a.join(","));let c=`${y}${encodeURIComponent(e)}?${u}`;if(c.length>Pn){0===o.length&&pe();break}new URL(c).origin!==v.origin&&pe(),o.push(t),n+=1,d=c}(0===o.length||g.length>=Un)&&pe();let u=new Set(o);g.push({url:d,ids:u,slots:t.filter(e=>u.has(e.id))})}}return{doc:d,requests:g}}async function Ae(e,t,i){let n,r,s=!1,a=!1,l=Symbol(),o=new Promise(e=>{r=()=>{e(l)}}),d=()=>{(!i()||t.aborted)&&pe()},u=()=>{if(void 0!==n&&!s){s=!0;try{Promise.resolve(n.cancel()).catch(()=>{})}catch{}}},c=()=>{r?.(),u()};t.addEventListener("abort",c,{once:!0});try{d();let t=e.body??null;if(d(),null===t){let t=e.json.bind(e);d();let i=await Promise.race([Promise.resolve().then(()=>(d(),t())),o]);return d(),i===l&&pe(),i}let i=t.getReader.bind(t);d();let r=i();n=r,d();let s=[],u=0,c=0;for(;;){let e=Promise.resolve().then(()=>{d();let e=r.read.bind(r);return d(),e()}),t=await Promise.race([e,o]);if(d(),t===l&&pe(),t.done)break;u+=t.value.byteLength,(++c>En||u>xn)&&pe(),s.push(t.value)}a=!0;let h=new Uint8Array(u),f=0;for(let e of s)h.set(e,f),f+=e.byteLength;try{return JSON.parse((new TextDecoder).decode(h))}catch{return pe()}}finally{t.removeEventListener("abort",c),a||u();try{n?.releaseLock()}catch{}}}function Re(e,t){let i=ke(t);m(i)||pe();let n=be(i,"docs");(!Array.isArray(n)||n.length>In)&&pe();let r=new Map;for(let t of n){m(t)||pe();let i=ye(be(t,"id"));(!e.ids.has(i)||r.has(i))&&pe(),r.set(i,t)}r.size!==e.ids.size&&pe();for(let t of e.slots)we(t.owner,t.key,r.get(t.id))}function Ce(e,t){return e.length>0&&e.length<=t&&"."!==e&&".."!==e&&!e.includes("/")&&!e.includes("\\\\")&&!function(e){for(let t of e){let e=t.codePointAt(0)??0;if(e<=31||127===e)return!0}return!1}(e)}function $e(e){return Ce(e,128)&&!e.includes("?")&&!e.includes("#")}function Fe(e){return"number"==typeof e?Number.isFinite(e):"string"==typeof e&&Ce(e,512)}function Ne(e){return e.has("schema-json")?Wn:e.has("document-events")||e.has("relationship-events")?Dn:zn}function Oe(e){if("attributes"!==e.type||e.attributeName!==qn||e.target.nodeType!==Vn)return null;let t=e.target;return"astro-island"!==t.tagName.toLowerCase()||t.hasAttribute(qn)?null:t}function Me(e){if(e.nodeType!==Vn)return!1;let t=e;return t.hasAttribute(sn)||t.matches(rn)||t.matches(Cn)||null!==t.querySelector(`[${sn}], ${rn}, ${Cn}`)}function Le(){if(typ','eof window>"u")return;let e=window;return e[Yn]??(e[Yn]={armed:!1,committed:!1,commits:[],onCommit:void 0,waiters:[]})}function Ue(){let e=Le();if(void 0===e||e.armed)return;e.armed=!0;let t=window,i=t.__REACT_DEVTOOLS_GLOBAL_HOOK__??(t.__REACT_DEVTOOLS_GLOBAL_HOOK__=function(){let e=new Map;return{supportsFiber:!0,renderers:e,inject:t=>{let i=e.size+1;return e.set(i,t),i}}}()),n=i.onCommitFiberRoot;i.onCommitFiberRoot=function(t,i,...r){try{n?.call(this,t,i,...r)}catch{}void 0===e.onCommit?e.commits.push(i):e.onCommit(i)}}function Pe(e){e.committed=!0;let t=e.waiters;e.waiters=[];for(let e of t)e()}function xe(e,t){let i=e.waiters.indexOf(t);i>=0&&e.waiters.splice(i,1)}function Ee(e,t,i){if(e.committed)return null;let n=null,r=()=>{null!==n&&clearTimeout(n),n=null,t("committed")};return e.waiters.push(r),n=setTimeout(()=>{n=null,xe(e,r),t("timed-out")},i),()=>{null!==n&&clearTimeout(n),n=null,xe(e,r)}}function Ie(){if(typ','eof window>"u")return;let e=window;return e[ir]??(e[ir]={armed:!1,committed:!1,waiters:[]})}function _e(e){return Object.prototype.hasOwnProperty.call(e,tr)?e[tr]:void 0}function Be(){let e=Ie();if(void 0===e||e.armed)return;e.armed=!0;let t=Element.prototype;void 0===Object.getOwnPropertyDescriptor(t,tr)&&Object.defineProperty(t,tr,{configurable:!0,get:()=>{},set(e){Object.defineProperty(this,tr,{value:e,writable:!0,configurable:!0,enumerable:!0});let t=Ie();void 0===t||t.committed||null===this.querySelector(er)||function(e,t){let i=t?.$nuxt;!0!==i?.isHydrating||"function"!=typeof i.hook?Pe(e):i.hook(nr,()=>{e.committed||Pe(e)})}(t,e)}})}function je(e){let t=e.hydration;if(void 0===t){e.startNow();return}let i=rr[t](e.root,i=>{e.later(()=>{We(e,t,i)})});null!==i?(e.defer(i),e.hydrated("waiting")):We(e,t,"committed")}function We(e,t,i){e.hydrated(i),"timed-out"===i&&e.warn(`[live-preview] LP0607: no ${sr[t]} in ${String(5e3)} ms; started without waiting for hydration.`),e.startNow()}function De(e){return 9===e.nodeType}function ze(e){return e.body}function qe(e,t,i,n){if(!e.scopeBindingsByOwner)return!1;let{message:r}=i,s=function(e){if(I(e.globalSlug))return[x(e.globalSlug)];if(!I(e.collectionSlug))return null;let t=E(e.collectionSlug);return I(e.documentId)?[t,E(e.collectionSlug,e.documentId)]:[t]}({globalSlug:"string"==typeof r.globalSlug?r.globalSlug:void 0,collectionSlug:"string"==typeof r.collectionSlug?r.collectionSlug:void 0,documentId:B(n)});return null===s&&!t.warnedUnattributableMessage&&(t.warnedUnattributableMessage=!0,e.warn("[live-preview] LP0202: scopeBindingsByOwner: update names no document; nothing applied")),s}function Ve(e,t,i,n,r){!function(e,t,i){let n=0;for(let r of e)if(!i()||(r.dispatchEvent(new CustomEvent(tn,{detail:t,bubbles:!1})),n+=1,!i()))break}(i,{fields:t.fields,revision:e.revision.revision,receivedAt:e.receivedAt,locale:e.locale,displayed:r},n)}function He(e,t,i,n,r){let{warned:s,warn:a}=e;if(s.has(i)||t(i))return;s.add(i);let l=`data-payload-field="${V(i,n)}"`;a(""!==r?`[live-preview] LP0203: field "${i}" has a value and no <\\u2026 ${l}> on this page; editing it changes nothing here. Expected where the page shows part of the document: inspect().fidelity.fields lists these, onUnfaithfulPatch decides whether a server render is asked for.`:`[live-preview] LP0201: no <\\u2026 ${l}> for the empty field "${i}"; render the anchor unconditionally so edits to an empty field have somewhere to land.`)}function Ge(e){let t=typeof e;return"string"===t||"number"===t||"boolean"===t||"bigint"===t}function Je(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Ke(e){let t=function(){let e=function(){let e=globalThis,t=e[ur];if(void 0!==t)return t;let i={};return e[ur]=i,i}();if(void 0!==e.override)return e.override;if(void 0!==e.auto)return e.auto;let t=function(){let e=globalThis.trustedTypes;return"object"!=typeof e||null===e?void 0:"function"==typeof e.createPolicy?e:void 0}();try{e.auto=void 0===t?null:t.createPolicy(dr,{createHTML:e=>e})}catch{e.auto=null}return e.auto}();return null===t?e:t.createHTML(e)}function Qe(e){hr.has(e)||(hr.add(e),function(e){try{console.warn(e)}catch{}}(`[live-preview] LP0409: the strict sanitizer removed \\`${e}\\` from written markup; the 1.x default (\\`sanitizerPolicy: \'compat\'\\`) kept it. ${function(e){return e.startsWith(fr)?"A binding inside CMS content is refused by design \\u2014 an editor could otherwise aim a write at any element on the page (docs/security.md)":"id"===e||"name"===e?"CMS content that can name an element can shadow a global of that name \\u2014 DOM clobbering, refused by design (docs/security.md)":"Put it on an element the template owns, or set `sanitizerPolicy: \'compat\'` to keep every `data-*` as 1.x did"}(e)}.`))}function Xe(e,t){return Ze(e,void 0,t)}function Ze(e,t,i){let n=i?.document??Ye();if(!n)throw new Error("sanitizeHtml needs a DOM");if(""===e)return"";let r=function(e,t){let i=e?.policy??t??$r;if(!e){let e=new Map;for(let[t,i]of Object.entries(Sr))e.set(t,i);return{allowedTags:pr,attrByTag:e,allowFormControls:!1,templateMode:!1,mode:i,allowedData:new Set}}let n=new Set(pr);if(e.additionalAllowedTags?.forEach(e=>n.add(e)),!0===e.allowFormControls)for(let e of gr)n.add(e);let r=new Map;for(let[e,t]of Object.entries(Sr))r.set(e,t);for(let[t,i]of Object.entries(e.additionalAllowedAttributes??{})){let e=new Set(r.get(t));for(let t of i)e.add(t);r.set(t,e)}return{allowedTags:n,attrByTag:r,allowFormControls:!0===e.allowFormControls,templateMode:!0===e.templateMode,mode:i,allowedData:new Set(e.allowedDataAttributes?.map(e=>e.toLowerCase()))}}(i,t),s=e;for(let e=0;e<Tr;e+=1){let e=n.createElement("template");e.innerHTML=Ke(s),et(e.content,r);let t=e.innerHTML;if(t===s)return t;s=t}return function(e,t){if(!function(){try{let e=glo','balThis.process?.env;return void 0!==e&&"production"!==e.NODE_ENV}catch{return!1}}())return;let i=globalThis,n=i[cr]??(i[cr]=new Set);if(!n.has(e)){n.add(e);try{console.warn(`[payload-live-preview] ${t}`)}catch{}}}("sanitizer-unsettled",`sanitizeHtml: the output did not settle after ${String(Tr)} passes, so it returned an empty string (ADR 0016).`),""}function Ye(){if(!(typ','eof document>"u"))return document}function et(e,t){for(let i of Array.from(e.childNodes))i.nodeType===Ar?tt(i,t):i.nodeType===Rr&&i.remove()}function tt(e,t){let i=e.tagName.toLowerCase();!mr.has(i)||t.allowFormControls&&gr.has(i)?t.allowedTags.has(i)?(function(e,t,i){let n=i.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("is"!==r){if("strict"===i.mode){if(i.templateMode&&Cr.has(r))continue;if("id"===r||"name"===r||r.startsWith(wr)){e.removeAttribute(t.name),("name"!==r||!0===n?.has(r))&&Qe(r);continue}if(r.startsWith(br)){i.allowedData.has(r)||(e.removeAttribute(t.name),Qe(r));continue}if(vr.has(r)||r.startsWith(yr))continue}else if(vr.has(r)||r.startsWith(yr)||r.startsWith(br))continue;n?.has(r)?(kr.has(r)&&!A(t.value)||"srcset"===r&&!it(t.value))&&e.removeAttribute(t.name):e.removeAttribute(t.name)}else e.setAttribute("is","")}}(e,i,t),"a"===i&&function(e){let t=e.getAttribute("href");null===t||!R(t)||(e.setAttribute("rel","noopener noreferrer"),e.hasAttribute("target")||e.setAttribute("target","_blank"))}(e),et(e,t)):(et(e,t),e.replaceWith(...e.childNodes)):e.remove()}function it(e){for(let t of e.split(",")){let e=t.trim();if(0===e.length)continue;let[i=e]=e.split(/\\s/,1);if(!A(i)||!A(e))return!1}return!0}function nt(e){return e.replace(Nr,e=>Fr[e])}function rt(e){return e.replace(Mr,e=>Or[e])}function st(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 at(e){return null==e||""===e}function lt(e,t){let i=e.get(t);return void 0!==i&&(e.delete(t),e.set(t,i)),i}function ot(e,t,i,n){return e.set(t,i),function(e,t){for(let i of e.keys()){if(e.size<=t)break;e.delete(i)}}(e,n),i}function dt(t,i,n,r,s){let a=t.transformValue;if(void 0===a)return n;try{let t=a(i.fieldName,n,{element:i.element,allFields:r},s),l=e(t);if(!s())return n;if(l)throw new TypeError(`Transform for "${i.fieldName}" returned a thenable; transforms must be synchronous`);return t}catch(e){if(!s())return n;let i=e instanceof Error?e:new Error(String(e));return t.emitter.emit("error",{error:i,context:"transform",code:"LP0602"}),n}}function ut(){if(typ','eof window>"u")return!1;try{return window.self!==window.top}catch{return!0}}function ct(e){let t=e.trim();if(0!==t.length)try{let e=new URL(t);return"http:"!==e.protocol&&"https:"!==e.protocol||!Br.test(e.origin)?void 0:e.origin}catch{return}}function ht(e){let t=e.format;return"string"==typeof t&&Hr.has(t)?t:"number"==typeof t?Vr[t]:void 0}function ft(e){let t=e.indent;return"number"==typeof t&&t>0?t:0}function pt(e){return"rtl"===e.direction?\' dir="rtl"\':"ltr"===e.direction?\' dir="ltr"\':""}function gt(e){let t=ht(e),i=ft(e),n=[];return void 0!==t&&n.push(`lp-align-${t}`),i>0&&n.push(`lp-indent-${String(i)}`),0===n.length?"":` class="${n.join(" ")}"`}function mt(e){return"object"==typeof e&&null!==e?e:void 0}function vt(e){return mt(e)}function yt(e,t){if(void 0===t||""===t||!e.startsWith("/"))return e;try{let i=new URL(t),n=new URL(e,i);return n.origin===i.origin?n.href:e}catch{return e}}function bt(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-").toLowerCase()}function wt(e){return"string"==typeof e&&e.length>0?e:void 0}function St(e){let t=wt(e.title)??wt(e.name)??wt(e.slug);return void 0!==t?t:void 0===e.id?void 0:String(e.id)}function kt(e){if("string"==typeof e.text)return e.text;if(!e.children)return"";let t="";for(let i of e.children)t+=kt(i);return t}function Tt(e){return`${"number"==typeof e.width?` width="${String(e.width)}"`:""}${"number"==typeof e.height?` height="${String(e.height)}"`:""}`}function At(e){return"string"==typeof e.mimeType?` type="${rt(e.mimeType)}"`:""}function Rt(e){return Qr.get(e)}function Ct(e,t,i,n){let r=mt(e.fields)??{},s="string"==typeof r.blockType?r.blockType:"",a=bt(s),l=""===a?n:`${n} ${n}--${a}`;if(""!==s){let e=Rt(s)??Rt(a);if(e)return e(r,{renderChildren:t.renderChildren});t.onUnrenderedBlock?.(s,l)}return`<${i} class="${l}"></${i}>`}function $t(e,t){return"number"==typeof t&&t>1?` ${e}="${String(t)}"`:""}function Ft(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 Nt(e,t){let i=function(e){return Yr.get(e)??Zr[e]}(e.type);return i?i(e,t):void 0!==e.children?t.renderChildren(e.children):""}function Ot(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 i of e.children)t+=Ot(i);return t}function Mt(e="text"){let t=new WeakSet;return{name:e,render:C((e,i)=>{let n=e.element,r=function(e){return null==e?"":Ft(e)?function(e){return Ft(e)?e.root.children.map(Ot).join("\\n").trim():""}(e):"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):JSON.stringify(e)}(i);if("INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName){if(function(e){return null!==e.querySelector(":scope > :not(br)")}(n)&&!n.hasAttribute(ts))return function(e,t,i){e.has(t)||(e.add(t),ai(`[live-preview] LP0402: Skipping text update for "${i}": <${t.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=Ke(function(e){return nt(e).replace(/\\r\\n|\\r|\\n/g,"<br>")}(r)):n.textContent=r}else n.value=r})}}function Lt(e,t){let i=e.cloneNode(!1);i.innerHTML=Ke(t);let n=function(e,t){let i=e.firstElementChild;if(null!==i?.nextElementSibling||t.children.length<2||!rs.has(i.tagName)||i.hasAttribute(sn))return null;for(let e of t.children)if(e.tagName===i.tagName&&e.className===i.className)return null;return i}(e,i)??e,r=new Map,s=i.querySelectorAll(Xr);if(s.length>0&&null!==n.firstElementChild){let e=[];Ut(n,i,e);for(let[t,i]of e)t.replaceWith(i),i.matches(Xr)||r.set(t.className,!1);for(let e of s)null!==e.parentNode&&r.set(e.className,!0)}return n.replaceChildren(...i.childNodes),r}function Ut(e,t,i){if(e.children.length!==t.children.length)return;let n=e.firstElementChild,r=t.firstElementChild;for(;null!==n&&null!==r;)r.matches(Xr)?i.push([r,n]):Ut(n,r,i),n=n.nextElementSibling,r=r.nextElementSibling}function Pt(e,t,i,n){n&&t.reportUnfaithful?.(e,`lost the markup the server drew for block "${i}"`);let r=n?ns:is;r.has(i)||(r.add(i),ai(`[live-preview] ${n?`LP0413: no renderer for block "${i}", and the markup the server rendered for it is lost.`:`LP0410: no renderer for block "${i}"; keeping what the server rendered for it.`} Register one with registerBlockRenderer().`))}function xt(e,t,i,n){if("string"!=typeof i||0===i.length)return{kind:"none"};let r=yt(i,n);return A(r)?{kind:"safe",url:r}:(ls.has(e)||(ls.add(e),ai(`[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,i,n){let r=e.element;if(at(i)){!function(e){"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):e.value=""}(r);return}let s=st(i);if("INPUT"!==r.tagName&&"TEXTAREA"!==r.tagName){if("A"===r.tagName){let i=e.hrefField,a=void 0===i||0===i.length?t(s):N(n.allFields,i,n.locale,void 0!==e.locale),l=xt(r,e.fieldName,a);"safe"===l.kind?r.setAttribute("href",l.url):"unsafe"===l.kind&&r.removeAttribute("href")}r.textContent=s}else r.value=s}}}function It(e){for(let t of cs)e.removeAttribute(t)}function _t(e,t,i,n){e.src=t;let r=function(e,t){if(void 0===e?.sizes)return;let i=[];for(let n of Object.values(e.sizes)){if("string"!=typeof n.url||"number"!=typeof n.width)continue;let e=yt(n.url,t);A(e)&&i.push(`${Bt(e)} ${String(n.width)}w`)}if(0!==i.length){if("number"==typeof e.width&&"string"==typeof e.url){let n=yt(e.url,t);A(n)&&i.push(`${Bt(n)} ${String(e.width)}w`)}return i.join(", ")}}(i,n);void 0!==r?e.setAttribute("srcset",r):(e.removeAttribute("srcset"),e.removeAttribute("sizes"))}function Bt(e){return e.replace(/[\\s,]/g,encodeURIComponent)}function jt(e){"IMG"===e.tagName?It(e):e.style.backgroundImage=""}function Wt(e){"IMG"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):It(e)}function Dt(e){let t=mt(e);return void 0===t?st(e):St(t)??""}function zt(e,t){let i=e??"";if(null==t)return i;let n=qt(t);return"{}"===n?i:`${i}|${n}`}function qt(e){if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(e=>qt(e)).join(",")}]`;let t=e,i=Object.keys(t).sort(),n=[];for(let e of i){let i=t[e];void 0!==i&&n.push(`${JSON.stringify(e)}:${qt(i)}`)}return`{${n.join(",")}}`}function Vt(e){return{kind:"date",options:e}}function Ht(e){return{kind:"number",options:e}}function Gt(e,t,i,n){if(void 0===t||""===t)return;let r=function(e){let t=e.indexOf(":"),i=-1===t?e:e.slice(0,t),n=-1===t?void 0:e.slice(t+1);switch(i){case"date":return void 0===n?Vt({dateStyle:"medium"}):ws.has(n)?Vt({dateStyle:n}):void 0;case"time":return void 0===n?Vt({timeStyle:"short"}):Ss.has(n)?Vt({timeStyle:n}):void 0;case"datetime":return void 0===n?Vt({dateStyle:"medium",timeStyle:"short"}):ws.has(n)?Vt({dateStyle:n,timeStyle:"short"===n?"short":"medium"}):void 0;case"number":return void 0===n?Ht({}):Ts.test(n)?Ht({minimumFractionDigits:Number(n),maximumFractionDigits:Number(n)}):void 0;case"currency":return void 0!==n&&ks.test(n)?Ht({style:"currency",currency:n.toUpperCase()}):void 0;case"percent":return void 0===n?Ht({style:"percent"}):void 0;default:return}}(t);if(void 0!==r)return r.kind===e?r.options:void 0;!function(e,t,i){As.has(e)||(As.add(e),ai(`[live-preview] LP0408: data-payload-format="${i}" on "${t}" is not a known format; the default formatting was used. Known: date, time, datetime (each also :short|medium|long|full), number, number:0-4, currency:XXX, percent.`))}(i,n,t)}function Jt(e){return String(e).padStart(2,"0")}function Kt(e,t){return{name:e,render(){b(t)}}}function Qt(){return typeof __LIVE_PREVIEW_CONFIG__>"u"?[]:__LIVE_PREVIEW_CONFIG__}var Xt=Object.defineProperty,Zt=e=>{throw TypeError(e)},Yt=(e,t,i)=>((e,t,i)=>t in e?Xt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i),ei=(e,t,i)=>t.has(e)||Zt("Cannot "+i),ti=(e,t,i)=>(ei(e,t,"read from private field"),i?i.call(e):t.get(e)),ii=(e,t,i)=>t.has(e)?Zt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),ni=(e,t,i,n)=>(ei(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),ri=(e,t,i)=>(ei(e,t,"access private method"),i),si=t((...e)=>console.error(...e)),ai=t((...e)=>console.warn(...e)),li=t((...e)=>console.debug(...e)),oi=class{constructor(){ii(this,ci);ii(this,di,new Map);ii(this,ui,new Map)}on(e,t){return ri(this,ci,fi).call(this,ti(this,di),e,t)}once(e,t){return ri(this,ci,fi).call(this,ti(this,ui),e,t)}off(e,t){ri(this,ci,pi).call(this,ti(this,di),e,t),ri(this,ci,pi).call(this,ti(this,ui),e,t)}async emit(e,t){await ri(this,ci,hi).call(this,e,t)}async emitWhile(e,t,i){return ri(this,ci,hi).call(this,e,t,i)}listenerCount(e){return(ti(this,di).get(e)?.size??0)+(ti(this,ui).get(e)?.size??0)}removeAllListeners(e){void 0!==e?(ti(this,di).delete(e),ti(this,ui).delete(e)):(ti(this,di).clear(),ti(this,ui).clear())}eventNames(){let e=new Set;for(let t of ti(this,di).keys())e.add(t);for(let t of ti(this,ui).keys())e.add(t);return[...e]}},di=new WeakMap,ui=new WeakMap,ci=new WeakSet,hi=async function(e,t,i){let n=()=>i?.()??!0;if(!n())return!1;let r=ti(this,di).get(e);if(r)for(let i of[...r])if(!n()||(await ri(this,ci,gi).call(this,i,t,e),!n()))return!1;if(!n())return!1;let s=ti(this,ui).get(e);if(s&&s.size>0){let i=[...s];ti(this,ui).delete(e);for(let r of i)if(!n()||(await ri(this,ci,gi).call(this,r,t,e),!n()))return!1}return n()},fi=function(e,t,i){let n=e.get(t);return n||(n=new Set,e.set(t,n)),n.add(i),()=>{ri(this,ci,pi).call(this,e,t,i)}},pi=function(e,t,i){let n=e.get(t);void 0!==n&&(n.delete(i),0===n.size&&e.delete(t))},gi=async function(e,t,i){try{await e(t)}catch(e){let t="string"==typeof i||"number"==typeof i?String(i):"<event>";si(`[live-preview] LP0601: handler for "${t}" threw:`,e)}},mi=new Set(["date","number","checkbox"]),vi=40,yi=["data","fieldSchemaJSON","globalSlug","collectionSlug","locale","ready","previewToken","protocolVersion"],bi={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"}},wi=Object.keys(bi),Si=class{constructor(e,t){Yt(this,"matcher");Yt(this,"handlers");Yt(this,"boundListener");Yt(this,"attachedTarget");Yt(this,"generation",0);Yt(this,"revision",0);Yt(this,"queueHead");Yt(this,"queueTail");Yt(this,"lastAccepted");Yt(this,"replayedGeneration",0);Yt(this,"latestAcceptedAttempt");this.matcher=e,this.handlers=t}attach(e=window){if(void 0!==this.attachedTarget)return;let t=!1,i=n=>{if(!t||this.boundListener!==i)return;let r=this.generation;try{this.receive(n,r,e)}catch{let e;try{e=n.origin}catch{e=""}this.reportInvalid("shape",e,r)}};this.generation+=1,this.resetQueue(),this.attachedTarget=e,this.boundListener=i;try{e.addEventListener("message",i)}catch(t){this.boundListener===i&&(this.attachedTarget=void 0,this.boundListener=void 0,this.resetQueue());try{e.removeEventListener("message",i)}catch{}throw t}if(this.boundListener===i)t=!0;else try{e.removeEventListener("message",i)}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)}replayLastAccepted(){let e=this.lastAccepted,t=this.generation,i=this.handlers.onReplay;if(void 0===i||void 0===e||e.generation>=t||this.replayedGeneration===t||!this.matchesOrigin(e.origin,t)||this.lastAccepted!==e)return!1;this.replayedGeneration=t;let n={generation:t,revision:this.revision+=1};return this.invokeHandler(t,i,structuredClone(e.message),e.origin,n),!0}forgetLastAccepted(){this.lastAccepted=void 0,this.replayedGeneration=0,this.latestAcceptedAttempt=void 0}static sendReady(e,t){let i={type:"payload-live-preview",ready:!0,protocolVersion:4};for(let n of e)for(let e of t)try{n.postMessage(i,e)}catch{}}receive(e,t,i){let n=e.origin;if(!this.matchesOrigin(n,t)){this.reportInvalid("origin",n,t);return}if(!this.matchesSource(e,i)){this.reportInvalid("source",n,t);return}let r=e.data;if(function(e){return"object"==typeof e&&null!==e&&"type"in e&&"string"==typeof e.type}(r))switch(r.type){case"payload-live-preview":if(!function(e){let t=e;return!(void 0!==t.data&&null!==t.data&&!m(t.data))&&g(t.fieldSchemaJSON,e=>Array.isArray(e))&&g(t.globalSlug,e=>"string"==typeof e)&&g(t.collectionSlug,e=>"string"==typeof e)&&g(t.locale,e=>"string"==typeof e)&&g(t.ready,e=>"boolean"==typeof e)&&g(t.previewToken,e=>"string"==typeof e)&&g(t.protocolVersion,e=>"number"==typeof e)}(r)){this.reportInvalid("shape",n,t);return}this.dispatchUpdate(function(e){let t={...e};for(let e of yi)null===Reflect.get(t,e)&&Reflect.deleteProperty(t,e);return Array.isArray(t.fieldSchemaJSON)?{...t,fieldSchemaJSON:c(t.fieldSchemaJSON)}:t}(r),n,t);return;case"payload-document-event":if(!function(e){let t=e;return p(t.action,e=>"updated"===e||"created"===e||"deleted"===e)&&p(t.slug,e=>"string"==typeof e)&&p(t.id,e=>"string"==typeof e||Number.isFinite(e))}(r)){this.reportInvalid("shape",n,t);return}this.invokeHandler(t,this.handlers.onDocumentEvent,r,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}(r);if(void 0===e){this.reportInvalid("shape",n,t);return}this.invokeHandler(t,this.handlers.onFocusField,e,n);return}default:this.reportInvalid("type",n,t)}else this.reportInvalid("shape",n,t)}dispatchUpdate(e,t,i){let n=m(e.data);if(!this.isCurrentGeneration(i))return;let r=n?{generation:i,revision:this.revision+=1}:void 0,s=this.handlers.validateToken;if(!this.isCurrentGeneration(i))return;if(void 0===s){this.commitUpdate(e,t,i,r);return}if(!0===e.ready&&void 0===e.data){this.commitUpdate(e,t,i,void 0);return}let a={generation:i,message:e,origin:t,messageRevision:r,verdict:void 0,next:void 0};this.enqueue(a);let l;try{l=s(e.previewToken,t)}catch{this.settleValidation(a,!1);return}"boolean"!=typeof l?Promise.resolve(l).then(e=>{this.settleValidation(a,!0===e)},()=>{this.settleValidation(a,!1)}):this.settleValidation(a,l)}settleValidation(e,t){e.verdict=t,this.drainQueue(e.generation)}drainQueue(e){for(;this.isCurrentGeneration(e);){let t=this.queueHead;if(void 0===t)return;if(this.matchesOrigin(t.origin,e)){if(void 0===t.verdict)return;this.dequeue(t)&&(t.verdict?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,i,n){if(void 0===n)this.invokeHandler(i,this.handlers.onUpdate,e,t);else{let r={};this.latestAcceptedAttempt=r;let s=function(e){let t={...e};delete t.previewToken;try{return structuredClone(t)}catch{return null}}(e);if(this.latestAcceptedAttempt!==r||!this.isCurrentGeneration(i))return;this.lastAccepted=null===s?void 0:{generation:i,message:s,origin:t},this.invokeHandler(i,this.handlers.onUpdate,e,t,n)}}reportInvalid(e,t,i){this.invokeHandler(i,this.handlers.onInvalid,e,t)}matchesSource(e,t){if("parent-or-opener"!==this.handlers.sourcePolicy)return!0;try{let i=e.source;if("object"!=typeof i||null===i)return!1;let n=t.parent;return n!==t&&i===n||i===t.opener}catch{return!1}}matchesOrigin(e,t){try{return!0===(this.isCurrentGeneration(t)&&this.matcher(e))&&this.isCurrentGeneration(t)}catch{return!1}}invokeHandler(t,i,...n){if(void 0!==i&&this.isCurrentGeneration(t))try{e(i(...n))}catch{}}isCurrentGeneration(e){return void 0!==this.attachedTarget&&this.generation===e}enqueue(e){void 0===this.queueTail?this.queueHead=e:this.queueTail.next=e,this.queueTail=e}dequeue(e){return this.queueHead===e&&(this.queueHead=e.next,void 0===this.queueHead&&(this.queueTail=void 0),!0)}resetQueue(){this.queueHead=void 0,this.queueTail=void 0}},ki={"structural arrays":\'data-payload-type="array" and keyed lists\',"array templates":"data-payload-array-template","server-rendered fragments":"data-payload-fragment boundaries","route refreshes":\'data-payload-strategy="route" and bindings in <head>\',"screen-reader announcements":"the aria-live region","auto-binding":"autoBind: \'unique\'"},Ti=new Set,Ai=new Set(["tabs","row","collapsible"]),Ri={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"},Ci=new Set(["http:","https:","mailto:","tel:"]),$i=/^(?:\\.{1,2}\\/|[a-zA-Z0-9_-]+\\/?)/,Fi=/^[\\\\/]{2}/,Ni=/[\\t\\n\\r]/g,Oi=/[\\s\\u0000-\\u001f\\u180e\\u2000-\\u2029]/g,Mi=/^([a-z][a-z0-9+.-]*):/i,Li=new Set(["style","srcdoc","formaction","form","id","name","is","srcset","imagesrcset"]),Ui=new Set(["href","src","poster","cite","action","xlink:href","data"]),Pi=new WeakSet,xi=class{constructor(){Yt(this,"previous",null);Yt(this,"lastFields");Yt(this,"priorFields");Yt(this,"keepValues",!1)}get previousFields(){return this.priorFields}get isBaseline(){return null===this.previous}diff(e,t,i=F){let n=this.previous,r=null===n,s=new Map,a=new Set,l=Object.entries(e);if(!i())return null;for(let[e,t]of l){let r=$(t);if(!i())return null;s.set(e,r),(null===n||void 0===r||n.get(e)!==r)&&a.add(e)}if(null!==n)for(let e of n.keys())s.has(e)||a.add(e);let o=new Set,d=Object.entries(t);if(!i())return null;for(let[e,t]of d)if(a.has(e))for(let e of t)if(o.add(e),!i())return null;return i()?(this.previous=s,this.priorFields=this.keepValues?this.lastFields:void 0,this.lastFields=this.keepValues?e:void 0,{changed:a,invalidated:o,baseline:r}):null}reset(){this.previous=null,this.lastFields=void 0,this.priorFields=void 0}},Ei=new Set(["__proto__","prototype","constructor"]),Ii="data-payload-fragment",_i="data-payload-strategy",Bi=8,ji=1024,Wi=new Set(["id","_id","createdAt","updatedAt","createdBy","updatedBy","_status","globalType","collection","locale","localized"]),Di=new Set(["text","textarea","email","number","checkbox","date","select","radio","point","code","json","ui","html"]),zi=new Set(["root","paragraph","text","heading","quote","list","listitem","linebreak","tab","horizontalrule","code","code-highlight","table","tablerow","tablecell","link","autolink"]),qi={},Vi=class{constructor(){Yt(this,"rawChanges",new xi);Yt(this,"resolved",null);Yt(this,"resolvedLocale",null);Yt(this,"trailing",null);Yt(this,"openUntil",0);Yt(this,"requestAttempt",0)}decide(e,t){let i=t.rawData;if(!function(e){let{cache:t,emitter:i}=e;if(t.islands.length>0||i.listenerCount("beforeUpdate")>0||i.listenerCount("afterUpdate")>0)return!0;for(let e of t.values())if(J(e)||e.fieldName.includes(".")||X(e.hrefField)||X(e.srcField)||X(e.altField))return!0;return void 0!==e.strategies.fragment&&null!==e.root.querySelector(`[${Ii}]`)}(e)&&!function(e,t,i){for(let n of e.values()){if("text"!==n.fieldType||!0===n.explicitFieldType)continue;let e=M(t,n,n.fieldName,i);if(ie(e)&&K(e.root))return!0}return!1}(e.cache,i,t.locale))return t.forceRender&&(this.resolvedLocale=null),{merge:!1,fields:i};let{changed:n}=this.rawChanges.diff(i,qi),r=this.resolvedLocale!==t.locale,s=this.resolved;if(null===s)return this.resolved=i,{merge:!0,fields:i};let a={...s};t.forceRender&&(this.resolvedLocale=null);let l=t.forceRender||r;for(let r of n){let n=i[r];if(Wi.has(r)){a[r]=n;continue}let o=G(r,s[r],n,e.cache,t.schemaIndex);"own"!==o&&(l=!0,this.resolvedLocale=null),"keep"!==o&&(a[r]=n)}return this.resolved=a,{merge:l,fields:a}}request(e,t,i){let n=++this.requestAttempt,r=Date.now();if(r>=this.openUntil)return this.openUntil=r+t,this.dropQueued(),this.requestAttempt!==n?{leading:!0,result:Promise.resolve({status:"superseded"})}:{leading:!0,result:e.merge(i)};let s=this.trailing,a=s?.pending??function(){let e;return{promise:new Promise(t=>{e=t}),settle:e}}(),l={request:i,pending:a,timer:null};if(this.trailing=l,this.openUntil=r+t,null!==s&&null!==s.timer&&clearTimeout(s.timer),this.trailing!==l)return{leading:!1,result:a.promise};let o=setTimeout(()=>{this.flush(e,l)},t);return this.trailing===l?l.timer=o:clearTimeout(o),{leading:!1,result:a.promise}}recordMerged(e,t){this.resolved=e,this.resolvedLocale=t}resetRawChanges(){this.rawChanges.reset()}destroy(){this.requestAttempt+=1,this.openUntil=0,this.dropQueued()}dropQueued(){let e=this.trailing;this.trailing=null,null!==e&&(null!==e.timer&&clearTimeout(e.timer),e.pending.settle({status:"superseded"}))}flush(e,t){this.trailing===t&&(this.trailing=null,t.timer=null,e.merge(t.request).then(t.pending.settle))}},Hi=class{constructor(){Yt(this,"negotiation",v(void 0));Yt(this,"observed",new Set)}observe(e,t){let i=e.filter(e=>!this.observed.has(e));if(0!==i.length){for(let e of i)this.observed.add(e);this.negotiation=v(this.negotiation.theirs,this.observed),t("protocol",`observed=${i.join(",")}`)}}applyVersion(e,t){let i=this.negotiation;if(i.theirs===e)return;let n=v(e,this.observed);this.negotiation=n,n.negotiated!==i.negotiated&&t("protocol","ours=4",`theirs=${e}`,`negotiated=${n.negotiated}`)}},Gi=class{constructor(){Yt(this,"lastIdentity")}inspect(e){let t=e.externallyUpdatedRelationship;if("object"!=typeof t||null===t)return null;let i=JSON.stringify([t.entitySlug,B(t),t.updatedAt]);return{identity:i,edit:i!==this.lastIdentity&&Z(t,e)?t:null}}commit(e){let t=e.identity!==this.lastIdentity;return this.lastIdentity=e.identity,t?e.edit:null}},Ji=class{constructor(){ii(this,Ki)}reveal(e,t,i){return e===ti(this,Ki)?"skipped-same":(ni(this,Ki,e),function(e,t){return function(e,t){let i=e.getBoundingClientRect(),n=i.bottom>0&&i.top<t.innerHeight,r=i.right>0&&i.left<t.innerWidth;return n&&r}(e,t)?"already-visible":(e.scrollIntoView({behavior:ee(t)?"auto":"smooth",block:"center"}),"revealed")}(t,i))}reset(){ni(this,Ki,void 0)}},Ki=new WeakMap,Qi=class{constructor(){Yt(this,"seen",new Map)}note(e,t,i){let n=$(i);if(void 0===n)return;let r=`${t.owner??""}\\0${t.locale??""}\\0${t.fieldName}`,s=this.seen.get(r);void 0!==s?s!==n&&(e.revealIdentities.push([r,n]),e.revealTarget??(e.revealTarget=t)):this.seen.set(r,n)}commit(e){for(let[t,i]of e.revealIdentities)this.seen.set(t,i);e.revealIdentities=[];let t=e.revealTarget;return e.revealTarget=void 0,t}},Xi=()=>{},Zi=class{constructor(){Yt(this,"host",{outstanding:()=>!1,report:Xi,failed:Xi});Yt(this,"entry",null);Yt(this,"ended")}begin(e,t){let i=this.entry,n=null===i?void 0:this.view(i);null!==i&&(i.key=void 0),this.ended=void 0,this.entry={key:e,revision:t,shortfalls:[],seen:new Set,deferred:0,awaiting:0,reported:void 0,queued:!1},null!==i&&void 0!==n&&this.publish(i,"pending"===n.state?{...n,state:"superseded"}:n)}end(){let e=this.entry;if(null!==e){this.entry=null;try{this.ended=this.view(e)}finally{e.key=void 0}}}snapshot(){return null!==this.entry?this.view(this.entry):void 0===this.ended?void 0:{...this.ended,shortfalls:[...this.ended.shortfalls]}}shortfall(e,t){let i=this.entry;if(i?.key!==e)return;let n=JSON.stringify(t);i.seen.has(n)||(i.seen.add(n),i.shortfalls.push(t),this.requestSettle(i.key))}deferred(e,t){this.entry?.key===e&&(this.entry.deferred=t)}handIsland(e){let t=this.entry;if(t?.key!==e)return Xi;t.awaiting+=1;let i=!1;return()=>{i||this.entry!==t||(i=!0,t.awaiting-=1,this.settle(t))}}requestSettle(e){let t=this.entry;t?.key!==e||t.queued||(t.queued=!0,queueMicrotask(()=>{t.queued=!1;try{this.entry===t&&this.settle(t)}catch(e){this.host.failed(e)}}))}settle(e){let t=this.view(e);"pending"!==t.state&&this.publish(e,t)}publish(e,t){e.reported!==t.state&&(e.reported=t.state,this.host.report(t))}view(e){let t=void 0!==e.key&&this.host.outstanding(e.key)?"pending":e.shortfalls.length>0?"partial":e.awaiting>0?"unconfirmed":"current";return{revision:e.revision,state:t,shortfalls:[...e.shortfalls],deferred:e.deferred,awaitingIslands:e.awaiting}}},Yi=class{constructor(){Yt(this,"started",!1);Yt(this,"suspended",!1);Yt(this,"deferredStart",null);Yt(this,"hydration","idle");Yt(this,"activeUpdate",null);Yt(this,"locale");Yt(this,"schema");Yt(this,"schemaIndex");Yt(this,"updateCount",0);Yt(this,"supersededCount",0);Yt(this,"completedCount",0);Yt(this,"skippedUnchangedCount",0);Yt(this,"lastFlush",null);Yt(this,"absentFields",new Set);Yt(this,"warnedOrphanFields",new Set);Yt(this,"warnedStrategy",new WeakSet);Yt(this,"warnedUnattributableMessage",!1);Yt(this,"warnedVisibilityGate",!1);Yt(this,"warnedFragmentFallback",!1);Yt(this,"warnedIslandStart",!1);Yt(this,"warnedEscalationUnavailable",!1);Yt(this,"warnedProtocolShape",!1);Yt(this,"reportedUnfaithful",new WeakSet);Yt(this,"checkedServerFormat",new WeakSet);Yt(this,"unfaithfulPatches",[]);Yt(this,"unfaithfulCount",0);Yt(this,"escalatedCount",0);Yt(this,"unfaithfulFields",new Set);Yt(this,"autoBindSearchMs");Yt(this,"autoBindGuesses",null);Yt(this,"warnedForeignSource",!1);Yt(this,"lastAppliedIdentity",new WeakMap);Yt(this,"navigationReplayPending",!1);Yt(this,"navigationBindingReplay",!1);Yt(this,"revealLedger",new Qi);Yt(this,"display",new Zi);Yt(this,"fragmentStats",{rendered:0,failed:0,superseded:0});Yt(this,"routeStats",{refreshes:0,partial:0,failed:0,refused:0,loopStopped:0});Yt(this,"fragmentControllers",new Map);Yt(this,"routeController",null);Yt(this,"routeRetry",null);Yt(this,"routeRefreshOwed",!1);Yt(this,"routeAwaitsSave",!1);Yt(this,"fragmentsOwed",new Set);Yt(this,"readyTimers",[]);Yt(this,"revealer",new Ji);Yt(this,"changes",new xi);Yt(this,"merges",new Vi);Yt(this,"protocol",new Hi);Yt(this,"relationships",new Gi)}isRunning(){return this.started}isCurrent(e){return this.started&&this.activeUpdate===e}complete(e){this.display.requestSettle(e),!e.completed&&(e.completed=!0,e.countsAsUpdate&&(this.completedCount+=1))}forgetOwedWork(){this.routeRefreshOwed=!1,this.routeAwaitsSave=!1,this.fragmentsOwed.clear()}supersedeStrategies(){null!==this.routeRetry&&(clearTimeout(this.routeRetry),this.routeRetry=null,this.routeRefreshOwed=!0);for(let[e,t]of this.fragmentControllers){for(let e of t)this.fragmentsOwed.add(e);e.abort()}this.fragmentControllers.clear()}abortStrategies(){this.supersedeStrategies();let e=this.routeController;this.routeController=null,e?.abort()}},en=class{constructor(e,t){Yt(this,"deps",e);Yt(this,"state",t);Yt(this,"instanceContext");this.instanceContext=function(e){let t={};for(let[i,n]of Object.entries(e))void 0!==n&&(t[i]=n);return t}({renderRichText:e.renderRichText,sanitizerPolicy:e.sanitizerPolicy,serverURL:e.serverURL,reportUnfaithful:(i,n)=>{r(e,t,i,n)}})}apply(e){let{deps:t,state:i}=this,n=i.activeUpdate;if(null===n||void 0===e.revision||!y(n.revision,e.revision)||!i.isCurrent(n))return!1;let{target:s,value:o}=e,d=void 0!==n.schemaIndex?T(n.schemaIndex,s.fieldName):void 0,u=function(e,t){if(e.explicitFieldType)return e.fieldType;if(void 0!==t){let e=function(e){if(Object.prototype.hasOwnProperty.call(Ri,e))return Ri[e]}(t);if(void 0!==e)return e}return e.fieldType}(s,d?.type);"text"===u&&!0!==s.explicitFieldType&&ie(o)&&(u="richText");let c;try{c=t.resolveRenderer(u,s)}catch(e){return this.fail(n,s.fieldName,e)}if(!i.isCurrent(n))return!1;let h=t.emitter.listenerCount("elementUpdate")>0,f=h?function(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value:"IMG"===e.tagName?e.src:e.textContent}(s.element):void 0;if(!i.isCurrent(n))return!1;let p={allFields:e.allFields,locale:s.locale??n.locale,schema:d,...this.instanceContext};!0===s.hidesWhenEmpty&&s.element.toggleAttribute("hidden",function(e){return null==e||("string"==typeof e?0===e.trim().length:Array.isArray(e)&&0===e.length)}(o));try{if(void 0!==s.targetAttribute){if("blocked"===function(e,t,i){let n=t.toLowerCase().trim();if(0===n.length||!function(e){return!e.startsWith("on")&&!Li.has(e)}(n))return"blocked";if(null==i)return e.removeAttribute(n),"applied";if("string"!=typeof i&&"number"!=typeof i&&"boolean"!=typeof i)return"blocked";let r=String(i);return Ui.has(n)&&!A(r)?"blocked":(e.setAttribute(n,r),"applied")}(s.element,s.targetAttribute,o))return t.warn(`[live-preview] LP0401: refused to write "${s.fieldName}" into attribute "${s.targetAttribute}"`),i.display.shortfall(n,{kind:"write",field:s.fieldName,code:"LP0401"}),!1}else{if(void 0===c)return t.log("no renderer for",u),r(t,i,s,`has no renderer for "${u}"`),!1;{let e=function(e,t,i,n){if("ignore"===e.onUnfaithfulPatch||void 0!==i.format||!mi.has(n)||t.checkedServerFormat.has(i.element))return;t.checkedServerFormat.add(i.element);let r=a(i.element);return r.trim().length>0?r:void 0}(t,i,s,u);if(!1===function(e,t,i,n){return e.render(t,i,n)}(c,s,o,p)&&function(e){return Pi.has(e.render)}(c))return r(t,i,s,`is a value ${c.name} cannot render`),!1;void 0!==e&&function(e,t,i){let n=a(t.element);n!==i&&e.warn(`[live-preview] LP0412: "${t.fieldName}" showed ${l(i)}, the patch wrote ${l(n)} \\u2014 either an edit that arrived before the preview connected, or a template that formats this value differently. Set data-payload-format to match it.`)}(t,s,e)}}}catch(e){return this.fail(n,s.fieldName,e)}if(!i.isCurrent(n))return!1;h&&t.emitter.emitWhile("elementUpdate",{element:s.element,fieldName:s.fieldName,previousValue:f,nextValue:o,revision:n.revision.revision,receivedAt:n.receivedAt,source:"patch"},()=>i.isCurrent(n));let g=i.isCurrent(n);return g&&(void 0!==e.valueIdentity?i.lastAppliedIdentity.set(s.element,e.valueIdentity):i.lastAppliedIdentity.delete(s.element)),g}fail(e,t,i){if(!this.state.isCurrent(e))return!1;this.state.display.shortfall(e,{kind:"write",field:t,code:"LP0603"});let n=i instanceof Error?i:new Error(String(i));return this.deps.emitter.emitWhile("error",{error:n,context:"renderer",code:"LP0603"},()=>this.state.isCurrent(e)),!1}},tn="payload-live-preview:update",nn="data-payload-island",rn=`astro-island, [${nn}]`,sn="data-payload-field",an="data-payload-type",ln="data-payload-attribute",on="data-payload-href",dn="data-payload-src",un="data-payload-alt",cn="data-payload-array-template",hn="data-payload-array-separator",fn="data-payload-locale",pn="data-payload-richtext",gn="data-payload-html",mn="data-payload-array",vn="data-payload-structural",yn="data-payload-owner",bn="data-payload-depends",wn="data-payload-strategy",Sn="data-payload-boundary",kn="data-payload-covers",Tn=[sn,an,ln,on,dn,un,cn,hn,fn,pn,gn,mn,vn,yn,bn,wn,Sn,"type"],An=`[${sn}]`,Rn=`[${yn}]`,Cn=`[${Ii}], [${wn}="route"]`,$n=/^[a-z][a-z0-9-]*:[a-z][a-z0-9-]*$/i,Fn=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"]),Nn=class{constructor(e={}){Yt(this,"entriesByField",new Map);Yt(this,"entryByElement",new WeakMap);Yt(this,"filter");Yt(this,"count",0);Yt(this,"dependencies",null);Yt(this,"islandRoots",[]);Yt(this,"ownersByIsland",new Map);Yt(this,"navigationRoots",[]);Yt(this,"coverDeclarations",[]);Yt(this,"renderedDeclarations",[]);this.filter=e.filter??fe}dependencyMap(){if(null!==this.dependencies)return this.dependencies;let e=[];for(let t of this.values())void 0!==t.dependsOn&&e.push(se(t.fieldName,t.dependsOn));return this.dependencies=re(...e),this.dependencies}get islands(){return this.islandRoots}get islandOwners(){return this.ownersByIsland}get covers(){return this.coverDeclarations}get rendered(){return this.renderedDeclarations}get navigationReplayRoots(){return this.navigationRoots}buildFromRoot(e){let t=performance.now();this.clear();let i=0;for(let t of e.querySelectorAll(An))void 0!==this.add(t)&&(i+=1);return this.islandRoots=function(e){let t=[];for(let i of e.querySelectorAll(rn))ae(i)||t.push(i);return t}(e),this.ownersByIsland=new Map(this.islandRoots.map(e=>[e,de(e)])),this.navigationRoots=[...e.querySelectorAll(Cn)].filter(e=>this.filter(e)&&(e.hasAttribute(Ii)||0===(e.getAttribute(sn)??"").length)),this.coverDeclarations=[...e.querySelectorAll(`[${kn}]`)].filter(e=>this.filter(e)).map(e=>({paths:ne(e.getAttribute(kn)),owner:de(e)})),this.renderedDeclarations=[...e.querySelectorAll(`[${bn}]`)].filter(e=>this.filter(e)).flatMap(e=>{let t=function(e){if((e.getAttribute(Ii)??"").length>0)return"fragment";let t=e.getAttribute(wn);return null!==t?"route"===t?"route":void 0:e.hasAttribute(sn)&&null!==e.closest("head")?"route":void 0}(e);return void 0===t?[]:[{strategy:t,paths:ne(e.getAttribute(bn)),owner:de(e)}]}),{elementCount:i,fieldCount:this.entriesByField.size,durationMs:performance.now()-t}}add(e){let t=this.filter(e)?this.resolveBinding(e):void 0,i=this.entryByElement.get(e);if(this.dependencies=null,void 0!==t)return void 0!==i&&this.replaceEntry(i,t)?(this.entryByElement.set(e,t),t):(void 0!==i&&this.removeEntry(e,i),this.append(t),this.entryByElement.set(e,t),t);void 0!==i&&this.removeEntry(e,i)}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=[],this.ownersByIsland=new Map,this.navigationRoots=[],this.coverDeclarations=[],this.renderedDeclarations=[]}replaceEntry(e,t){if(e.fieldName!==t.fieldName)return!1;let i=this.entriesByField.get(e.fieldName),n=void 0===i?-1:i.indexOf(e);return!(void 0===i||n<0||(i[n]=t,0))}removeEntry(e,t){this.entryByElement.delete(e);let i=this.entriesByField.get(t.fieldName),n=void 0===i?-1:i.indexOf(t);return!(void 0===i||n<0||(i.splice(n,1),0===i.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(sn);if(null===t||0===t.length)return;let i=e.getAttribute(an),n=e.getAttribute(ln),r=e.getAttribute(on),s=e.getAttribute(dn),a=e.getAttribute(un),l=e.getAttribute(cn),o=e.getAttribute(hn),d=e.getAttribute(fn),u=e.getAttribute("data-payload-format"),c=de(e),h=ne(e.getAttribute(bn)),f=e.getAttribute(wn),p=e.getAttribute("data-payload-guessed"),g=U(e);return{element:e,fieldName:t,fieldType:he(e),explicitFieldType:null!==i&&ue(i),strategyKind:P(e)??"unknown",...null!==g?{fragmentBoundary:g}:{},...null!==n&&n.length>0?{targetAttribute:n}:{},...null!==r&&r.length>0?{hrefField:r}:{},...null!==s&&s.length>0?{srcField:s}:{},...null!==a&&a.length>0?{altField:a}:{},...null!==l?{arrayTemplate:l}:{},...null!==o?{arraySeparator:o}:{},...null!==d&&d.length>0?{locale:d}:{},...null!==u&&u.length>0?{format:u}:{},...void 0!==c?{owner:c}:{},...h.length>0?{dependsOn:h}:{},...null!==f&&f.length>0?{strategy:f}:{},...e.hasAttribute(Sn)?{hidesWhenEmpty:!0}:{},...null!==p?{guessed:p}:{}}}},On=64,Mn=1e4,Ln=1e3,Un=64,Pn=8192,xn=1048576,En=1e4,In=20,_n=new Set(["__proto__","constructor","prototype"]),Bn=class{constructor(e){Yt(this,"serverURL");Yt(this,"apiRoute");Yt(this,"depth");Yt(this,"fetchFn");Yt(this,"log");Yt(this,"inflight",null);Yt(this,"attempt",0);Yt(this,"destroyDepth",0);this.serverURL=function(e){let t=e.length;for(;e.endsWith("/",t);)t-=1;return e.slice(0,t)}(e.serverURL);let n=e.apiRoute??"/api";this.apiRoute=n.startsWith("/")?n:`/${n}`,this.depth=e.depth??1,this.fetchFn=e.fetchFn,this.log=t(e.log??i)}canMerge(e){try{let t=e.schema;return void 0!==t?(Te(e.data,t,this.serverURL,this.apiRoute,this.depth,e.locale),!0):null!==this.endpointOf(e)}catch{return!1}}endpointOf(e){try{let t=e.globalSlug;if(t)return $e(t)?{path:`globals/${encodeURIComponent(t)}`,field:"globalType",value:t}:null;let i=e.collectionSlug??"",n=e.data.id;return $e(i)&&Fe(n)?{path:`${encodeURIComponent(i)}/${encodeURIComponent(String(n))}`,field:"id",value:String(n)}:null}catch{return null}}async merge(e){if(this.destroyDepth>0)return{status:"superseded"};let t=this.attempt+=1,i=this.inflight;this.inflight=null;let n=null,r=!1,s=()=>this.attempt!==t;try{if(i?.abort(),s())return{status:"superseded"};let t=e.schema;if(r=void 0!==t,void 0!==t){let i=Te(e.data,t,this.serverURL,this.apiRoute,this.depth,e.locale);if(s())return{status:"superseded"};if(0===i.requests.length)return{status:"merged",doc:i.doc};let r=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(s())return{status:"superseded"};if(void 0===r)return{status:"unavailable"};n=new AbortController,this.inflight=n;for(let e of i.requests){let t=await r(e.url,{method:"GET",credentials:"include",redirect:"error",signal:n.signal});if(s())return{status:"superseded"};let i=t.ok;if(s())return{status:"superseded"};if(!i){let e=t.status;return s()?{status:"superseded"}:(n.abort(),s()?{status:"superseded"}:(this.log("merge HTTP",e),s()?{status:"superseded"}:{status:"unavailable"}))}let a=await Ae(t,n.signal,()=>!s());if(s())return{status:"superseded"};if(Re(e,a),s())return{status:"superseded"}}return{status:"merged",doc:i.doc}}let a=this.endpointOf(e);if(s())return{status:"superseded"};if(null===a)return{status:"unavailable"};let l=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(s())return{status:"superseded"};if(void 0===l)return{status:"unavailable"};let o=JSON.stringify({data:e.data,depth:this.depth,flattenLocales:!1,locale:e.locale});if(s())return{status:"superseded"};n=new AbortController,this.inflight=n;let d=`${this.serverURL}${this.apiRoute}/${a.path}`,u=await l(d,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","X-Payload-HTTP-Method-Override":"GET"},body:o,signal:n.signal});if(s())return{status:"superseded"};let c=u.ok;if(s())return{status:"superseded"};if(!c){let e=u.status;return s()?{status:"superseded"}:(this.log("merge HTTP",e,d),s()?{status:"superseded"}:{status:"unavailable"})}let h=u.json.bind(u);if(s())return{status:"superseded"};let f=await h();if(s())return{status:"superseded"};if(null===f||"object"!=typeof f||Array.isArray(f))return this.log("merge invalid",d),s()?{status:"superseded"}:{status:"unavailable"};let p=f,g=p[a.field],m=Object.hasOwn(p,a.field)&&("id"===a.field?!Fe(g)||String(g)!==a.value:g!==a.value);return s()?{status:"superseded"}:m?(this.log("merge invalid",d),s()?{status:"superseded"}:{status:"unavailable"}):{status:"merged",doc:p}}catch(e){return s()||r&&(n?.abort(),s())?{status:"superseded"}:(this.log("merge exception",r?new Error("legacy population could not be resolved"):e),s()?{status:"superseded"}:{status:"unavailable"})}finally{this.inflight===n&&(this.inflight=null)}}destroy(){this.attempt+=1;let e=this.inflight;this.inflight=null,this.destroyDepth+=1;try{e?.abort()}finally{this.destroyDepth-=1}}},jn="2.2.0",Wn={name:"payload-2",fieldTyping:"schema",populatesRelationships:"admin",documentEvents:!1},Dn={name:"payload-3",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!0},zn={name:"unknown",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!1},qn="ssr",Vn=1,Hn=class{constructor(e,t={}){Yt(this,"callbacks");Yt(this,"debounceMs");Yt(this,"rootMargin");Yt(this,"visible",new Set);Yt(this,"mutation",null);Yt(this,"intersection",null);Yt(this,"debounceTimer",null);Yt(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 i=t+1;if(this.generation!==i)return;let n=null,r=null;try{n=new MutationObserver(e=>{this.handleMutations(e,i)}),r=new IntersectionObserver(e=>{this.handleIntersection(e,i)},{rootMargin:this.rootMargin,threshold:0}),n.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...Tn,nn,qn]})}catch(e){throw n?.disconnect(),r?.disconnect(),e}this.generation===i?(this.mutation=n,this.intersection=r):(n.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,i=this.intersection;this.debounceTimer=null,this.mutation=null,this.intersection=null,this.visible.clear(),null!==e&&clearTimeout(e);try{t?.disconnect()}finally{i?.disconnect()}}handleMutations(e,t){if(!this.isCurrentGeneration(t))return;for(let i of e){let e=Oe(i);if(null!==e&&(this.callbacks.onIslandHydrated?.(e),!this.isCurrentGeneration(t)))return}if(!function(e){for(let t of e){if("attributes"===t.type&&t.attributeName===nn||"attributes"===t.type&&null!==t.attributeName&&Tn.includes(t.attributeName)&&(t.attributeName===sn||t.attributeName===yn||t.target.nodeType===Vn&&t.target.hasAttribute(sn)))return!0;for(let e of t.addedNodes)if(Me(e))return!0;for(let e of t.removedNodes)if(Me(e))return!0}return!1}(e))return;null!==this.debounceTimer&&clearTimeout(this.debounceTimer);let i=setTimeout(()=>{!this.isCurrentGeneration(t)||this.debounceTimer!==i||(this.debounceTimer=null,this.callbacks.onStructuralChange())},this.debounceMs);this.debounceTimer=i}handleIntersection(e,t){for(let i of e){if(!this.isCurrentGeneration(t))return;let{target:e}=i;if(i.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}},Gn=class{constructor(e){ii(this,Xn);ii(this,Jn,[]);ii(this,Kn);ii(this,Qn,!1);ni(this,Kn,e)}get closed(){return ti(this,Qn)}own(e){ti(this,Qn)?ri(this,Xn,Zn).call(this,e):ti(this,Jn).push(e)}close(){if(ti(this,Qn))return;ni(this,Qn,!0);let e=ti(this,Jn).splice(0).reverse();for(let t of e)ri(this,Xn,Zn).call(this,t)}},Jn=new WeakMap,Kn=new WeakMap,Qn=new WeakMap,Xn=new WeakSet,Zn=function(e){try{e()}catch(e){ti(this,Kn).call(this,"runtime cleanup failed:",e)}},Yn="__livePreviewHydration",er="[data-payload-field]",tr="__vue_app__",ir="__livePreviewVueHydration",nr="app:suspense:resolve",rr={react:(e,t)=>function(e,t=5e3){Ue();let i=Le();if(void 0===i)return null;if(void 0===i.onCommit){let e=e=>{!i.committed&&function(e){let t=e;return null!=t&&function(e){let t=e;return 9===t?.nodeType||null!=t?.querySelector?.(er)}(t.containerInfo)&&!function(e){let t=[];for(null!==e.current&&void 0!==e.current&&t.push(e.current);t.length>0;){let e=t.pop();if(void 0===e)continue;let i=e.memoizedState;if((13===e.tag||31===e.tag)&&"object"==typeof i&&null!==i&&"dehydrated"in i&&"object"==typeof i.dehydrated&&null!==i.dehydrated&&"nodeType"in i.dehydrated&&8===i.dehydrated.nodeType)return!0;null!==e.sibling&&void 0!==e.sibling&&t.push(e.sibling),null!==e.child&&void 0!==e.child&&t.push(e.child)}return!1}(t)}(e)&&Pe(i)};i.onCommit=e;for(let t of i.commits.splice(0))e(t)}return Ee(i,e,t)}(t),vue:function(e,t,i=5e3){Be();let n=Ie();return void 0===n?null:(!n.committed&&function(e){for(let t=e.querySelector(er);null!==t;t=t.parentElement)if(void 0!==_e(t))return!0;return!1}(e)&&Pe(n),Ee(n,t,i))},sveltekit:function(e,t,i=5e3){let n=e.ownerDocument??e,r=()=>null!==n.querySelector("#svelte-announcer");if(r()||!Object.keys(window).some(e=>e.startsWith("__sveltekit_")))return null;let s={committed:!1,waiters:[]},a=new MutationObserver(()=>{!s.committed&&r()&&Pe(s)});a.observe(n,{childList:!0,subtree:!0});let l=Ee(s,e=>{a.disconnect(),t(e)},i);return()=>{a.disconnect(),l?.()}}},sr={react:"React commit",vue:"Vue mount",sveltekit:"SvelteKit mount"},ar=class{constructor(e){Yt(this,"timeoutMs");Yt(this,"onTimeout");Yt(this,"handle",null);Yt(this,"lastKick",null);this.timeoutMs=e.timeoutMs??0,this.onTimeout=e.onTimeout}kick(){this.lastKick=Date.now(),!(this.timeoutMs<=0)&&(this.stop(),this.arm(this.timeoutMs))}resume(){if(this.timeoutMs<=0||null!==this.handle||null===this.lastKick)return!1;let e=Math.max(0,Date.now()-this.lastKick),t=this.timeoutMs-e;return t<=0?(this.lastKick=null,this.onTimeout(),!0):(this.arm(Math.min(t,this.timeoutMs)),!1)}arm(e){let t=setTimeout(()=>{this.handle===t&&(this.handle=null,this.lastKick=null,this.onTimeout())},e);this.handle=t}stop(){null!==this.handle&&(clearTimeout(this.handle),this.handle=null)}get lastKickAt(){return this.lastKick??0}get pending(){return null!==this.handle}},lr=class{constructor(){Yt(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)}},or=class{constructor(e,t,i){Yt(this,"deps",e);Yt(this,"state",t);Yt(this,"host",i);Yt(this,"awaitingHydration",new WeakSet);Yt(this,"delivered",new WeakMap);Yt(this,"confirmations",new WeakMap)}reapplyBindings(e){let t=this.currentTransaction();void 0!==t?.renderData&&this.host.schedule(t,t.renderData,e)}reapplyIslands(e,t=!1){let i=t?e.filter(e=>this.awaitingHydration.delete(e)):e,n=this.state.activeUpdate,r=t&&null!==n&&this.state.isCurrent(n)?n:this.currentTransaction();void 0!==r?.renderData&&this.dispatchIslands(r,r.renderData,i)}dispatchIslands(e,t,i){let n=qe(this.deps,this.state,e,t.fields),r=()=>!e.cancelled&&this.state.isCurrent(e);if(!r())return;let s=this.delivered.get(t);void 0===s&&(s=new WeakSet,this.delivered.set(t,s));for(let a of i){let i=de(a);if(!r())return;if(!1!==n&&!_(i,n)){this.awaitingHydration.delete(a);continue}let l=this.confirmation(a,e);if(oe(a))this.awaitingHydration.add(a);else{if(this.awaitingHydration.delete(a),s.has(a))continue;s.add(a),Ve(e,t,[a],r,l)}}}hasLateRouteBinding(e,t,i,n){for(let n of e){if((n.getAttribute(sn)??"").length>0||"route"!==n.getAttribute(wn)||!1!==t&&!_(de(n),t))continue;let e=ne(n.getAttribute(bn));if(0===e.length||e.some(e=>i.touched.has(e)))return!0}for(let[r,s]of this.deps.cache.entries())for(let a of s){if(!e.has(a.element)||!1!==t&&!_(a.owner,t)||"route"!==(a.strategyKind??P(a.element)??"unknown"))continue;let s=M(n.fields,a,r,i.locale);if(!this.state.isCurrent(i))return!1;if(void 0!==s)return!0}return!1}fieldsForElements(e,t){let i=new Set(t);for(let[t,n]of this.deps.cache.entries())n.some(t=>e.has(t.element))&&i.add(t);return i}unrunFragmentPlan(e,t,i){if(null===t)return null;let n=t.boundaries.filter(t=>!e.fragmentBoundariesRun.has(t)&&(void 0===i||[...i].some(e=>e===t||t.contains(e))));if(0===n.length)return null;let r=new Set(n);return{...t,boundaries:n,covers:e=>void 0!==e.fragmentBoundary&&r.has(e.fragmentBoundary)}}confirmation(e,t){let i=this.confirmations.get(e);if(i?.transaction===t)return i.displayed;let n=this.state.display.handIsland(t);return this.confirmations.set(e,{transaction:t,displayed:n}),n}currentTransaction(){let e=this.state.activeUpdate;return this.state.navigationBindingReplay&&null!==e&&this.state.isCurrent(e)?e:null}},dr="payload-live-preview",ur=Symbol.for("payload-live-preview.trusted-types"),cr="__payloadLivePreviewDeprecationsWarned",hr=new Set,fr="data-payload-",pr=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"]),gr=new Set(["input","button","textarea","select","option","label"]),mr=new Set(["script","style","iframe","object","embed","link","meta","base","form","input","button","select","textarea","svg","math","template","frame","frameset","noframes","noscript"]),vr=new Set(["id","class","lang","dir","title","role","tabindex"]),yr="aria-",br="data-",wr="data-payload-",Sr={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"])},kr=new Set(["href","src","cite","poster"]),Tr=6,Ar=1,Rr=8,Cr=(Error,new Set(["id","name","data-payload-key","data-payload-morph","data-payload-nested-key","data-payload-nested-template"])),$r="strict",Fr=(Object.freeze({allowedTags:pr,removeCompletely:mr,globalAttributes:vr,attributesByTag:Sr,urlAttributes:kr}),Object.freeze({"&":"&","<":"<",">":">",\'"\':""","\'":"'","/":"/","`":"`","=":"="})),Nr=/[&<>"\'/`=]/g,Or=Object.freeze({"&":"&","<":"<",">":">",\'"\':""","\'":"'"}),Mr=/[&<>"\']/g,Lr=new Set,Ur={kind:"merge"},Pr=class{constructor(e,t,i){Yt(this,"deps",e);Yt(this,"state",t);Yt(this,"strategies");Yt(this,"navigationReplay");t.changes.keepValues="declared"===e.subfieldCoverage,t.display.host=function(e,t){return{outstanding:i=>!i.completed||i.pendingFragments>0||null!==t.routeController||null!==t.routeRetry||e.scheduler.pendingCount>0,report:t=>{"partial"===t.state&&e.a11y?.announcePartial(),e.emitter.emit("revisionDisplay",t)},failed:t=>{e.log("revision display failed:",t)}}}(e,t),this.strategies=function(e,t){return{planFragments:()=>null,escalateUnfaithful:(e,i,n)=>{for(let{fieldName:i}of n)t.display.shortfall(e,{kind:"unfaithful",field:i})},hasUnboundChange:(i,n)=>{if(i.baseline)return!1;let r=function(e,t,i,n,r){let s=q(e,n,void 0),a=H(e,i,n,s),l=[];for(let e of t){if(Wi.has(e))continue;let t=a(e);if("none"===t&&l.push(e),"below"!==t||void 0===r)continue;let n=V(e,i),{previous:o,next:d}=r;for(let{path:t}of z(n,o[e],d[e],s))l.push(t)}return l}(e.cache,i.touched,i.locale,n,function(e,t,i){return"declared"===e&&void 0!==t&&void 0!==i?{previous:t,next:i}:void 0}(e.subfieldCoverage,t.changes.previousFields,i.renderData?.fields));for(let e of r)s(t,e),t.display.shortfall(i,{kind:"unbound",field:e});return!1},plansRoute:()=>!1,runFragments:()=>Promise.resolve(),refreshRoute:()=>(b("route refreshes"),Promise.resolve()),refreshAfterSave:()=>{},warnFragmentFallback:i=>{b("server-rendered fragments"),function(e,t,i){t.warnedFragmentFallback||(t.warnedFragmentFallback=!0,e.warn(`[live-preview] LP0806: "${i.fieldName}" asks for the fragment strategy but no handler is configured; patching instead`))}(e,t,i)},warnUnsupportedStrategy:i=>{!function(e,t,i){t.warnedStrategy.has(i.element)||(t.warnedStrategy.add(i.element),e.warn(`[live-preview] LP0407: "${i.fieldName}" asks for strategy "${String(i.strategy)}"; only patch, fragment and route exist`))}(e,t,i)}}}(e,t),this.navigationReplay=new or(e,t,{schedule:(e,t,i)=>{this.scheduleAllFields(e,t,i)}})}handleUpdate(e,t,i){let{deps:n,state:r}=this;n.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),n.log);let s=e.data;void 0!==s?void 0!==i&&this.acceptDataUpdate(e,s,t,i,!0):void 0!==e.protocolVersion&&r.protocol.applyVersion(e.protocolVersion,n.log)}handleReplay(e,t,i){let n=e.data;void 0!==n&&this.acceptDataUpdate(e,n,t,i,!1)}reapplyNavigationBindings(e){this.navigationReplay.reapplyBindings(e)}reapplyNavigationIslands(e,t=!1){this.navigationReplay.reapplyIslands(e,t)}acceptDataUpdate(e,t,i,n,r){let{deps:s,state:a}=this,l=r?a.relationships.inspect(e):null,o="string"==typeof e.locale?e.locale:a.locale,d=a.schema,u=a.schemaIndex;Array.isArray(e.fieldSchemaJSON)&&(d=e.fieldSchemaJSON,u=function(e,t=""){let i=new Map;return k(e,t,i,!1),k(e,t,i,!0),i}(e.fieldSchemaJSON));let c=a.activeUpdate;if(!a.isRunning()||null!==c&&c.revision.revision>n.revision)return;let h=null===l?null:a.relationships.commit(l),f=c,p={revision:n,message:e,rawData:t,locale:o,schema:d,schemaIndex:u,receivedAt:Date.now(),forceRender:null!==h||Y(f),countsAsUpdate:r,renderData:void 0,fragmentBoundariesRun:new WeakSet,touched:new Set,baseline:!1,invalidated:new Set,revealTarget:void 0,revealIdentities:[],pendingFragments:0,routeRefreshed:!1,cancelled:!1,completed:!1};a.locale=o,a.schema=d,a.schemaIndex=u,null!==f&&!f.completed&&f.countsAsUpdate&&(a.supersededCount+=1),a.activeUpdate=p,r&&(a.updateCount+=1),a.display.begin(p,n.revision),a.isCurrent(p)&&(s.scheduler.acceptRevision(n),a.isCurrent(p)&&(a.supersedeStrategies(),a.isCurrent(p)&&(null!==h&&(s.emitter.emitWhile("relationshipUpdate",{detail:h,timestamp:Date.now()},()=>a.isCurrent(p)),!a.isCurrent(p))||r&&void 0!==e.protocolVersion&&(a.protocol.applyVersion(e.protocolVersion,s.log),!a.isCurrent(p))||r&&s.connection.markConnected()&&(s.a11y?.announceConnected(),s.emitter.emit("connect",{origin:i,timestamp:Date.now()}),!a.isCurrent(p)||(s.log("connection","disconnected","\\u2192","connected"),!a.isCurrent(p)))||this.processUpdate(p).catch(e=>{s.log("update failed:",e)}))))}async processUpdate(e){let{deps:t,state:i}=this,n=await this.resolveIncomingFields(e);if(null===n||!i.isCurrent(e))return;let r=this.dataFor(e,n);t.emitter.listenerCount("beforeUpdate")>0&&(!await t.emitter.emitWhile("beforeUpdate",{data:r,revision:e.revision.revision,receivedAt:e.receivedAt,source:"patch",cancel:()=>{e.cancelled=!0,t.scheduler.cancelRevision(e.revision)}},()=>!e.cancelled&&i.isCurrent(e))||e.cancelled||!i.isCurrent(e))||this.applyFields(e,r,!1)}dataFor(e,t){let{message:i}=e;return{fields:t,...void 0!==e.schema?{schema:e.schema}:{},..."string"==typeof i.globalSlug?{globalSlug:i.globalSlug}:{},..."string"==typeof i.collectionSlug?{collectionSlug:i.collectionSlug}:{},...void 0!==e.locale?{locale:e.locale}:{}}}applyFields(e,t,i){let{deps:n,state:r}=this;if(!r.isCurrent(e)||r.changes.isBaseline&&!i&&"off"!==n.autoBind&&(b("auto-binding"),!r.isCurrent(e)))return;let s=re(n.dependencies,n.cache.dependencyMap());if(!r.isCurrent(e))return;let a=r.changes.diff(t.fields,s,()=>r.isCurrent(e));if(null===a)return;let l=!i&&r.navigationReplayPending;l&&(r.navigationReplayPending=!1,r.navigationBindingReplay=!0),e.baseline=a.baseline&&!l,e.invalidated=i?Lr:a.invalidated,e.touched=i?Lr:new Set([...a.changed,...a.invalidated]),e.renderData=t,this.scheduleAllFields(e,t)}async resolveIncomingFields(e){let{deps:t,state:i}=this,n=e.rawData;if(null===t.merger)return n;let r=i.merges.decide(t,e);if(!r.merge)return r.fields;let{message:s}=e,a=i.merges.request(t.merger,t.mergeWindowMs,{collectionSlug:s.collectionSlug,globalSlug:s.globalSlug,data:n,...void 0===e.schema?{}:{schema:e.schema},locale:e.locale});if(!a.leading)return this.applyMerged(e,a.result).catch(e=>{t.log("update failed:",e)}),r.fields;let l=await a.result;return i.isCurrent(e)?"merged"===l.status?(i.merges.recordMerged(l.doc,e.locale),l.doc):"superseded"===l.status?null:(i.display.shortfall(e,Ur),r.fields):null}async applyMerged(e,t){let{state:i}=this,n=await t;"unavailable"===n.status&&i.display.shortfall(e,Ur),"merged"===n.status&&i.isCurrent(e)&&(i.merges.recordMerged(n.doc,e.locale),this.applyFields(e,this.dataFor(e,n.doc),!0))}scheduleAllFields(e,t,i){let{deps:n,state:r}=this;if(!r.isCurrent(e))return;let s=void 0!==i,a=()=>r.isCurrent(e),l=qe(n,r,e,t.fields);if(!a())return;let{touched:o}=e,d=n.strategies.route;if(s&&void 0!==d&&!e.routeRefreshed&&this.navigationReplay.hasLateRouteBinding(i,l,e,t)){a()&&this.strategies.refreshRoute(e,t,d);return}let u=!s&&this.strategies.hasUnboundChange(e,l),c=r.routeRefreshOwed;if(!s&&void 0!==d&&!e.routeRefreshed&&(u||c||this.strategies.plansRoute(d,o,l))&&a()){r.routeRefreshOwed=!1,this.strategies.refreshRoute(e,t,d);return}let h=s?this.navigationReplay.fieldsForElements(i,o):o,f=this.navigationReplay.unrunFragmentPlan(e,this.strategies.planFragments(h,l),i);if(!a())return;let p=n.skipUnchanged,g=0;for(let[o,d]of n.cache.entries()){if(!a())return;for(let u of d){if(void 0!==i&&!i.has(u.element)||!1!==l&&!_(u.owner,l))continue;if(!0===f?.covers(u)){if(n.revealEditedField){let i=M(t.fields,u,o,e.locale);r.revealLedger.note(e,u,i)}continue}let d=u.strategyKind??P(u.element)??"unknown";if("unknown"===d){this.strategies.warnUnsupportedStrategy(u);continue}"fragment"===d&&null===f&&this.strategies.warnFragmentFallback(u);let c=M(t.fields,u,o,e.locale);if(void 0===c){r.absentFields.add(o);continue}if(!s&&n.revealEditedField&&r.revealLedger.note(e,u,c),!a())return;let h=dt(n,u,c,t.fields,a);if(!a())return;let m=p?L(u,h,t.fields,e.locale):void 0,v=r.lastAppliedIdentity.get(u.element);if(!e.forceRender&&n.skipUnchanged&&void 0!==m&&v===m&&!e.invalidated.has(o)){r.skippedUnchangedCount+=1;continue}let y={target:u,value:h,allFields:t.fields,revision:e.revision,...s?{}:{data:t},valueIdentity:m};n.scheduler.schedule(y),g+=1}}if(s||function(e,t,i,n,r){let{cache:s,strategies:a}=e,l={cache:s,warned:t,warn:e.warn};if(0===s.fieldCount||!1!==r&&!function(e,t){for(let i of e.values())if(_(i.owner,t))return!0;return!1}(s,r))return;let o=function(e,t,i,n){let r=H(e,t,i,q(e,i,n));return e=>"none"!==r(e)}(s,n,r,a);for(let[e,t]of Object.entries(i)){if(Wi.has(e))continue;if(Ge(t)){He(l,o,e,n,t);continue}if(!Je(t)||o(e))continue;let i=V(e,n);for(let[e,r]of Object.entries(t))!Ge(r)||Wi.has(e)||He(l,o,`${i}.${e}`,n,r)}if("declared"!==e.subfieldCoverage)return;let d=function(e,t,i,n,r){let s=q(e,n,r),a=H(e,i,n,s),l=[];for(let[e,n]of Object.entries(t)){if(Wi.has(e)||"below"!==a(e))continue;let t=V(e,i);l.push(...z(t,void 0,n,s))}return l}(s,i,n,r,a);for(let{path:e,value:t}of d)if(Ge(t)&&He(l,o,e,n,t),Je(t))for(let[i,r]of Object.entries(t))Ge(r)&&He(l,o,`${e}.${i}`,n,r)}(n,r.warnedOrphanFields,t.fields,e.locale,l),a()){if(null!==f&&f.boundaries.length>0){for(let t of f.boundaries)e.fragmentBoundariesRun.add(t);e.pendingFragments+=f.boundaries.length,this.strategies.runFragments(e,t,f)}s||!a()||0===g&&(0===e.pendingFragments&&0===n.scheduler.pendingCount&&(r.complete(e),this.revealPending(e)),this.notifyIslands(e,t))}}notifyIslands(e,t){0!==e.touched.size&&this.navigationReplay.dispatchIslands(e,t,this.deps.cache.islands)}restoreGuesses(e,t){let{deps:i,state:n}=this;"off"===i.autoBind||n.autoBindGuesses}onFlush(e){let{deps:t,state:i}=this;i.lastFlush=e,e.deferred>0&&!i.warnedVisibilityGate&&(i.warnedVisibilityGate=!0,t.warn(`[live-preview] LP0301: visibility gate held ${String(e.deferred)} off-screen update(s) until scrolled into view; see visibilityGateThreshold`));let{revision:n,data:r}=e;if(void 0===n)return;let s=i.activeUpdate;if(null===s||!i.isCurrent(s)||!y(s.revision,n))return;i.display.deferred(s,e.deferred),0===s.pendingFragments&&i.complete(s);let a=()=>i.isCurrent(s)&&y(s.revision,n),l=r??s.renderData;if(this.revealPending(s),!a())return;let o=i.unfaithfulPatches;if(o.length>0){if(i.unfaithfulPatches=[],void 0!==l){let e=qe(t,i,s,l.fields);this.strategies.escalateUnfaithful(s,l,o,e)}if(!a())return}void 0!==r&&(e.applied>0&&t.a11y?.announceUpdate(e.applied),a()&&(this.notifyIslands(s,r),a()&&0!==e.applied&&0!==t.emitter.listenerCount("afterUpdate")&&t.emitter.emitWhile("afterUpdate",{data:r,updatedCount:e.applied,durationMs:e.durationMs,revision:n.revision,receivedAt:s.receivedAt,source:"patch"},a)))}revealPending(e){let t=this.state.revealLedger.commit(e);if(void 0!==t)try{te(this.state.revealer,t)}catch(e){this.deps.log("reveal",e)}}revealField(e){let t=this.deps.cache.get(e)?.[0];return void 0===t?"no-element":te(this.state.revealer,t)}documentSaved(){this.strategies.refreshAfterSave()}},xr=class{constructor(e,t){Yt(this,"apply");Yt(this,"debounceMs");Yt(this,"maxWaitMs");Yt(this,"isVisible");Yt(this,"gateThresholdValue");Yt(this,"gateDisabled");Yt(this,"getCacheSize");Yt(this,"onFlush");Yt(this,"scheduleFrame");Yt(this,"cancelFrame");Yt(this,"pending",new Map);Yt(this,"replay",new Map);Yt(this,"activeFlushes",new Set);Yt(this,"debounceTimer",null);Yt(this,"debounceToken",0);Yt(this,"deadlineTimer",null);Yt(this,"frameHandle",null);Yt(this,"frameFallback",null);Yt(this,"frameToken",0);Yt(this,"windowUntil",0);Yt(this,"activeRevision",null);Yt(this,"activeRevisionCancelled",!1);Yt(this,"destroying",!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(this.destroying||void 0!==e.revision&&(this.activeRevisionCancelled||null===this.activeRevision||!y(e.revision,this.activeRevision)))return;let t=this.pending.get(e.target.element);t?(t.value=e.value,t.allFields=e.allFields,t.revision=e.revision,t.data=e.data,t.valueIdentity=e.valueIdentity):this.pending.set(e.target.element,{target:e.target,value:e.value,allFields:e.allFields,revision:e.revision,data:e.data,valueIdentity:e.valueIdentity}),this.armDebounce()}acceptRevision(e){this.destroying||null!==this.activeRevision&&y(e,this.activeRevision)||null!==this.activeRevision&&function(e,t){return e.generation!==t.generation?e.generation-t.generation:e.revision-t.revision}(e,this.activeRevision)<0||(this.clearWork(),this.activeRevision=e,this.activeRevisionCancelled=!1,this.cancelScheduledWork())}cancelRevision(e){null===this.activeRevision||!y(e,this.activeRevision)||(this.clearWork(),this.activeRevisionCancelled=!0,this.cancelScheduledWork())}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 i=performance.now(),n=this.didApply(t)?1:0;this.onFlush?.(this.statsFor(t,n,0,performance.now()-i,1===n?[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(){if(!this.destroying){this.destroying=!0;try{this.clearWork(),this.activeRevision=null,this.activeRevisionCancelled=!1,this.windowUntil=0,this.cancelScheduledWork()}finally{this.destroying=!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=Date.now(),t=e>=this.windowUntil;if(this.windowUntil=e+this.debounceMs,t){this.requestFrame();return}let i=this.debounceToken+=1,n=this.debounceTimer;if(this.debounceTimer=null,null!==n&&clearTimeout(n),this.debounceToken!==i)return;let r=setTimeout(()=>{this.debounceToken===i&&(this.debounceTimer=null,this.pending.size>0&&this.requestFrame())},this.debounceMs);this.debounceToken===i&&(this.debounceTimer=r),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,this.clearFrameFallback(),null!==t&&this.cancelFrame(t),this.frameToken!==e)return;let i=!1,n=()=>{if(this.frameToken!==e||i)return;i=!0;let t=this.frameHandle;this.frameHandle=null,this.clearFrameFallback(),null!==t&&this.cancelFrame(t),this.flush()},r=this.scheduleFrame(n);i||this.frameToken!==e||(this.frameHandle=r,this.frameFallback=setTimeout(n,100))}clearFrameFallback(){clearTimeout(this.frameFallback??void 0),this.frameFallback=null}flush(){let e=performance.now();this.clearDeadline();let t=this.gateActive,i=this.pending;this.pending=new Map;let n,r=0,s=[],a=0;this.activeFlushes.add(i);try{for(let e of i.values()){if(!this.isCurrent(e))continue;let i=!t||this.isVisible(e.target.element);if(this.isCurrent(e)){if(n??(n=e),!i){this.replay.set(e.target.element,e),a+=1;continue}this.replay.delete(e.target.element),this.didApply(e)&&(r+=1,s.push(e.target.fieldName))}}}finally{this.activeFlushes.delete(i)}let l=this.statsFor(n,r,a,performance.now()-e,s);return this.onFlush?.(l),l}isCurrent(e){return void 0===e.revision||!this.activeRevisionCancelled&&null!==this.activeRevision&&y(e.revision,this.activeRevision)}didApply(e){return!1!==this.apply(e)||!function(e){return Pi.has(e)}(this.apply)}retargetBuffer(e,t){let i=e.get(t.element);if(void 0!==i){if(!ce(i.target,t)){e.delete(t.element);return}i.target=t}}clearWork(){this.pending.clear(),this.replay.clear();for(let e of this.activeFlushes)e.clear()}statsFor(e,t,i,n,r){return{applied:t,appliedFields:r,deferred:i,durationMs:n,...void 0!==e?.revision?{revision:e.revision}:{},...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(),this.clearFrameFallback(),null!==e&&clearTimeout(e),null!==t&&this.cancelFrame(t)}},Er=[0,500,1e3,2e3],Ir=class{constructor(e){Yt(this,"deps");Yt(this,"state",new Yi);Yt(this,"pipeline");Yt(this,"writer");Yt(this,"rootSentinel",null);Yt(this,"scope",null);Yt(this,"closingSession",!1);Yt(this,"observedRoot",null);Yt(this,"replayRetainedOnStart",!1);let{emitter:r,renderers:s}=e,a=void 0===e.log?i:t(e.log),l=void 0===e.warn?ai:t(e.warn),o=e.root??(typ','eof document<"u"?document:void 0);if(void 0===o)throw new Error("LivePreviewRuntime: no document; pass options.root");let d=new Nn({filter:e=>!function(e){let t=e;for(;null!==t;){if(le(t))return!0;t=t.parentElement}return!1}(e)}),u=new Hn({onStructuralChange:()=>{this.rebuildCache()},onIslandHydrated:e=>{this.pipeline.reapplyNavigationIslands([e],!0)},onVisibilityChange:(e,t)=>{t&&c.notifyVisible(e)}},void 0!==e.intersectionRootMargin?{intersectionRootMargin:e.intersectionRootMargin}:{}),c=new xr(C(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:()=>d.elementCount,onFlush:e=>{this.pipeline.onFlush(e)}}),h=new Si(e.originMatcher,{onUpdate:(e,t,i)=>{this.pipeline.handleUpdate(e,t,i)},onReplay:(e,t,i)=>{this.pipeline.handleReplay(e,t,i)},onDocumentEvent:()=>{this.state.protocol.observe(["document-events"],a),r.emit("documentSave",{timestamp:Date.now()}),this.pipeline.documentSaved()},onFocusField:e=>{this.deps.revealEditedField&&this.pipeline.revealField(e)},onInvalid:(e,t)=>{if("token"===e){let e=new Error(`Preview token rejected (origin: ${t})`);r.emit("error",{error:e,context:"token",code:"LP0502"})}("shape"===e||"type"===e)&&!this.state.warnedProtocolShape&&(this.state.warnedProtocolShape=!0,l(`[live-preview] LP0503: ${t} posted a message this runtime does not recognise (${"type"===e?"unknown message type":"unexpected shape"}); it was ignored. A newer Payload or a custom sender: check that the versions match.`)),"source"===e&&!this.state.warnedForeignSource&&(this.state.warnedForeignSource=!0,l(`[live-preview] LP0501: a message from ${t} was ignored because it did not come from the window that framed or opened this page. \\`eventSourcePolicy\\` is \'parent-or-opener\' by default since 2.0, where 1.x accepted any window on a trusted origin. Set \\`eventSourcePolicy: \'any\'\\` if the admin posts from elsewhere.`)),a("LP0501 message rejected:",e,t)},...void 0!==e.validateToken?{validateToken:e.validateToken}:{},...void 0!==e.eventSourcePolicy?{sourcePolicy:e.eventSourcePolicy}:{}}),f=e.dataMerge;this.deps={emitter:r,cache:d,observers:u,scheduler:c,bus:h,connection:new lr,heartbeat:new ar({...void 0!==e.heartbeatMs?{timeoutMs:e.heartbeatMs}:{},onTimeout:()=>{this.onHeartbeatTimeout()}}),renderers:s,resolveRenderer:e.resolveRenderer??(e=>s[e]),transformValue:e.transformValue,renderRichText:e.renderRichText,sanitizerPolicy:e.sanitizerPolicy,root:o,readyTargets:"function"==typeof e.readyTargets?e.readyTargets:(e=>()=>e)(e.readyTargets),sendReady:e.sendReady??S,onHeartbeatTimeout:e.onHeartbeatTimeout,log:a,warn:l,a11y:w(e),serverURL:f?.serverURL,merger:void 0===f?null:new Bn({serverURL:f.serverURL,...void 0!==f.apiRoute?{apiRoute:f.apiRoute}:{},...void 0!==f.depth?{depth:f.depth}:{},...void 0!==f.fetchFn?{fetchFn:f.fetchFn}:{},log:a}),mergeWindowMs:e.debounceMs??50,scopeBindingsByOwner:!0===e.scopeBindingsByOwner,subfieldCoverage:e.subfieldCoverage??"descendant",lockedOrigin:e.lockedOrigin??(()=>{}),skipUnchanged:!0===e.skipUnchanged,dependencies:e.dependencies??{},strategies:e.strategies??{},revealEditedField:!0===e.revealEditedField,onUnfaithfulPatch:n(e),autoBind:e.autoBind??"off",hydration:e.hydration},this.writer=new en(this.deps,this.state),this.pipeline=new Pr(this.deps,this.state,()=>{this.rebuildCache()})}start(){let{state:e}=this;if(e.isRunning()||this.closingSession)return!1;e.suspended&&(this.replayRetainedOnStart=!0),e.started=!0,e.suspended=!1,this.openScope();try{return function(e){"react"===e.hydration?Ue():"vue"===e.hydration&&Be();let{root:t}=e;if(!De(t)||"loading"!==t.readyState){je(e);return}let i=()=>{e.isRunning()&&e.later(()=>{je(e)})};t.addEventListener("DOMContentLoaded",i,{once:!0}),e.defer(()=>{t.removeEventListener("DOMContentLoaded",i)})}(this.startupHost()),!0}catch(e){throw this.rollbackFailedStart(),e}}startupHost(){let{state:e,deps:t}=this;return{root:t.root,hydration:t.hydration,isRunning:()=>e.isRunning(),defer:t=>{e.deferredStart=t,this.scope?.own(()=>{e.deferredStart===t&&(e.deferredStart=null,t())})},later:t=>{e.deferredStart=null;try{t()}catch(e){this.rollbackFailedStart(),this.reportError(e,"startup","LP0605")}},hydrated:t=>{e.hydration=t},warn:t.warn,startNow:()=>{this.startNow()}}}startNow(){let{state:e,deps:t}=this;if(!e.isRunning())return;let i=De(t.root)?ze(t.root):t.root;if(null===i)throw new Error("LivePreviewRuntime: document.body unavailable");if(t.observers.start(i),this.observedRoot=i,this.watchRootReplacement(),this.buildCacheAndObserve(),!e.isRunning()||(t.bus.attach(),t.emitter.emitWhile("init",{timestamp:Date.now()},()=>e.isRunning()),!e.isRunning()))return;let n=this.replayRetainedOnStart;this.replayRetainedOnStart=!1;let r=n&&t.heartbeat.resume();if(e.isRunning()&&(!n||r||(e.forgetOwedWork(),e.merges.resetRawChanges(),e.unfaithfulPatches=[],e.revealer.reset(),e.lastAppliedIdentity=new WeakMap,e.changes.reset(),e.navigationReplayPending=!0,t.bus.replayLastAccepted()||(e.navigationReplayPending=!1),e.isRunning())))for(let i of Er){if(!e.isRunning())return;0===i?t.sendReady(t.readyTargets()):e.readyTimers.push(setTimeout(()=>{e.isRunning()&&this.sendReadyAfterStart()},i))}}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 i=!!e.isRunning()&&this.release();e.suspended=!1,this.replayRetainedOnStart=!1,t.bus.forgetLastAccepted(),i&&t.emitter.emit("disconnect",{reason:"destroy",timestamp:Date.now()}),t.a11y?.detach(),t.emitter.emit("destroy",{timestamp:Date.now()})}openScope(){let{state:e,deps:t}=this,i=new Gn(t.log);i.own(()=>{t.merger?.destroy(),e.merges.destroy()}),i.own(()=>{t.scheduler.destroy()}),i.own(()=>{t.observers.stop()}),i.own(()=>{this.rootSentinel?.disconnect(),this.rootSentinel=null,this.observedRoot=null}),i.own(()=>{e.abortStrategies()}),i.own(()=>{t.bus.detach()}),i.own(()=>{t.heartbeat.stop()}),i.own(()=>{for(let t of e.readyTimers)clearTimeout(t);e.readyTimers.length=0}),this.scope=i}release(){let{state:e,deps:t}=this;e.display.end(),e.activeUpdate=null,e.navigationBindingReplay=!1,e.started=!1;let i=this.scope;this.scope=null,this.closingSession=!0;try{i?.close()}finally{this.closingSession=!1}return t.cache.clear(),t.connection.markDisconnected()}rollbackFailedStart(){this.release();try{this.deps.a11y?.detach()}catch(e){this.deps.log("runtime cleanup failed:",e)}}refreshCache(){this.state.isRunning()&&(this.state.revealer.reset(),this.followReplacedRoot()||this.rebuildCache())}navigationCommit(){let{state:e,deps:t}=this;!e.isRunning()||null!==e.deferredStart||(this.cancelActiveUpdate(!0),t.merger?.destroy(),e.merges.destroy(),e.abortStrategies(),this.cancelActiveUpdate(!0),e.forgetOwedWork(),e.merges.resetRawChanges(),e.unfaithfulPatches=[],e.revealer.reset(),e.lastAppliedIdentity=new WeakMap,e.changes.reset(),e.isRunning()&&(t.bus.advanceGeneration(),e.navigationReplayPending=!0,this.followReplacedRoot()||this.rebuildCache(),e.isRunning()&&(t.bus.replayLastAccepted(),e.isRunning()&&this.sendReadyAfterStart())))}watchRootReplacement(){let{root:e}=this.deps;!De(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()||!De(e))return!1;let t=ze(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:i,scheduler:n}=e,r=t.protocol.negotiation,s=t.activeUpdate,a=t.lastFlush,l=[],o=new Set,d=[];for(let[e,t]of i.entries()){l.push(e);for(let i of t)void 0!==i.owner&&o.add(i.owner),void 0!==i.guessed&&d.push({field:e,matched:i.guessed,attribute:i.targetAttribute??("IMG"===i.element.tagName?"src":void 0)})}return{version:jn,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:Ne(r.observed).name},revisions:{accepted:t.updateCount,superseded:t.supersededCount,completed:t.completedCount,skippedUnchanged:t.skippedUnchangedCount,active:null===s?void 0:s.revision.revision,display:t.display.snapshot()},bindings:{elements:i.elementCount,fields:i.fieldCount,fieldNames:l.sort(),absentFields:[...t.absentFields].sort(),orphanFields:[...t.warnedOrphanFields].sort(),ownerScoped:e.scopeBindingsByOwner,owners:[...o].sort(),guessed:d.sort((e,t)=>e.field.localeCompare(t.field)),autoBind:{mode:e.autoBind,searchMs:t.autoBindSearchMs}},route:{handler:void 0!==e.strategies.route,...t.routeStats},fidelity:{mode:e.onUnfaithfulPatch,canEscalate:void 0!==e.strategies.fragment||void 0!==e.strategies.route,unfaithful:t.unfaithfulCount,escalated:t.escalatedCount,fields:[...t.unfaithfulFields].sort()},hydration:{mode:e.hydration??"off",state:t.hydration},fragments:{handler:void 0!==e.strategies.fragment,inFlight:s?.pendingFragments??0,...t.fragmentStats},scheduler:{pending:n.pendingCount,deferred:n.replayCount,visibilityGateThreshold:n.gateThreshold,visibilityGateActive:n.gateActive,lastFlush:null===a?void 0:{applied:a.applied,appliedFields:a.appliedFields,deferred:a.deferred,durationMs:a.durationMs}},plugins:[],renderers:Object.keys(e.renderers).sort()}}(this.deps,this.state)}buildCacheAndObserve(){let{state:e,deps:t}=this;if(!e.isRunning())return;let i=t.cache.buildFromRoot(t.root);if(t.log("cache",i),e.isRunning()&&(t.emitter.emitWhile("cacheRefresh",i,()=>e.isRunning()),e.isRunning()))for(let i of t.cache.values()){if(!e.isRunning())return;t.observers.observeElement(i.element)}}rebuildCache(){let{state:e,deps:t}=this;if(!e.isRunning())return;let i=new Map,n=t.cache.islandOwners,r=new Set(t.cache.navigationReplayRoots);for(let e of t.cache.values())i.set(e.element,e),t.observers.unobserveElement(e.element);if(this.buildCacheAndObserve(),!e.isRunning())return;let s=new Set(t.cache.navigationReplayRoots.filter(e=>!r.has(e)));for(let e of t.cache.values()){let n=i.get(e.element);void 0!==n&&ce(n,e)?t.scheduler.retarget(e):(t.scheduler.forget(e.element),s.add(e.element)),i.delete(e.element)}for(let e of i.values())t.scheduler.forget(e.element);s.size>0&&this.pipeline.reapplyNavigationBindings(s);let a=t.cache.islands.filter(e=>!n.has(e)||t.scopeBindingsByOwner&&n.get(e)!==t.cache.islandOwners.get(e));a.length>0&&this.pipeline.reapplyNavigationIslands(a)}onHeartbeatTimeout(){let{state:e,deps:t}=this;if(!e.isRunning()||(this.cancelActiveUpdate(!1),t.merger?.destroy(),e.merges.destroy(),e.abortStrategies(),this.cancelActiveUpdate(!1),!e.isRunning()))return;t.bus.advanceGeneration(),t.bus.forgetLastAccepted(),e.navigationBindingReplay=!1;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())}cancelActiveUpdate(e){let{state:t,deps:i}=this,n=t.activeUpdate;t.display.end(),t.activeUpdate=null,null!==n&&(n.cancelled=!0,i.scheduler.cancelRevision(n.revision),e&&!n.completed&&n.countsAsUpdate&&(t.supersededCount+=1))}sendReadyAfterStart(){try{this.deps.sendReady(this.deps.readyTargets())}catch(e){this.reportError(e,"ready","LP0606")}}reportError(e,t,i){let n=e instanceof Error?e:new Error(String(e));this.deps.emitter.emit("error",{error:n,context:t,code:i})}isIdleDisconnected(){return this.state.isRunning()&&"disconnected"===this.deps.connection.status&&null===this.state.activeUpdate}},_r=/^https?:\\/\\/(localhost|127\\.0\\.0\\.1)(?::\\d+)?$/i,Br=/^https?:\\/\\/[^/?#\\s]+$/i,jr=[3e3,3001,3333,4e3,4321,5e3,5173,5174,8e3,8080,8888,9e3],Wr=class{constructor(e={}){ii(this,Dr);let t=new Set;for(let i of e.additionalOrigins??[]){let e=ct(i);void 0!==e&&t.add(e)}let i;if(e.enableReferrerDetection??1){let t=e.referrer??(typ','eof document<"u"?document.referrer:"");if(t.length>0)try{let e=new URL(t).origin;e&&"null"!==e&&(i=e)}catch{}}let n=(e.enableLocalhostMatching??!0)&&(e.forceDevMode??function(){let e=function(){if(!(typ','eof process>"u"))return"production"}();if(void 0!==e)return"production"!==e;if(typ','eof window<"u"){let e=window.location.hostname;return"localhost"===e||"127.0.0.1"===e}return!1}());ni(this,Dr,[t,i,n,void 0!==i,void 0])}matches(e){return 0!==e.length&&"null"!==e&&(void 0!==ti(this,Dr)[4]?e===ti(this,Dr)[4]:!!(ti(this,Dr)[0].has(e)||0===ti(this,Dr)[0].size&&void 0!==ti(this,Dr)[1]&&e===ti(this,Dr)[1]||ti(this,Dr)[2]&&_r.test(e)))}lockOrigin(e){return!!this.matches(e)&&(ti(this,Dr)[4]=e,!0)}unlockOrigin(){let e=ti(this,Dr)[4];return ti(this,Dr)[4]=void 0,e}get lockedOrigin(){return ti(this,Dr)[4]}enumerate(){if(void 0!==ti(this,Dr)[4])return[ti(this,Dr)[4]];let e=new Set(ti(this,Dr)[0]);if(0===ti(this,Dr)[0].size&&void 0!==ti(this,Dr)[1]&&e.add(ti(this,Dr)[1]),ti(this,Dr)[2])for(let t of jr)e.add(`http://localhost:${String(t)}`),e.add(`http://127.0.0.1:${String(t)}`);return[...e]}get referrerWasAvailable(){return ti(this,Dr)[3]}get isProductionUnconfigured(){return!(!ut()||ti(this,Dr)[0].size>0||ti(this,Dr)[2]||void 0!==ti(this,Dr)[1])}get isReferrerOnlyTrust(){return!(ti(this,Dr)[0].size>0||ti(this,Dr)[2])&&void 0!==ti(this,Dr)[1]}},Dr=new WeakMap,zr="astro:page-load",qr="astro:after-swap",Vr={1:"left",2:"center",3:"right",4:"justify"},Hr=new Set(["left","center","right","justify","start","end"]),Gr=new Set(["h1","h2","h3","h4","h5","h6"]),Jr=\' target="_blank" rel="noopener noreferrer"\',Kr=(e,t)=>{let i=t.renderChildren(e.children??[]),n=mt(e.fields),r=function(e,t){if("internal"===t?.linkType)return function(e){let t=mt(mt(e)?.value),i=t?.url;if("string"==typeof i&&i.length>0)return i;let n=t?.slug;return"string"==typeof n&&n.length>0?`/${n}`:void 0}(t.doc);let i=t?.url??e.url;return"string"==typeof i&&i.length>0?i:void 0}(e,n);if(void 0===r||!A(r))return i;let s="string"==typeof e.title?` title="${nt(e.title)}"`:"";return`<a href="${rt(r)}"${function(e,t,i){if(!0===t?.newTab||R(i))return Jr;let n="string"==typeof e.target?e.target:"";return""===n?"":"_blank"===n?Jr:` target="${nt(n)}"`}(e,n,r)}${s}>${i}</a>`},Qr=new Map,Xr=".lp-block:empty,.lp-inline-block:empty",Zr={text:e=>{let t=nt("string"==typeof e.text?e.text:""),i="number"==typeof e.format?e.format:0;return!!(16&i)&&(t=`<code>${t}</code>`),!!(1&i)&&(t=`<strong>${t}</strong>`),!!(2&i)&&(t=`<em>${t}</em>`),!!(8&i)&&(t=`<u>${t}</u>`),!!(4&i)&&(t=`<s>${t}</s>`),!!(32&i)&&(t=`<sub>${t}</sub>`),!!(64&i)&&(t=`<sup>${t}</sup>`),!!(128&i)&&(t=`<mark>${t}</mark>`),t},paragraph:(e,t)=>{let i=t.renderChildren(e.children??[]);return`<p${pt(e)}${gt(e)}>${i}</p>`},heading:(e,t)=>{let i="string"==typeof e.tag?e.tag.toLowerCase():"h2",n=Gr.has(i)?i:"h2",r=t.renderChildren(e.children??[]);return`<${n}${pt(e)}${gt(e)}>${r}</${n}>`},list:(e,t)=>{let i="string"==typeof e.listType?e.listType:"bullet",n="number"===i?"ol":"ul",r="number"===i&&"number"==typeof e.start&&e.start>1?` start="${String(e.start)}"`:"",s="check"===i?\' role="list"\':"",a=t.renderChildren(e.children??[]);return`<${n}${pt(e)}${gt(e)}${r}${s}>${a}</${n}>`},listitem:(e,t)=>{let i=t.renderChildren(e.children??[]);if("boolean"==typeof e.checked)return`<li role="checkbox" aria-checked="${e.checked?"true":"false"}"${gt(e)}>${i}</li>`;let n="number"==typeof e.value?` value="${nt(String(e.value))}"`:"";return`<li${pt(e)}${gt(e)}${n}>${i}</li>`},link:Kr,autolink:Kr,quote:(e,t)=>{let i=t.renderChildren(e.children??[]);return`<blockquote${pt(e)}${gt(e)}>${i}</blockquote>`},code:e=>{let t=bt("string"==typeof e.language?e.language:"");return`<pre><code${""===t?"":` class="language-${t}"`}>${nt(kt(e))}</code></pre>`},"code-highlight":e=>{let t="string"==typeof e.text?e.text:"";return`<span${"string"==typeof e.highlightType?` class="token-${bt(e.highlightType)}"`:""}>${nt(t)}</span>`},linebreak:()=>"<br>",horizontalrule:()=>"<hr>",tab:()=>"\\t",upload:e=>{let t=vt(e.value);if(void 0===t)return"";let i=t.url;if("string"!=typeof i||!A(i))return"";let n="string"==typeof t.mimeType?t.mimeType:"";return n.startsWith("video/")?function(e,t){return`<video controls${Tt(e)}><source src="${rt(t)}"${At(e)}></video>`}(t,i):n.startsWith("audio/")?function(e,t){return`<audio controls><source src="${rt(t)}"${At(e)}></audio>`}(t,i):""===n||n.startsWith("image/")?function(e,t){let i="string"==typeof e.alt?nt(e.alt):"";return`<img src="${rt(t)}" alt="${i}"${Tt(e)} loading="lazy" decoding="async">`}(t,i):function(e,t){let i="string"==typeof e.filename?nt(e.filename):nt(t);return`<a href="${rt(t)}" target="_blank" rel="noopener noreferrer">${i}</a>`}(t,i)},relationship:e=>{let t="string"==typeof e.relationTo?e.relationTo:"",i=mt(e.value),n=nt((i&&St(i))??`#${t}`),r=bt(t),s=""===r?\' class="lp-relation"\':` class="lp-relation lp-relation--${r}"`,a=i?.url;return"string"==typeof a&&A(a)?`<a href="${rt(a)}"${s}>${n}</a>`:`<span${s}>${n}</span>`},block:(e,t)=>Ct(e,t,"div","lp-block"),inlineBlock:(e,t)=>Ct(e,t,"span","lp-inline-block"),table:(e,t)=>`<table${pt(e)}><tbody>${t.renderChildren(e.children??[])}</tbody></table>`,tablerow:(e,t)=>`<tr>${t.renderChildren(e.children??[])}</tr>`,tablecell:(e,t)=>{let i="number"==typeof e.headerState?e.headerState:0,n=3&i?"th":"td";return`<${n}${1===i?\' scope="col"\':2===i?\' scope="row"\':""}${$t("colspan",e.colSpan)}${$t("rowspan",e.rowSpan)}>${t.renderChildren(e.children??[])}</${n}>`}},Yr=new Map,es=!1,ts="data-payload-text",is=new Set,ns=new Set,rs=new Set(["DIV","SECTION","ARTICLE"]),ss={name:"richText",render:C((e,t,i)=>{let n=e.element;if(at(t)){n.textContent="";return}let r=i.sanitizerPolicy;if(void 0!==i.renderRichText){let s=i.renderRichText(t,{fieldName:e.fieldName,element:n,locale:i.locale});n.innerHTML=Ke(Ze(s,r));return}if(Ft(t)){let s=new Map,a=Lt(n,Ze(function(e,t={}){if(!Ft(e))return"";let i=function(e){let t={renderChildren:e=>{let i="";for(let n of e)i+=Nt(n,t);return i},resolveAlignment:ht,resolveIndent:ft,onUnrenderedBlock:e};return t}(t.onUnrenderedBlock).renderChildren(e.root.children);return!1===t.sanitize?i:void 0!==t.document?Xe(i,{document:t.document}):!0===t.requireDocument||void 0!==Ye()?Xe(i):(function(){if(!es){es=!0;try{console.warn(\'[live-preview] lexicalToHtml() has no sanitizer document and returned unsanitised HTML; pass { document } (linkedom, jsdom) per call. 3.0 throws here instead: opt in now with { requireDocument: true }. See "HTML sanitization" in docs/security.md.\')}catch{}}}(),i)}(t,{sanitize:!1,onUnrenderedBlock:(e,t)=>{s.set(t,e)}}),r));for(let[t,n]of a){let r=s.get(t);void 0!==r&&Pt(e,i,r,n)}return}if("string"!=typeof t)return!1;n.innerHTML=Ke(Ze(t,r))})},as={name:"html",render(e,t,i){if(at(t)){e.element.textContent="";return}let n="string"==typeof t?t:st(t);e.element.innerHTML=Ke(Ze(n,i.sanitizerPolicy))}},ls=new WeakSet,os=Et("url"),ds=/^[a-zA-Z][a-zA-Z0-9+.-]*:/,us=Et("email",function(e){let t=e.trim();return ds.test(t)||!t.includes("@")?t:`mailto:${t}`}),cs=["src","srcset","sizes"],hs={name:"image",render:C((e,t,i)=>{let n=e.element;if(at(t)){jt(n);return}let r=void 0!==e.locale,{media:s,candidate:a}=function(e,t,i,n){let r=void 0!==e.srcField&&e.srcField.length>0?N(i.allFields,e.srcField,i.locale,n):t,s=vt(r);return{media:s,candidate:void 0===s?r:s.url}}(e,t,i,r),l=xt(n,e.fieldName,a,void 0===s?void 0:i.serverURL);if("none"===l.kind)return!1;if("unsafe"!==l.kind){if("IMG"===n.tagName){let t=n;_t(t,l.url,s,i.serverURL);let a=function(e,t,i,n,r){if(void 0!==t&&t.length>0){let e=N(i,t,n,r);return"string"==typeof e?e:void 0}return e?.alt}(s,e.altField,i.allFields,i.locale,r);void 0!==a&&(t.alt=a);return}n.style.backgroundImage=`url(\'${function(e){return e.replace(/[\'"()\\\\]/g,"\\\\$&")}(l.url)}\')`}else jt(n)})},fs={name:"upload",render:C((e,t,i)=>{let n=e.element;if(at(t)){Wt(n);return}let r=vt(t);if(void 0===r)return!1;let s=xt(n,e.fieldName,r.url,i.serverURL);if("none"===s.kind)return!1;if("unsafe"===s.kind){Wt(n);return}let a=s.url;if("IMG"===n.tagName){let e=n;_t(e,a,r,i.serverURL),void 0!==r.alt&&(e.alt=r.alt);return}if("A"===n.tagName){n.setAttribute("href",a),n.textContent=r.filename??a;return}let l=nt(r.filename??a);n.innerHTML=Ke(`<a href="${rt(a)}">${l}</a>`)})},ps={name:"relationship",render(e,t){let i=e.element;if(at(t))i.removeAttribute("href"),i.textContent="";else{if("A"===i.tagName&&!Array.isArray(t)){let n=xt(i,e.fieldName,mt(t)?.url);"safe"===n.kind?i.setAttribute("href",n.url):"unsafe"===n.kind&&i.removeAttribute("href")}i.textContent=Array.isArray(t)?t.map(Dt).join(", "):Dt(t)}}},gs={name:"select",render(e,t,i){let n=e.element,r=at(t)?[]:function(e){return Array.isArray(e)?e.map(st):[st(e)]}(t);if("SELECT"!==n.tagName){if("INPUT"===n.tagName&&"radio"===n.type){let e=n;e.checked=r.includes(e.value);return}n.textContent=r.map(e=>function(e,t){let i=t.schema?.options;if(!Array.isArray(i))return e;for(let t of i){let i=mt(t);if(void 0!==i&&st(i.value)===e)return"string"==typeof i.label?i.label:e}return e}(e,i)).join(", ")}else!function(e,t){if(e.multiple)for(let i of Array.from(e.options))i.selected=t.includes(i.value);else e.value=t[0]??""}(n,r)}},ms=new Set(["","false","0","off","no"]),vs={name:"checkbox",render(e,t){let i=e.element,n=function(e){return"boolean"==typeof e?e:"string"==typeof e?!ms.has(e.trim().toLowerCase()):"number"==typeof e?0!==e:null!=e}(t);"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}},ys=new Map,bs=new Map,ws=new Set(["short","medium","long","full"]),Ss=new Set(["short","medium","long","full"]),ks=/^[A-Za-z]{3}$/u,Ts=/^[0-4]$/u,As=new WeakSet,Rs={name:"date",render(e,t,i){let n=e.element;if(at(t)){"INPUT"===n.tagName?n.value="":(n.removeAttribute("datetime"),n.textContent="");return}let r="number"==typeof t?t:st(t),s=new Date(r),a=!Number.isNaN(s.getTime()),l=String(r);"INPUT"!==n.tagName?("TIME"===n.tagName&&n.setAttribute("datetime",a?s.toISOString():l),n.textContent=a?function(e,t,i){let n=t.locale??i.locale??o(),r=Gt("date",t.format,t.element,t.fieldName)??Cs;try{return function(e,t){let i=zt(e,t);return lt(bs,i)??ot(bs,i,new Intl.DateTimeFormat(e,t),64)}(n,r).format(e)}catch{return e.toISOString()}}(s,e,i):l):n.value=a?function(e,t){let i=`${String(t.getFullYear()).padStart(4,"0")}-${Jt(t.getMonth()+1)}-${Jt(t.getDate())}`,n=`${Jt(t.getHours())}:${Jt(t.getMinutes())}`;return"date"===e?i:"datetime-local"===e?`${i}T${n}`:"time"===e?n:t.toISOString()}(n.type,s):l}},Cs={dateStyle:"medium",timeStyle:"short"},$s={name:"number",render(e,t,i){let n=e.element;if(at(t)){"INPUT"===n.tagName?n.value="":n.textContent="";return}let r="number"==typeof t?t:Number(st(t));Number.isNaN(r)?n.textContent=st(t):"INPUT"!==n.tagName?n.textContent=function(e,t,i){let n=t.locale??i.locale??o(),r=Gt("number",t.format,t.element,t.fieldName);try{return function(e,t){let i=zt(e,t);return lt(ys,i)??ot(ys,i,new Intl.NumberFormat(e,t),64)}(n,r).format(e)}catch{return String(e)}}(r,e,i):n.value=String(r)}},Fs=new Map;!function(){if(typ','eof window>"u"||!ut()&&(typ','eof window>"u"||null==window.opener))return;let e=window.__livePreview,t=JSON.stringify(Qt());if(void 0!==e&&(void 0===e.configSignature||e.configSignature===t))return e.refresh(),e;let[i=[],r="",s="/api",a=1,l=!1,o=50,d=!0,u=0,c=!1,h=50,f="200px",p=!0,g=!1,m=!1,v=!0,y="parent-or-opener",b="strict",w,S=!1,k=!1,T,A,R="off",C,$,F=[],N="descendant"]=Qt(),O=function(e){let t=typeof __LIVE_PREVIEW_FRAGMENT__<"u"?__LIVE_PREVIEW_FRAGMENT__:void 0,i=t??(typeof __LIVE_PREVIEW_ROUTE__<"u"?__LIVE_PREVIEW_ROUTE__:void 0);if(void 0===i)return;let n=i.createRouteStrategy();return void 0===t||void 0===e||""===e?{route:n}:{fragment:t.createFragmentStrategy({endpoint:e}),route:n}}(w),M=new Wr({additionalOrigins:i,enableReferrerDetection:!p,enableLocalhostMatching:!g});M.isProductionUnconfigured?ai("[live-preview] LP0101: No trusted origin. Pass allowedOrigins to generateInlineScript() (or to the adapter) \\u2014 the runtime reads no environment variable in the browser."):M.isReferrerOnlyTrust&&ai("[live-preview] LP0102: document.referrer fallback trusts any framing site. Set allowedOrigins and a frame-ancestors CSP in production.");let L=new oi,U=function(){let e=[ss,as,os,us,hs,fs,ps,gs,{...gs,name:"radio"},vs,Rs,$s,Kt("array","structural arrays"),Kt("blocks","structural arrays")];return function(e=[]){let t={};for(let i of e)t[i.name]=i;for(let[e,i]of Fs)t[e]=i;return Object.freeze(t)}([Mt("text"),Mt("textarea"),...e])}(),P=new Ir({renderers:U,originMatcher:e=>M.matches(e),lockedOrigin:()=>M.lockedOrigin,readyTargets:()=>M.enumerate(),emitter:L,eventSourcePolicy:y,...""!==r?{dataMerge:{serverURL:r,apiRoute:s,depth:a}}:{},debounceMs:o,heartbeatMs:u,intersectionRootMargin:f,disableVisibilityGate:c,visibilityGateThreshold:h,enableA11y:d,scopeBindingsByOwner:m,subfieldCoverage:N,skipUnchanged:v,revealEditedField:S,onUnfaithfulPatch:n({onUnfaithfulPatch:A,onUnboundChange:T}),autoBind:R,...void 0!==C?{hydration:C}:{},sanitizerPolicy:b,...void 0!==O?{strategies:O}:{},onHeartbeatTimeout:()=>{M.unlockOrigin()},...l?{log:(...e)=>{li("[live-preview]",...e)}}:{}});L.on("connect",e=>{M.lockOrigin(e.origin)}),P.start(),e?.destroy();let x=function(e,t={}){let i=t.windowTarget??globalThis.window,n=t.documentTarget??globalThis.document,r=[...new Set(t.softNavigationEvents??[])],s=()=>{e.suspend()},a=t=>{!0===t.persisted&&e.resume()},l=!1,o=()=>{l=!0},d=t=>{if(t.type===zr){if(!l)return;l=!1}void 0===e.refreshAfterNavigation?e.refreshCache():e.refreshAfterNavigation()},u=!1;i?.addEventListener("pagehide",s),i?.addEventListener("pageshow",a);for(let e of r)n?.addEventListener(e,d);let c=r.includes(zr);return c&&n?.addEventListener(qr,o),()=>{if(!u){u=!0,i?.removeEventListener("pagehide",s),i?.removeEventListener("pageshow",a);for(let e of r)n?.removeEventListener(e,d);c&&n?.removeEventListener(qr,o)}}}({suspend:()=>P.suspend(),resume:()=>P.start(),refreshCache:()=>{P.refreshCache()},refreshAfterNavigation:()=>{P.navigationCommit()}},{softNavigationEvents:F}),E=Object.freeze({version:jn,configSignature:t,destroy:()=>{x(),P.destroy();let e=window;e.__livePreview===E&&delete e.__livePreview},refresh:()=>{P.refreshCache()},refreshAfterNavigation:()=>{P.navigationCommit()},enumerateOrigins:()=>M.enumerate(),inspect:()=>P.inspect()});try{Object.defineProperty(window,"__livePreview",{value:E,writable:!1,configurable:!0})}catch(e){throw x(),P.destroy(),e}}()})();'].join(""),t=Object.freeze({profile:"lean",source:e,contentHash:"81373b50a77b5a9a",integrity:"sha384-ti7e0/YcjzZHGESWx1M7t0fV/kLvqHN6F22eVTZup92CzXJ5RRtlvw6Wu1KCUaI6"});exports.LEAN_RUNTIME=t;
|
|
1
|
+
"use strict";var e=/* @__PURE__ */['(()=>{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(...i)=>{try{e(t(...i))}catch{}}}function i(){}function n(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 r(e){return e.onUnfaithfulPatch??("ignore"===e.onUnboundChange?"ignore":"escalate")}function s(e,t,i,r,s){let a=e.onUnfaithfulPatch,l=t.reportedUnfaithful.get(i.element),o=n(s),d=Date.now(),u=void 0!==l&&("escalate"!==a||void 0===o||o===l.identity||d-l.at<Ri);if((u||"escalate"!==a)&&t.display.shortfall(t.activeUpdate,{kind:"unfaithful",field:i.fieldName}),!u){if(t.reportedUnfaithful.set(i.element,{identity:o,at:d}),void 0===l){if(t.unfaithfulCount+=1,t.unfaithfulFields.add(i.fieldName),"ignore"===a)return;if("warn"===a){e.warn(`[live-preview] LP0411: "${i.fieldName}" ${r}`);return}}e.log("LP0411",i.fieldName,r),t.unfaithfulPatches.push(i)}}function a(e,t){return!e.unfaithfulFields.has(t)&&(e.unfaithfulFields.add(t),e.unfaithfulCount+=1,!0)}function l(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value:e.textContent}function o(e){let t=e.trim();return JSON.stringify(t.length>$i?`${t.slice(0,$i)}\\u2026`:t)}function d(){return function(){if(typ','eof 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 u(e){if(++e.nodes>1e4)throw new Error("invalid or oversized field schema")}function c(e,t,i){if(u(t),i>64||t.active.has(e))throw new Error("invalid or oversized field schema");t.active.add(e)}function h(e){try{return f(e,{nodes:0,active:new WeakSet},0)}catch{return[]}}function f(e,t,i){if(!Array.isArray(e))return[];c(e,t,i);let n=[];for(let r of e){let e=p(r,t,i);e&&n.push(e)}return t.active.delete(e),n}function p(e,t,i){if(u(t),"object"!=typeof e||null===e)return;let n=e,r=n.name,s=n.type;if("string"!=typeof r||0===r.length||"string"!=typeof s||0===s.length)return;let a=f(n.fields,t,i+1),l=function(e,t,i){if("object"==typeof e&&null!==e&&!Array.isArray(e)){c(e,t,i);let n=[];for(let r in e){if(!Object.hasOwn(e,r))continue;u(t);let s=Reflect.get(e,r);"object"!=typeof s||null===s||["__proto__","constructor","prototype"].includes(r)||n.push({...s,slug:r,fields:f(s.fields,t,i+1)})}return t.active.delete(e),n}if(!Array.isArray(e))return[];c(e,t,i);let n=[];for(let r of e){if(u(t),"object"!=typeof r||null===r)continue;let e=r,s=e.slug;if("string"!=typeof s||0===s.length)continue;let a=f(e.fields,t,i+1);n.push({...e,slug:s,fields:a})}return t.active.delete(e),n}(n.blocks,t,i+1),o={...n,name:r,type:s},d=n.relationTo;if(Array.isArray(d)){let e=[];for(let i of d)u(t),e.push(i);o.relationTo=e}return a.length>0?o.fields=a:delete o.fields,l.length>0?o.blocks=l:delete o.blocks,o}function g(e,t){return void 0===e||t(e)}function m(e,t){return null==e||t(e)}function v(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}function y(e,t=[]){let i="number"==typeof e&&Number.isFinite(e)&&e>=1?Math.floor(e):void 0,n=Math.min(4,i??1),r=new Set(t),s=new Set;for(let e of Oi)(n>=Ni[e].since||r.has(e))&&s.add(e);return{ours:4,...void 0!==i?{theirs:i}:{theirs:void 0},negotiated:n,capabilities:s,observed:r}}function b(e,t){return e.generation===t.generation&&e.revision===t.revision}function w(e){Ui.has(e)||(Ui.add(e),gi(`[live-preview] LP0104: this page carries the lean runtime, which leaves out ${e} (${Li[e]}). The elements are left as the server rendered them. Remove \\`runtime: LEAN_RUNTIME\\` to get the full runtime.`))}function S(e){return function(e){return!1!==e.enableA11y&&w("screen-reader announcements"),null}(e)}function k(e){if(typ','eof window>"u")return;let t=[];window.parent!==window&&t.push(window.parent),window.opener instanceof Window&&t.push(window.opener),Mi.sendReady(t,e)}function A(e,t,i,n){for(let r of e){if(Ei.has(r.type)){let e=r.fields;e&&A(e,n&&"tabs"===r.type?""===t?r.name:`${t}.${r.name}`:t,i,n);continue}let e=""===t?r.name:`${t}.${r.name}`;if(i.set(e,r),"group"===r.type)r.fields&&A(r.fields,e,i,n);else if("array"===r.type&&r.fields)A(r.fields,`${e}.*`,i,n);else if("blocks"===r.type&&r.blocks)for(let t of r.blocks)A(t.fields,`${e}.*.${t.slug}`,i,n)}}function T(e,t){if(e.has(t))return e.get(t);let i=t.replace(/\\.\\d+(?=\\.|$)/g,".*");return e.has(i)?e.get(i):void 0}function R(e){if("string"!=typeof e)return!1;let t=e.trim().replace(Bi,"");if(0===t.length)return!1;if(t.startsWith("#")||t.startsWith("?")||ji.test(t)||t.startsWith("/"))return!0;try{let e=new URL(t);return Pi.has(e.protocol)}catch{return Ii.test(t)&&!function(e){let t=Wi.exec(e.replace(_i,""))?.[1];return void 0!==t&&!Pi.has(`${t.toLowerCase()}:`)}(t)}}function C(e){let t=e.trim().replace(Bi,"");return/^https?:\\/\\//i.test(t)||ji.test(t)}function $(e){return qi.add(e),e}function F(){return!0}function N(e,t,i,n=!1){if(n&&void 0!==i){let n=O(e,`${t}_${i}`);if(void 0!==n)return n}let r=O(e,t);if(void 0!==r)return r;if(t.includes(".")){let i=e,n=!0;for(let e of t.split(".")){if(Hi.has(e)||null===i||"object"!=typeof i){n=!1;break}if(i=O(i,e),void 0===i){n=!1;break}}if(n)return i}return void 0===i?void 0:O(e,`${t}_${i}`)}function O(e,t){if(!Hi.has(t)&&Object.prototype.hasOwnProperty.call(e,t))return e[t]}function M(e,t,i,n){return N(e,i,t.locale??n,void 0!==t.locale)}function L(e,t,i,r){let s=n(t);if(void 0===s)return;let a=[e.hrefField,e.srcField,e.altField],l=JSON.stringify([e.format,e.locale??r])+s;for(let t of a){if(void 0===t||0===t.length)continue;let s=n(M(i,e,t,r));if(void 0===s)return;l+=`|${t}=${s}`}return l}function U(e){return e.closest(`[${Gi}]`)}function E(e){let t=e.getAttribute(Ji);return null!==t&&t.length>0?"patch"===t||"fragment"===t||"route"===t?t:void 0:null!==U(e)?"fragment":null!==e.closest("head")?"route":"patch"}function x(e){return`global:${e}`}function P(e,t){return void 0===t||""===t?`collection:${e}`:`collection:${e}:${t}`}function I(e){return"string"==typeof e&&e.length>0}function j(e,t){return null!==t&&void 0!==e&&t.includes(e)}function B(e){let t=e.id;return"string"==typeof t&&t.length>0?t:"number"==typeof t&&Number.isFinite(t)?String(t):void 0}function _(e){return"object"==typeof e&&null!==e}function W(e){return Array.isArray(e)?"array":_(e)?"object":"scalar"}function D(e,t){return _(e)?e[t]:void 0}function z(e,t){return("string"==typeof t||"number"==typeof t)&&_(e)&&!Array.isArray(e)&&e.id===t}function q(e,t){if(!_(e)||!_(t))return z(e,t)||z(t,e)||n(e)===n(t);if(Array.isArray(e)!==Array.isArray(t))return!1;let i=Object.keys(t);return i.length===Object.keys(e).length&&i.every(i=>Object.hasOwn(e,i)&&q(D(e,i),D(t,i)))}function V(e,t){let i=n(t),r=n(e);return!!(void 0!==i&&i===r||z(e,t)||z(t,e))||void 0!==i&&void 0!==r&&q(e,t)}function H(e,t,i,n){let r=[],s=0,a=(e,t,i,l)=>{if(s+=1,n.covers(e)||V(t,i))return;if(!((void 0===t||W(t)===W(i))&&_(i)&&n.reachesBelow(e)&&l<Ki)){r.push({path:e,value:i});return}let o=function(e,t){let i=new Set(Object.keys(t));if(_(e))for(let t of Object.keys(e))i.add(t);return[...i]}(t,i);0===o.length&&r.push({path:e,value:i});for(let n of o){if(s>=Qi){r.push({path:e,value:i});return}a(`${e}.${n}`,D(t,n),D(i,n),l+1)}};return a(e,t,i,0),r}function G(e,t,i={}){let n=e=>!1===t||j(e,t),r=[];for(let[t,i]of e.entries())i.some(e=>n(e.owner))&&r.push(t);let s=e.rendered.filter(e=>void 0!==i[e.strategy]);return function(e,t){let i=new Set(e),n=[...t],r=(e,t)=>{let i=`${t}.`;for(let t of e)if(t.startsWith(i))return!0;return!1};return{covers:e=>i.has(e)||n.some(t=>t===e||e.startsWith(`${t}.`)),reachesBelow:e=>r(i,e)||r(n,e)}}(r,[...e.covers,...s].filter(e=>n(e.owner)).flatMap(e=>e.paths))}function J(e,t){if(void 0===t||0===t.length)return e;let i=`_${t}`;return e.endsWith(i)?e.slice(0,-i.length):e}function K(e,t,i,n=G(e,i)){let r,s=n.covers,a=n.reachesBelow;return n=>{let l=J(n,t);return s(n)||l!==n&&s(l)||(r??(r=function(e,t){let i=new Set;for(let[n,r]of e.entries())for(let e of r)!1!==t&&!j(e.owner,t)||void 0!==e.locale&&i.add(`${n}_${e.locale}`);return i}(e,i)),r.has(n))?"whole":a(n)||l!==n&&a(l)?"below":"none"}}function Q(e,t,i,n,r){return Y(i)?!Y(t)||function(e,t,i){let n=void 0===i?void 0:T(i,e);return void 0!==n&&!Zi.has(n.type)||!0===t.get(e)?.some(X)||function(e,t){let i=`${t}.`;for(let[t,n]of e.entries())if(t.startsWith(i))return!0;return!1}(t,e)}(e,n,r)?"keep":null==t?"ask":"own":"ask"}function X(e){return!Zi.has(e.fieldType)}function Z(e){let t=[e],i=new Set;for(let e=t.pop();void 0!==e;e=t.pop()){if("object"!=typeof e||null===e||i.has(e))continue;i.add(e);let{type:n,fields:r,children:s}=e;if(!Yi.has(n)||"internal"===r?.linkType)return!0;if(Array.isArray(s))for(let e of s)t.push(e)}return!1}function Y(e){return null===e||"object"!=typeof e&&"function"!=typeof e}function ee(e){return!0===e?.includes(".")}function te(e,t){let i=t.globalSlug??t.collectionSlug;if("string"!=typeof i||e.entitySlug!==i)return!0;let n=B(e),r=B(t.data??{});return void 0!==n&&void 0!==r&&n!==r}function ie(e){return null!==e&&e.forceRender&&!e.completed}function ne(e){try{return!0===e.matchMedia?.("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function re(e,t){let i=t.element.ownerDocument.defaultView;return null===i?"no-element":e.reveal(`${t.owner??""} ${t.fieldName}`,t.element,i)}function se(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)}function ae(e){return!!se(e)&&e.root.children.every(e=>{let{type:t,children:i}=e??{};return"paragraph"===t&&(!Array.isArray(i)||0===i.length)})}function le(e){if(null==e)return[];let t=new Set,i=[];for(let n of e.split(/[\\s,]+/)){let e=n.trim();0===e.length||t.has(e)||(t.add(e),i.push(e))}return i}function oe(...e){let t=new Map;for(let i of e)for(let[e,n]of Object.entries(i)){let i=t.get(e);void 0===i&&(i=new Set,t.set(e,i));for(let e of n)i.add(e)}let i={};for(let[e,n]of t)i[e]=[...n];return i}function de(e,t){let i={};for(let n of t)n!==e&&(i[n]=[e]);return i}function ue(e){return"patch"===e.getAttribute(fn)}function ce(e){return function(e){return"astro-island"===e.tagName.toLowerCase()||e.hasAttribute(fn)}(e)&&!ue(e)}function he(e){return"astro-island"===e.tagName.toLowerCase()&&e.hasAttribute("ssr")}function fe(e){let t=e.closest(Pn)?.getAttribute(Nn);return null==t||0===t.length?void 0:t}function pe(e){return Bn.has(e)||jn.test(e)}function ge(e,t){return e.fieldName===t.fieldName&&e.locale===t.locale&&e.owner===t.owner&&e.strategyKind===t.strategyKind&&e.fragmentBoundary===t.fragmentBoundary}function me(e){let t=e.getAttribute(mn);if(null!==t&&pe(t))return t;if(e.hasAttribute(Rn))return"richText";if(e.hasAttribute(Cn))return"html";if(e.hasAttribute(Fn))return"structural-array";if(e.hasAttribute($n))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 ve(){return!0}function ye(){throw new Error("invalid or oversized legacy population")}function be(e){for(let t=0;t<e.length;t+=1){let i=e.charCodeAt(t);if(i<=31||127===i)return!0}return!1}function we(e,t){if("string"!=typeof e||0===e.length||e.length>t||"."===e||".."===e||e.includes("/")||e.includes("\\\\")||be(e))return!1;try{return encodeURIComponent(e),!0}catch{return!1}}function Se(e){return we(e,128)&&!/[?#%]/u.test(e)&&!Kn.has(e)}function ke(e){return Number.isFinite(e)?String(e):we(e,512)?e:ye()}function Ae(e,t){return Object.hasOwn(e,t)?Reflect.get(e,t):void 0}function Te(e,t,i){Object.defineProperty(e,t,{value:i,writable:!0,configurable:!0,enumerable:!0})}function Re(e){let t=e.length;for(;t>0&&47===e.charCodeAt(t-1);)t-=1;return e.slice(0,t)}function Ce(e){let t=new WeakSet,i=0,n=0;return function e(r,s){if(++i>Dn||s>Wn)return ye();if("string"==typeof r)return n+=r.length,n>Hn&&ye(),r;if(null==r||"boolean"==typeof r)return r;if("number"==typeof r)return Number.isFinite(r)?r:ye();if(!Array.isArray(r)&&!v(r))return ye();if(Array.isArray(r)){r.length>Dn&&ye();for(let e=0;e<r.length;e+=1)Object.hasOwn(r,e)||ye()}if(t.has(r))return ye();t.add(r);let a=Array.isArray(r)?[]:{};for(let t of Object.keys(r))Te(a,t,e(Reflect.get(r,t),s+1));return t.delete(r),a}(e,0)}function $e(e,t,i,n,r,s){function a(e,t,i,n){if(null==n||""===n)return;let s=v(n)?Ae(n,"id"):n,a=ke(s);if(0===r){Te(e,t,s);return}let l=JSON.stringify([i,a]);c.add(l),c.size>zn&&ye();let o=u.get(i)??[];o.push({owner:e,key:t,id:a}),u.set(i,o)}function l(e,t,i){void 0!==i.hasMany&&"boolean"!=typeof i.hasMany&&ye();let n=i.relationTo,r=Ae(e,t);if(Array.isArray(n)){0===n.length&&ye();let e,t=v(r)?Ae(r,"relationTo"):void 0;for(let i of n)p(0),Se(i)||ye(),i===t&&(e=i);if(null==r||""===r)return;(!v(r)||void 0===e)&&ye(),a(r,"value",e,Ae(r,"value"))}else Se(n)||ye(),a(e,t,n,r)}function o(e,t){if(p(t),Array.isArray(e)||v(e)){if(v(e)&&Object.hasOwn(e,"relationTo")&&Object.hasOwn(e,"value")){let t=Ae(e,"relationTo");Se(t)||ye(),a(e,"value",t,Ae(e,"value"));return}for(let i of Object.keys(e))o(Reflect.get(e,i),t+1)}}if(!Number.isSafeInteger(r)||r<0||r>Wn)return ye();void 0!==s&&("string"!=typeof s||s.length>128||be(s))&&ye();let d=Ce(e);if(!v(d))return ye();let u=new Map,c=new Set,h=0,f=new WeakSet,p=e=>{(++h>Dn||e>Wn)&&ye()};(function e(t,i,n){p(n),f.has(t)&&ye(),f.add(t);for(let r of t){p(n),(!v(r)||!we(r.name,512)||Kn.has(r.name))&&ye();let t=Ae(i,r.name);if("relationship"===r.type||"upload"===r.type)if(r.hasMany)if(null!=t&&!Array.isArray(t)&&ye(),Array.isArray(t))for(let e=0;e<t.length;e+=1)l(t,e,r);else l(i,r.name,r);else l(i,r.name,r);else if("group"===r.type||"tabs"===r.type)null!=t&&!v(t)&&ye(),v(t)&&r.fields&&e(r.fields,t,n+1);else if("row"===r.type||"collapsible"===r.type)r.fields&&e(r.fields,i,n+1);else if("array"===r.type||"blocks"===r.type){if(0===t?Te(i,r.name,[]):null!=t&&!Array.isArray(t)&&ye(),Array.isArray(t))for(let i of t)if(v(i)||ye(),"array"===r.type&&r.fields)e(r.fields,i,n+1);else if("blocks"===r.type){let t=Ae(i,"blockType"),s=r.blocks?.find(e=>(p(n),e.slug===t));void 0===s&&ye(),e(s.fields,i,n+1)}}else"richText"===r.type&&o(t,n+1)}f.delete(t)})(t,d,0),u.size>25&&ye();let g=[];if(0===u.size)return{doc:d,requests:g};let m=new URL(i);(!["http:","https:"].includes(m.protocol)||m.username||m.password||m.search||m.hash)&&ye(),(!n.startsWith("/")||n.includes("\\\\")||/[%?#]/u.test(n)||be(n))&&ye(),n.split("/").some(e=>"."===e||".."===e)&&ye();let y=`${Re(i)}${Re(n)}/`;for(let[e,t]of u){let i=[...new Set(t.map(e=>e.id))],n=0;for(;n<i.length;){let a=i[n];void 0===a&&ye();let l=a.includes(","),o=[],d="";for(;n<i.length&&o.length<Jn;){let t=i[n];if(void 0===t||o.length>0&&(l||t.includes(",")))break;let a=[...o,t],u=new URLSearchParams({depth:String(r),limit:String(a.length)});void 0!==s&&u.set("locale",s),u.set(l?"where[id][equals]":"where[id][in]",l?t:a.join(","));let c=`${y}${encodeURIComponent(e)}?${u}`;if(c.length>Vn){0===o.length&&ye();break}new URL(c).origin!==m.origin&&ye(),o.push(t),n+=1,d=c}(0===o.length||g.length>=qn)&&ye();let u=new Set(o);g.push({url:d,ids:u,slots:t.filter(e=>u.has(e.id))})}}return{doc:d,requests:g}}async function Fe(e,t,i){let n,r,s=!1,a=!1,l=Symbol(),o=new Promise(e=>{r=()=>{e(l)}}),d=()=>{(!i()||t.aborted)&&ye()},u=()=>{if(void 0!==n&&!s){s=!0;try{Promise.resolve(n.cancel()).catch(()=>{})}catch{}}},c=()=>{r?.(),u()};t.addEventListener("abort",c,{once:!0});try{d();let t=e.body??null;if(d(),null===t){let t=e.json.bind(e);d();let i=await Promise.race([Promise.resolve().then(()=>(d(),t())),o]);return d(),i===l&&ye(),i}let i=t.getReader.bind(t);d();let r=i();n=r,d();let s=[],u=0,c=0;for(;;){let e=Promise.resolve().then(()=>{d();let e=r.read.bind(r);return d(),e()}),t=await Promise.race([e,o]);if(d(),t===l&&ye(),t.done)break;u+=t.value.byteLength,(++c>Gn||u>Hn)&&ye(),s.push(t.value)}a=!0;let h=new Uint8Array(u),f=0;for(let e of s)h.set(e,f),f+=e.byteLength;try{return JSON.parse((new TextDecoder).decode(h))}catch{return ye()}}finally{t.removeEventListener("abort",c),a||u();try{n?.releaseLock()}catch{}}}function Ne(e,t){let i=Ce(t);v(i)||ye();let n=Ae(i,"docs");(!Array.isArray(n)||n.length>Jn)&&ye();let r=new Map;for(let t of n){v(t)||ye();let i=ke(Ae(t,"id"));(!e.ids.has(i)||r.has(i))&&ye(),r.set(i,t)}r.size!==e.ids.size&&ye();for(let t of e.slots)Te(t.owner,t.key,r.get(t.id))}function Oe(e,t){return e.length>0&&e.length<=t&&"."!==e&&".."!==e&&!e.includes("/")&&!e.includes("\\\\")&&!function(e){for(let t of e){let e=t.codePointAt(0)??0;if(e<=31||127===e)return!0}return!1}(e)}function Me(e){return Oe(e,128)&&!e.includes("?")&&!e.includes("#")}function Le(e){return"number"==typeof e?Number.isFinite(e):"string"==typeof e&&Oe(e,512)}function Ue(e){return e.has("schema-json")?Zn:e.has("document-events")||e.has("relationship-events")?Yn:er}function Ee(e){if("attributes"!==e.type||e.attributeName!==tr||e.target.nodeType!==ir)return null;let t=e.target;return"astro-island"!==t.tagName.toLowerCase()||t.hasAttribute(tr)?null:t}function xe(e){if(e.nodeType!==ir)return!1;let t=e;return t.matches(rr)||null!==t.querySelector(rr)}function Pe(){if(typ','eof window>"u")return;let e=window;return e[hr]??(e[hr]={armed:!1,committed:!1,commits:[],onCommit:void 0,waiters:[]})}function Ie(){let e=Pe();if(void 0===e||e.armed)return;e.armed=!0;let t=window,i=t.__REACT_DEVTOOLS_GLOBAL_HOOK__??(t.__REACT_DEVTOOLS_GLOBAL_HOOK__=function(){let e=new Map;return{supportsFiber:!0,renderers:e,inject:t=>{let i=e.size+1;return e.set(i,t),i}}}()),n=i.onCommitFiberRoot;i.onCommitFiberRoot=function(t,i,...r){try{n?.call(this,t,i,...r)}catch{}void 0===e.onCommit?e.commits.push(i):e.onCommit(i)}}function je(e){e.committed=!0;let t=e.waiters;e.waiters=[];for(let e of t)e()}function Be(e,t){let i=e.waiters.indexOf(t);i>=0&&e.waiters.splice(i,1)}function _e(e,t,i){if(e.committed)return null;let n=null,r=()=>{null!==n&&clearTimeout(n),n=null,t("committed")};return e.waiters.push(r),n=setTimeout(()=>{n=null,Be(e,r),t("timed-out")},i),()=>{null!==n&&clearTimeout(n),n=null,Be(e,r)}}function We(){if(typ','eof window>"u")return;let e=window;return e[gr]??(e[gr]={armed:!1,committed:!1,waiters:[]})}function De(e){return Object.prototype.hasOwnProperty.call(e,pr)?e[pr]:void 0}function ze(){let e=We();if(void 0===e||e.armed)return;e.armed=!0;let t=Element.prototype;void 0===Object.getOwnPropertyDescriptor(t,pr)&&Object.defineProperty(t,pr,{configurable:!0,get:()=>{},set(e){Object.defineProperty(this,pr,{value:e,writable:!0,configurable:!0,enumerable:!0});let t=We();void 0===t||t.committed||null===this.querySelector(fr)||function(e,t){let i=t?.$nuxt;!0!==i?.isHydrating||"function"!=typeof i.hook?je(e):i.hook(mr,()=>{e.committed||je(e)})}(t,e)}})}function qe(e){let t=e.hydration;if(void 0===t){e.startNow();return}let i=vr[t](e.root,i=>{e.later(()=>{Ve(e,t,i)})});null!==i?(e.defer(i),e.hydrated("waiting")):Ve(e,t,"committed")}function Ve(e,t,i){e.hydrated(i),"timed-out"===i&&e.warn(`[live-preview] LP0607: no ${yr[t]} in ${String(5e3)} ms; started without waiting for hydration.`),e.startNow()}function He(e){return 9===e.nodeType}function Ge(e){return e.body}function Je(e,t,i,n){if(!e.scopeBindingsByOwner)return!1;let{message:r}=i,s=function(e){if(I(e.globalSlug))return[x(e.globalSlug)];if(!I(e.collectionSlug))return null;let t=P(e.collectionSlug);return I(e.documentId)?[t,P(e.collectionSlug,e.documentId)]:[t]}({globalSlug:"string"==typeof r.globalSlug?r.globalSlug:void 0,collectionSlug:"string"==typeof r.collectionSlug?r.collectionSlug:void 0,documentId:B(n)});return null===s&&!t.warnedUnattributableMessage&&(t.warnedUnattributableMessage=!0,e.warn("[live-preview] LP0202: scopeBindingsByOwner: update names no document; nothing applied")),s}function Ke(e,t,i,n,r){!function(e,t,i){let n=0;for(let r of e)if(!i()||(r.dispatchEvent(new CustomEvent(hn,{detail:t,bubbles:!1})),n+=1,!i()))break}(i,{fields:t.fields,revision:e.revision.revision,receivedAt:e.receivedAt,locale:e.locale,displayed:r},n)}function Qe(e,t,i,n,r){let{warned:s,warn:a}=e;if(s.has(i)||t(i))return;s.add(i);let l=`data-payload-field="${J(i,n)}"`;a(""!==r?`[live-preview] LP0203: field "${i}" has a value and no <\\u2026 ${l}> on this page; editing it changes nothing here. Expected where the page shows part of the document: inspect().fidelity.fields lists these, onUnfaithfulPatch decides whether a server render is asked for.`:`[live-preview] LP0201: no <\\u2026 ${l}> for the empty field "${i}"; render the anchor unconditionally so edits to an empty field have somewhere to land.`)}function Xe(e){let t=typeof e;return"string"===t||"number"===t||"boolean"===t||"bigint"===t}function Ze(e){return Array.isArray(e.docs)&&"boolean"==typeof e.hasNextPage}function Ye(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function et(e){let t=function(){let e=function(){let e=globalThis,t=e[Ar];if(void 0!==t)return t;let i={};return e[Ar]=i,i}();if(void 0!==e.override)return e.override;if(void 0!==e.auto)return e.auto;let t=function(){let e=globalThis.trustedTypes;return"object"!=typeof e||null===e?void 0:"function"==typeof e.createPolicy?e:void 0}();try{e.auto=void 0===t?null:t.createPolicy(kr,{createHTML:e=>e})}catch{e.auto=null}return e.auto}();return null===t?e:t.createHTML(e)}function tt(e){Rr.has(e)||(Rr.add(e),function(e){try{console.warn(e)}catch{}}(`[live-preview] LP0409: the strict sanitizer removed \\`${e}\\` from written markup; the 1.x default (\\`sanitizerPolicy: \'compat\'\\`) kept it. ${function(e){return e.startsWith(Cr)?"A binding inside CMS content is refused by design \\u2014 an editor could otherwise aim a write at any element on the page (docs/security.md)":"id"===e||"name"===e?"CMS content that can name an element can shadow a global of that name \\u2014 DOM clobbering, refused by design (docs/security.md)":"Put it on an element the template owns, or set `sanitizerPolicy: \'compat\'` to keep every `data-*` as 1.x did"}(e)}.`))}function it(e,t){return nt(e,void 0,t)}function nt(e,t,i){let n=i?.document??at();if(!n)throw rt();if(""===e)return"";let r=function(e,t){let i=e?.policy??t??_r;if(!e){let e=new Map;for(let[t,i]of Object.entries(Er))e.set(t,i);return{allowedTags:$r,attrByTag:e,allowFormControls:!1,templateMode:!1,mode:i,allowedData:new Set}}let n=new Set($r);if(e.additionalAllowedTags?.forEach(e=>n.add(e)),!0===e.allowFormControls)for(let e of Fr)n.add(e);let r=new Map;for(let[e,t]of Object.entries(Er))r.set(e,t);for(let[t,i]of Object.entries(e.additionalAllowedAttributes??{})){let e=new Set(r.get(t));for(let t of i)e.add(t);r.set(t,e)}return{allowedTags:n,attrByTag:r,allowFormControls:!0===e.allowFormControls,templateMode:!0===e.templateMode,mode:i,allowedData:new Set(e.allowedDataAttributes?.map(e=>e.toLowerCase()))}}(i,t),s=e;for(let e=0;e<Pr;e+=1){let e=n.createElement("template");e.innerHTML=et(s);let t=e.content;lt(t,r);let i=st(t);if(i===s)return i;s=i}return function(e,t){if(!function(){try{let e=glo','balThis.process?.env;return void 0!==e&&"production"!==e.NODE_ENV}catch{return!1}}())return;let i=globalThis,n=i[Tr]??(i[Tr]=new Set);if(!n.has(e)){n.add(e);try{console.warn(`[payload-live-preview] ${t}`)}catch{}}}("sanitizer-unsettled",`sanitizeHtml: the output did not settle after ${String(Pr)} passes, so it returned an empty string (ADR 0016).`),""}function rt(){return new Error("sanitizeHtml needs a DOM")}function st(e){let t=e.ownerDocument?.createElement("div");if(void 0===t)throw rt();let i=e.firstChild;if(t.append(e),t.firstChild!==i)throw rt();return t.innerHTML}function at(){if(!(typ','eof document>"u"))return document}function lt(e,t){for(let i of Array.from(e.childNodes))i.nodeType===Ir?ot(i,t):i.nodeType===jr&&i.remove()}function ot(e,t){let i=e.tagName.toLowerCase();!Nr.has(i)||t.allowFormControls&&Fr.has(i)?t.allowedTags.has(i)?(function(e,t,i){let n=i.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("is"!==r){if("strict"===i.mode){if(i.templateMode&&Br.has(r))continue;if("id"===r||"name"===r||r.startsWith(Ur)){e.removeAttribute(t.name),("name"!==r||!0===n?.has(r))&&tt(r);continue}if(r.startsWith(Lr)){i.allowedData.has(r)||(e.removeAttribute(t.name),tt(r));continue}if(Or.has(r)||r.startsWith(Mr))continue}else if(Or.has(r)||r.startsWith(Mr)||r.startsWith(Lr))continue;n?.has(r)?(xr.has(r)&&!R(t.value)||"srcset"===r&&!dt(t.value))&&e.removeAttribute(t.name):e.removeAttribute(t.name)}else e.setAttribute("is","")}}(e,i,t),"a"===i&&function(e){let t=e.getAttribute("href");null===t||!C(t)||(e.setAttribute("rel","noopener noreferrer"),e.hasAttribute("target")||e.setAttribute("target","_blank"))}(e),lt(e,t)):(lt(e,t),e.replaceWith(...e.childNodes)):e.remove()}function dt(e){for(let t of e.split(",")){let e=t.trim();if(0===e.length)continue;let[i=e]=e.split(/\\s/,1);if(!R(i)||!R(e))return!1}return!0}function ut(e){return e.replace(Dr,e=>Wr[e])}function ct(e){return e.replace(qr,e=>zr[e])}function ht(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 ft(e){return null==e||""===e}function pt(e,t){let i=e.get(t);return void 0!==i&&(e.delete(t),e.set(t,i)),i}function gt(e,t,i,n){return e.set(t,i),function(e,t){for(let i of e.keys()){if(e.size<=t)break;e.delete(i)}}(e,n),i}function mt(t,i,n,r,s){let a=t.transformValue;if(void 0===a)return n;try{let t=a(i.fieldName,n,{element:i.element,allFields:r},s),l=e(t);if(!s())return n;if(l)throw new TypeError(`Transform for "${i.fieldName}" returned a thenable; transforms must be synchronous`);return t}catch(e){if(!s())return n;let i=e instanceof Error?e:new Error(String(e));return t.emitter.emit("error",{error:i,context:"transform",code:"LP0602"}),n}}function vt(e){if(!0!==e.hidesWhenEmpty)return!1;let{element:t}=e;if(t.hasAttribute("hidden"))return!0;let i=t.getBoundingClientRect();return 0===i.width||0===i.height}function yt(){if(typ','eof window>"u")return!1;try{return window.self!==window.top}catch{return!0}}function bt(e){let t=e.trim();if(0!==t.length)try{let e=new URL(t);return"http:"!==e.protocol&&"https:"!==e.protocol||!Zr.test(e.origin)?void 0:e.origin}catch{return}}function wt(e){let t=e.format;return"string"==typeof t&&ss.has(t)?t:"number"==typeof t?rs[t]:void 0}function St(e){let t=e.indent;return"number"==typeof t&&t>0?t:0}function kt(e){return"rtl"===e.direction?\' dir="rtl"\':"ltr"===e.direction?\' dir="ltr"\':""}function At(e){let t=wt(e),i=St(e),n=[];return void 0!==t&&n.push(`lp-align-${t}`),i>0&&n.push(`lp-indent-${String(i)}`),0===n.length?"":` class="${n.join(" ")}"`}function Tt(e){return"object"==typeof e&&null!==e?e:void 0}function Rt(e){return Tt(e)}function Ct(e,t){if(void 0===t||""===t||!e.startsWith("/"))return e;try{let i=new URL(t),n=new URL(e,i);return n.origin===i.origin?n.href:e}catch{return e}}function $t(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-").toLowerCase()}function Ft(e){return"string"==typeof e&&e.length>0?e:void 0}function Nt(e){let t=Ft(e.title)??Ft(e.name)??Ft(e.slug);return void 0!==t?t:void 0===e.id?void 0:String(e.id)}function Ot(e){if("string"==typeof e.text)return e.text;if(!e.children)return"";let t="";for(let i of e.children)t+=Ot(i);return t}function Mt(e){return`${"number"==typeof e.width?` width="${String(e.width)}"`:""}${"number"==typeof e.height?` height="${String(e.height)}"`:""}`}function Lt(e){return"string"==typeof e.mimeType?` type="${ct(e.mimeType)}"`:""}function Ut(e){return ds.get(e)}function Et(e,t,i,n){let r=Tt(e.fields)??{},s="string"==typeof r.blockType?r.blockType:"",a=$t(s),l=""===a?n:`${n} ${n}--${a}`;if(""!==s){let e=Ut(s)??Ut(a);if(e)return e(r,{renderChildren:t.renderChildren});t.onUnrenderedBlock?.(s,l)}return`<${i} class="${l}"></${i}>`}function xt(e,t){return"number"==typeof t&&t>1?` ${e}="${String(t)}"`:""}function Pt(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 It(e,t){let i=function(e){return hs.get(e)??cs[e]}(e.type);return i?i(e,t):void 0!==e.children?t.renderChildren(e.children):""}function jt(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 i of e.children)t+=jt(i);return t}function Bt(e="text"){let t=new WeakSet;return{name:e,render:$((e,i)=>{let n=e.element,r=function(e){return null==e?"":Pt(e)?function(e){return Pt(e)?e.root.children.map(jt).join("\\n").trim():""}(e):"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):JSON.stringify(e)}(i);if("INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName){if(n.textContent.trim()!==r.trim()){if(function(e){return null!==e.querySelector(":scope > :not(br)")}(n)&&!n.hasAttribute(ps))return function(e,t,i){e.has(t)||(e.add(t),gi(`[live-preview] LP0402: Skipping text update for "${i}": <${t.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;if(r.includes("\\n")||r.includes("\\r")){n.innerHTML=et(function(e){return ut(e).replace(/\\r\\n|\\r|\\n/g,"<br>")}(r));return}n.textContent=r}}else n.value=r})}}function _t(e,t){let i=e.cloneNode(!1);i.innerHTML=et(t);let n=function(e,t){let i=e.firstElementChild,n=1===t.children.length?t.firstElementChild:null;if(null!==i?.nextElementSibling||0===t.children.length||!vs.has(i.tagName)||i.hasAttribute(gn)||n?.tagName===i.tagName||!0===n?.matches(us))return null;for(let e of t.children)if(e.tagName===i.tagName&&e.className===i.className)return null;return i}(e,i)??e,r=new Map,s=i.querySelectorAll(us);if(s.length>0&&null!==n.firstElementChild){let e=[];Wt(n,i,e);for(let[t,i]of e)t.replaceWith(i),i.matches(us)||r.set(t.className,!1);for(let e of s)null!==e.parentNode&&r.set(e.className,!0)}return n.replaceChildren(...i.childNodes),r}function Wt(e,t,i){let n=(e,t)=>{e.matches(us)?i.push([e,t]):Wt(t,e,i)},r=e.firstElementChild,s=t.firstElementChild;if(e.children.length===t.children.length){for(;null!==r&&null!==s;r=r.nextElementSibling)n(s,r),s=s.nextElementSibling;return}let a=new Set;for(let e of t.children)e.matches(us)||a.add(e.tagName);let l=(e,t)=>e.matches(us)?!a.has(t.tagName):e.tagName===t.tagName,o=0;for(;null!==r&&null!==s&&l(s,r);o+=1)n(s,r),r=r.nextElementSibling,s=s.nextElementSibling;let d=Math.min(e.children.length,t.children.length);r=e.lastElementChild,s=t.lastElementChild;for(let e=o;e<d&&null!==r&&null!==s;e+=1){if(!l(s,r))return;n(s,r),r=r.previousElementSibling,s=s.previousElementSibling}}function Dt(e,t,i,n){n&&t.reportUnfaithful?.(e,`lost the markup the server drew for block "${i}"`);let r=n?ms:gs;r.has(i)||(r.add(i),gi(`[live-preview] ${n?`LP0413: no renderer for block "${i}", and the markup the server rendered for it is lost.`:`LP0410: no renderer for block "${i}"; keeping what the server rendered for it.`} Register one with registerBlockRenderer().`))}function zt(e,t,i,n){if("string"!=typeof i||0===i.length)return{kind:"none"};let r=Ct(i,n);return R(r)?{kind:"safe",url:r}:(ws.has(e)||(ws.add(e),gi(`[live-preview] LP0401: refused an unsafe URL for "${t}" on <${e.tagName.toLowerCase()}>; the attribute was cleared.`)),{kind:"unsafe"})}function qt(e,t=e=>e){return{name:e,render(e,i,n){let r=e.element;if(ft(i)){!function(e){"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):e.value=""}(r);return}let s=ht(i);if("INPUT"!==r.tagName&&"TEXTAREA"!==r.tagName){if("A"===r.tagName){let i=e.hrefField,a=void 0===i||0===i.length?t(s):N(n.allFields,i,n.locale,void 0!==e.locale),l=zt(r,e.fieldName,a);"safe"===l.kind?r.setAttribute("href",l.url):"unsafe"===l.kind&&r.removeAttribute("href")}r.textContent=s}else r.value=s}}}function Vt(e){for(let t of Ts)e.removeAttribute(t)}function Ht(e,t,i,n){let r=function(e,t){let i=[];for(let[n,r]of Object.entries(e?.sizes??{})){if("string"!=typeof r.url||"number"!=typeof r.width)continue;let e=Ct(r.url,t);R(e)&&i.push({...r,name:n,url:e,width:r.width})}return i}(i,n),s=e.getAttribute("src"),a=r.find(t=>null!==s&&function(e,t,i){try{return new URL(t,e.baseURI).href===new URL(i,e.baseURI).href}catch{return t===i}}(e,t.url,s))??r.find(t=>t.name===Rs.get(e));void 0===a?.name?Rs.delete(e):Rs.set(e,a.name),e.src=a?.url??t;let l=a??i,o=r.filter(e=>Gt(e,l));if(0===o.length){e.removeAttribute("srcset"),e.removeAttribute("sizes");return}if("number"==typeof i?.width&&"string"==typeof i.url){let e=Ct(i.url,n),t={...i,url:e,width:i.width};R(e)&&Gt(t,l)&&o.push(t)}let d=new Set,u=[];for(let e of o)d.has(e.width)||(d.add(e.width),u.push(`${Jt(e.url)} ${String(e.width)}w`));let c=u.join(", ");e.setAttribute("srcset",c)}function Gt(e,t){if(void 0===t)return!0;if("string"==typeof e.mimeType&&"string"==typeof t.mimeType&&e.mimeType!==t.mimeType)return!1;let{width:i,height:n}=t;return"number"!=typeof i||"number"!=typeof n||"number"!=typeof e.width||"number"!=typeof e.height||Math.abs(e.width*n-e.height*i)<=Math.max(i,e.width)}function Jt(e){return e.replace(/[\\s,]/g,encodeURIComponent)}function Kt(e){"IMG"===e.tagName?Vt(e):e.style.backgroundImage=""}function Qt(e){"IMG"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):Vt(e)}function Xt(e){let t=Tt(e);return void 0===t?ht(e):Nt(t)??""}function Zt(e,t){let i=e??"";if(null==t)return i;let n=Yt(t);return"{}"===n?i:`${i}|${n}`}function Yt(e){if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(e=>Yt(e)).join(",")}]`;let t=e,i=Object.keys(t).sort(),n=[];for(let e of i){let i=t[e];void 0!==i&&n.push(`${JSON.stringify(e)}:${Yt(i)}`)}return`{${n.join(",")}}`}function ei(e){return{kind:"date",options:e}}function ti(e){return{kind:"number",options:e}}function ii(e,t,i,n){if(void 0===t||""===t)return;let r=function(e){let t=e.indexOf(":"),i=-1===t?e:e.slice(0,t),n=-1===t?void 0:e.slice(t+1);switch(i){case"date":return void 0===n?ei({dateStyle:"medium"}):xs.has(n)?ei({dateStyle:n}):void 0;case"time":return void 0===n?ei({timeStyle:"short"}):Ps.has(n)?ei({timeStyle:n}):void 0;case"datetime":return void 0===n?ei({dateStyle:"medium",timeStyle:"short"}):xs.has(n)?ei({dateStyle:n,timeStyle:"short"===n?"short":"medium"}):void 0;case"number":return void 0===n?ti({}):js.test(n)?ti({minimumFractionDigits:Number(n),maximumFractionDigits:Number(n)}):void 0;case"currency":return void 0!==n&&Is.test(n)?ti({style:"currency",currency:n.toUpperCase()}):void 0;case"percent":return void 0===n?ti({style:"percent"}):void 0;default:return}}(t);if(void 0!==r)return r.kind===e?r.options:void 0;!function(e,t,i){Bs.has(e)||(Bs.add(e),gi(`[live-preview] LP0408: data-payload-format="${i}" on "${t}" is not a known format; the default formatting was used. Known: date, time, datetime (each also :short|medium|long|full), number, number:0-4, currency:XXX, percent.`))}(i,n,t)}function ni(e){return String(e).padStart(2,"0")}function ri(e,t){return{name:e,render(){w(t)}}}function si(){return typeof __LIVE_PREVIEW_CONFIG__>"u"?[]:__LIVE_PREVIEW_CONFIG__}var ai=Object.defineProperty,li=e=>{throw TypeError(e)},oi=(e,t,i)=>((e,t,i)=>t in e?ai(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i),di=(e,t,i)=>t.has(e)||li("Cannot "+i),ui=(e,t,i)=>(di(e,t,"read from private field"),i?i.call(e):t.get(e)),ci=(e,t,i)=>t.has(e)?li("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),hi=(e,t,i,n)=>(di(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),fi=(e,t,i)=>(di(e,t,"access private method"),i),pi=t((...e)=>console.error(...e)),gi=t((...e)=>console.warn(...e)),mi=t((...e)=>console.debug(...e)),vi=class{constructor(){ci(this,wi);ci(this,yi,new Map);ci(this,bi,new Map)}on(e,t){return fi(this,wi,ki).call(this,ui(this,yi),e,t)}once(e,t){return fi(this,wi,ki).call(this,ui(this,bi),e,t)}off(e,t){fi(this,wi,Ai).call(this,ui(this,yi),e,t),fi(this,wi,Ai).call(this,ui(this,bi),e,t)}async emit(e,t){await fi(this,wi,Si).call(this,e,t)}async emitWhile(e,t,i){return fi(this,wi,Si).call(this,e,t,i)}listenerCount(e){return(ui(this,yi).get(e)?.size??0)+(ui(this,bi).get(e)?.size??0)}removeAllListeners(e){void 0!==e?(ui(this,yi).delete(e),ui(this,bi).delete(e)):(ui(this,yi).clear(),ui(this,bi).clear())}eventNames(){let e=new Set;for(let t of ui(this,yi).keys())e.add(t);for(let t of ui(this,bi).keys())e.add(t);return[...e]}},yi=new WeakMap,bi=new WeakMap,wi=new WeakSet,Si=async function(e,t,i){let n=()=>i?.()??!0;if(!n())return!1;let r=ui(this,yi).get(e);if(r)for(let i of[...r])if(!n()||(await fi(this,wi,Ti).call(this,i,t,e),!n()))return!1;if(!n())return!1;let s=ui(this,bi).get(e);if(s&&s.size>0){let i=[...s];ui(this,bi).delete(e);for(let r of i)if(!n()||(await fi(this,wi,Ti).call(this,r,t,e),!n()))return!1}return n()},ki=function(e,t,i){let n=e.get(t);return n||(n=new Set,e.set(t,n)),n.add(i),()=>{fi(this,wi,Ai).call(this,e,t,i)}},Ai=function(e,t,i){let n=e.get(t);void 0!==n&&(n.delete(i),0===n.size&&e.delete(t))},Ti=async function(e,t,i){try{await e(t)}catch(e){let t="string"==typeof i||"number"==typeof i?String(i):"<event>";pi(`[live-preview] LP0601: handler for "${t}" threw:`,e)}},Ri=1e3,Ci=new Set(["date","number","checkbox"]),$i=40,Fi=["data","fieldSchemaJSON","globalSlug","collectionSlug","locale","ready","previewToken","protocolVersion"],Ni={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"}},Oi=Object.keys(Ni),Mi=class{constructor(e,t){oi(this,"matcher");oi(this,"handlers");oi(this,"boundListener");oi(this,"attachedTarget");oi(this,"generation",0);oi(this,"revision",0);oi(this,"queueHead");oi(this,"queueTail");oi(this,"lastAccepted");oi(this,"replayedGeneration",0);oi(this,"latestAcceptedAttempt");this.matcher=e,this.handlers=t}attach(e=window){if(void 0!==this.attachedTarget)return;let t=!1,i=n=>{if(!t||this.boundListener!==i)return;let r=this.generation;try{this.receive(n,r,e)}catch{let e;try{e=n.origin}catch{e=""}this.reportInvalid("shape",e,r)}};this.generation+=1,this.resetQueue(),this.attachedTarget=e,this.boundListener=i;try{e.addEventListener("message",i)}catch(t){this.boundListener===i&&(this.attachedTarget=void 0,this.boundListener=void 0,this.resetQueue());try{e.removeEventListener("message",i)}catch{}throw t}if(this.boundListener===i)t=!0;else try{e.removeEventListener("message",i)}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)}replayLastAccepted(){let e=this.lastAccepted,t=this.generation,i=this.handlers.onReplay;if(void 0===i||void 0===e||e.generation>=t||this.replayedGeneration===t||!this.matchesOrigin(e.origin,t)||this.lastAccepted!==e)return!1;this.replayedGeneration=t;let n={generation:t,revision:this.revision+=1};return this.invokeHandler(t,i,structuredClone(e.message),e.origin,n),!0}forgetLastAccepted(){this.lastAccepted=void 0,this.replayedGeneration=0,this.latestAcceptedAttempt=void 0}static sendReady(e,t){let i={type:"payload-live-preview",ready:!0,protocolVersion:4};for(let n of e)for(let e of t)try{n.postMessage(i,e)}catch{}}receive(e,t,i){let n=e.origin;if(!this.matchesOrigin(n,t)){this.reportInvalid("origin",n,t);return}if(!this.matchesSource(e,i)){this.reportInvalid("source",n,t);return}let r=e.data;if(function(e){return"object"==typeof e&&null!==e&&"type"in e&&"string"==typeof e.type}(r))switch(r.type){case"payload-live-preview":if(!function(e){let t=e;return!(void 0!==t.data&&null!==t.data&&!v(t.data))&&m(t.fieldSchemaJSON,e=>Array.isArray(e))&&m(t.globalSlug,e=>"string"==typeof e)&&m(t.collectionSlug,e=>"string"==typeof e)&&m(t.locale,e=>"string"==typeof e)&&m(t.ready,e=>"boolean"==typeof e)&&m(t.previewToken,e=>"string"==typeof e)&&m(t.protocolVersion,e=>"number"==typeof e)}(r)){this.reportInvalid("shape",n,t);return}this.dispatchUpdate(function(e){let t={...e};for(let e of Fi)null===Reflect.get(t,e)&&Reflect.deleteProperty(t,e);return Array.isArray(t.fieldSchemaJSON)?{...t,fieldSchemaJSON:h(t.fieldSchemaJSON)}:t}(r),n,t);return;case"payload-document-event":if(!function(e){let t=e;return g(t.action,e=>"updated"===e||"created"===e||"deleted"===e)&&g(t.slug,e=>"string"==typeof e)&&g(t.id,e=>"string"==typeof e||Number.isFinite(e))}(r)){this.reportInvalid("shape",n,t);return}this.invokeHandler(t,this.handlers.onDocumentEvent,r,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}(r);if(void 0===e){this.reportInvalid("shape",n,t);return}this.invokeHandler(t,this.handlers.onFocusField,e,n);return}default:this.reportInvalid("type",n,t)}else this.reportInvalid("shape",n,t)}dispatchUpdate(e,t,i){let n=v(e.data);if(!this.isCurrentGeneration(i))return;let r=n?{generation:i,revision:this.revision+=1}:void 0,s=this.handlers.validateToken;if(!this.isCurrentGeneration(i))return;if(void 0===s){this.commitUpdate(e,t,i,r);return}if(!0===e.ready&&void 0===e.data){this.commitUpdate(e,t,i,void 0);return}let a={generation:i,message:e,origin:t,messageRevision:r,verdict:void 0,next:void 0};this.enqueue(a);let l;try{l=s(e.previewToken,t)}catch{this.settleValidation(a,!1);return}"boolean"!=typeof l?Promise.resolve(l).then(e=>{this.settleValidation(a,!0===e)},()=>{this.settleValidation(a,!1)}):this.settleValidation(a,l)}settleValidation(e,t){e.verdict=t,this.drainQueue(e.generation)}drainQueue(e){for(;this.isCurrentGeneration(e);){let t=this.queueHead;if(void 0===t)return;if(this.matchesOrigin(t.origin,e)){if(void 0===t.verdict)return;this.dequeue(t)&&(t.verdict?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,i,n){if(void 0===n)this.invokeHandler(i,this.handlers.onUpdate,e,t);else{let r={};this.latestAcceptedAttempt=r;let s=function(e){let t={...e};delete t.previewToken;try{return structuredClone(t)}catch{return null}}(e);if(this.latestAcceptedAttempt!==r||!this.isCurrentGeneration(i))return;this.lastAccepted=null===s?void 0:{generation:i,message:s,origin:t},this.invokeHandler(i,this.handlers.onUpdate,e,t,n)}}reportInvalid(e,t,i){this.invokeHandler(i,this.handlers.onInvalid,e,t)}matchesSource(e,t){if("parent-or-opener"!==this.handlers.sourcePolicy)return!0;try{let i=e.source;if("object"!=typeof i||null===i)return!1;let n=t.parent;return n!==t&&i===n||i===t.opener}catch{return!1}}matchesOrigin(e,t){try{return!0===(this.isCurrentGeneration(t)&&this.matcher(e))&&this.isCurrentGeneration(t)}catch{return!1}}invokeHandler(t,i,...n){if(void 0!==i&&this.isCurrentGeneration(t))try{e(i(...n))}catch{}}isCurrentGeneration(e){return void 0!==this.attachedTarget&&this.generation===e}enqueue(e){void 0===this.queueTail?this.queueHead=e:this.queueTail.next=e,this.queueTail=e}dequeue(e){return this.queueHead===e&&(this.queueHead=e.next,void 0===this.queueHead&&(this.queueTail=void 0),!0)}resetQueue(){this.queueHead=void 0,this.queueTail=void 0}},Li={"structural arrays":\'data-payload-type="array" and keyed lists\',"array templates":"data-payload-array-template","server-rendered fragments":"data-payload-fragment boundaries","route refreshes":\'data-payload-strategy="route" and bindings in <head>\',"screen-reader announcements":"the aria-live region","auto-binding":"autoBind: \'unique\'"},Ui=new Set,Ei=new Set(["tabs","row","collapsible"]),xi={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"},Pi=new Set(["http:","https:","mailto:","tel:"]),Ii=/^(?:\\.{1,2}\\/|[a-zA-Z0-9_-]+\\/?)/,ji=/^[\\\\/]{2}/,Bi=/[\\t\\n\\r]/g,_i=/[\\s\\u0000-\\u001f\\u180e\\u2000-\\u2029]/g,Wi=/^([a-z][a-z0-9+.-]*):/i,Di=new Set(["style","srcdoc","formaction","form","id","name","is","srcset","imagesrcset"]),zi=new Set(["href","src","poster","cite","action","xlink:href","data"]),qi=new WeakSet,Vi=class{constructor(){oi(this,"previous",null);oi(this,"lastFields");oi(this,"priorFields");oi(this,"keepValues",!1)}get previousFields(){return this.priorFields}get isBaseline(){return null===this.previous}diff(e,t,i=F){let r=this.previous,s=null===r,a=new Map,l=new Set,o=Object.entries(e);if(!i())return null;for(let[e,t]of o){let s=n(t);if(!i())return null;a.set(e,s),(null===r||void 0===s||r.get(e)!==s)&&l.add(e)}if(null!==r)for(let e of r.keys())a.has(e)||l.add(e);let d=new Set,u=Object.entries(t);if(!i())return null;for(let[e,t]of u)if(l.has(e))for(let e of t)if(d.add(e),!i())return null;return i()?(this.previous=a,this.priorFields=this.keepValues?this.lastFields:void 0,this.lastFields=this.keepValues?e:void 0,{changed:l,invalidated:d,baseline:s}):null}reset(){this.previous=null,this.lastFields=void 0,this.priorFields=void 0}},Hi=new Set(["__proto__","prototype","constructor"]),Gi="data-payload-fragment",Ji="data-payload-strategy",Ki=8,Qi=1024,Xi=new Set(["id","_id","createdAt","updatedAt","createdBy","updatedBy","_status","globalType","collection","locale","localized"]),Zi=new Set(["text","textarea","email","number","checkbox","date","select","radio","point","code","json","ui","html"]),Yi=new Set(["root","paragraph","text","heading","quote","list","listitem","linebreak","tab","horizontalrule","code","code-highlight","table","tablerow","tablecell","link","autolink"]),en={},tn=class{constructor(){oi(this,"rawChanges",new Vi);oi(this,"resolved",null);oi(this,"resolvedLocale",null);oi(this,"trailing",null);oi(this,"openUntil",0);oi(this,"requestAttempt",0)}decide(e,t){let i=t.rawData;if(!function(e){let{cache:t,emitter:i}=e;if(t.islands.length>0||i.listenerCount("beforeUpdate")>0||i.listenerCount("afterUpdate")>0)return!0;for(let e of t.values())if(X(e)||e.fieldName.includes(".")||ee(e.hrefField)||ee(e.srcField)||ee(e.altField))return!0;return void 0!==e.strategies.fragment&&null!==e.root.querySelector(`[${Gi}]`)}(e)&&!function(e,t,i){for(let n of e.values()){if("text"!==n.fieldType||!0===n.explicitFieldType)continue;let e=M(t,n,n.fieldName,i);if(se(e)&&Z(e.root))return!0}return!1}(e.cache,i,t.locale))return t.forceRender&&(this.resolvedLocale=null),{merge:!1,fields:i};let{changed:n}=this.rawChanges.diff(i,en),r=this.resolvedLocale!==t.locale,s=this.resolved;if(null===s)return this.resolved=i,{merge:!0,fields:i};let a={...s};t.forceRender&&(this.resolvedLocale=null);let l=t.forceRender||r;for(let r of n){let n=i[r];if(Xi.has(r)){a[r]=n;continue}let o=Q(r,s[r],n,e.cache,t.schemaIndex);"own"!==o&&(l=!0,this.resolvedLocale=null),"keep"!==o&&(a[r]=n)}return this.resolved=a,{merge:l,fields:a}}request(e,t,i){let n=++this.requestAttempt,r=Date.now();if(r>=this.openUntil)return this.openUntil=r+t,this.dropQueued(),this.requestAttempt!==n?{leading:!0,result:Promise.resolve({status:"superseded"})}:{leading:!0,result:e.merge(i)};let s=this.trailing,a=s?.pending??function(){let e;return{promise:new Promise(t=>{e=t}),settle:e}}(),l={request:i,pending:a,timer:null};if(this.trailing=l,this.openUntil=r+t,null!==s&&null!==s.timer&&clearTimeout(s.timer),this.trailing!==l)return{leading:!1,result:a.promise};let o=setTimeout(()=>{this.flush(e,l)},t);return this.trailing===l?l.timer=o:clearTimeout(o),{leading:!1,result:a.promise}}recordMerged(e,t){this.resolved=e,this.resolvedLocale=t}resetRawChanges(){this.rawChanges.reset()}destroy(){this.requestAttempt+=1,this.openUntil=0,this.dropQueued()}dropQueued(){let e=this.trailing;this.trailing=null,null!==e&&(null!==e.timer&&clearTimeout(e.timer),e.pending.settle({status:"superseded"}))}flush(e,t){this.trailing===t&&(this.trailing=null,t.timer=null,e.merge(t.request).then(t.pending.settle))}},nn=class{constructor(){oi(this,"negotiation",y(void 0));oi(this,"observed",new Set)}observe(e,t){let i=e.filter(e=>!this.observed.has(e));if(0!==i.length){for(let e of i)this.observed.add(e);this.negotiation=y(this.negotiation.theirs,this.observed),t("protocol",`observed=${i.join(",")}`)}}applyVersion(e,t){let i=this.negotiation;if(i.theirs===e)return;let n=y(e,this.observed);this.negotiation=n,n.negotiated!==i.negotiated&&t("protocol","ours=4",`theirs=${e}`,`negotiated=${n.negotiated}`)}},rn=class{constructor(){oi(this,"lastIdentity")}inspect(e){let t=e.externallyUpdatedRelationship;if("object"!=typeof t||null===t)return null;let i=JSON.stringify([t.entitySlug,B(t),t.updatedAt]);return{identity:i,edit:i!==this.lastIdentity&&te(t,e)?t:null}}commit(e){let t=e.identity!==this.lastIdentity;return this.lastIdentity=e.identity,t?e.edit:null}},sn=class{constructor(){ci(this,an)}reveal(e,t,i){return e===ui(this,an)?"skipped-same":(hi(this,an,e),function(e,t){return function(e,t){let i=e.getBoundingClientRect(),n=i.bottom>0&&i.top<t.innerHeight,r=i.right>0&&i.left<t.innerWidth;return n&&r}(e,t)?"already-visible":(e.scrollIntoView({behavior:ne(t)?"auto":"smooth",block:"center"}),"revealed")}(t,i))}reset(){hi(this,an,void 0)}},an=new WeakMap,ln=class{constructor(){oi(this,"seen",new Map)}note(e,t,i){let r=n(i);if(void 0===r)return;let s=`${t.owner??""}\\0${t.locale??""}\\0${t.fieldName}`,a=this.seen.get(s);void 0!==a?a!==r&&(e.revealIdentities.push([s,r]),e.revealTarget??(e.revealTarget=t)):this.seen.set(s,r)}commit(e){for(let[t,i]of e.revealIdentities)this.seen.set(t,i);e.revealIdentities=[];let t=e.revealTarget;return e.revealTarget=void 0,t}},on=()=>{},dn=class{constructor(){oi(this,"host",{outstanding:()=>!1,report:on,failed:on});oi(this,"entry",null);oi(this,"ended")}begin(e,t){let i=this.entry,n=null===i?void 0:this.view(i);null!==i&&(i.key=void 0),this.ended=void 0,this.entry={key:e,revision:t,shortfalls:[],seen:new Set,deferred:0,awaiting:0,reported:void 0,queued:!1},null!==i&&void 0!==n&&this.publish(i,"pending"===n.state?{...n,state:"superseded"}:n)}end(){let e=this.entry;if(null!==e){this.entry=null;try{this.ended=this.view(e)}finally{e.key=void 0}}}snapshot(){return null!==this.entry?this.view(this.entry):void 0===this.ended?void 0:{...this.ended,shortfalls:[...this.ended.shortfalls]}}shortfall(e,t){let i=this.entry;if(i?.key!==e)return;let n=JSON.stringify(t);i.seen.has(n)||(i.seen.add(n),i.shortfalls.push(t),this.requestSettle(i.key))}deferred(e,t){this.entry?.key===e&&(this.entry.deferred=t)}handIsland(e){let t=this.entry;if(t?.key!==e)return on;t.awaiting+=1;let i=!1;return()=>{i||this.entry!==t||(i=!0,t.awaiting-=1,this.settle(t))}}requestSettle(e){let t=this.entry;t?.key!==e||t.queued||(t.queued=!0,queueMicrotask(()=>{t.queued=!1;try{this.entry===t&&this.settle(t)}catch(e){this.host.failed(e)}}))}settle(e){let t=this.view(e);"pending"!==t.state&&this.publish(e,t)}publish(e,t){e.reported!==t.state&&(e.reported=t.state,this.host.report(t))}view(e){let t=void 0!==e.key&&this.host.outstanding(e.key)?"pending":e.shortfalls.length>0?"partial":e.awaiting>0?"unconfirmed":"current";return{revision:e.revision,state:t,shortfalls:[...e.shortfalls],deferred:e.deferred,awaitingIslands:e.awaiting}}},un=class{constructor(){oi(this,"started",!1);oi(this,"suspended",!1);oi(this,"deferredStart",null);oi(this,"hydration","idle");oi(this,"activeUpdate",null);oi(this,"locale");oi(this,"schema");oi(this,"schemaIndex");oi(this,"updateCount",0);oi(this,"supersededCount",0);oi(this,"completedCount",0);oi(this,"skippedUnchangedCount",0);oi(this,"lastFlush",null);oi(this,"absentFields",new Set);oi(this,"warnedOrphanFields",new Set);oi(this,"warnedStrategy",new WeakSet);oi(this,"warnedUnattributableMessage",!1);oi(this,"warnedVisibilityGate",!1);oi(this,"warnedFragmentFallback",!1);oi(this,"warnedIslandStart",!1);oi(this,"warnedEscalationUnavailable",!1);oi(this,"warnedProtocolShape",!1);oi(this,"reportedUnfaithful",new WeakMap);oi(this,"checkedServerFormat",new WeakSet);oi(this,"unfaithfulPatches",[]);oi(this,"unfaithfulCount",0);oi(this,"escalatedCount",0);oi(this,"unfaithfulFields",new Set);oi(this,"autoBindSearchMs");oi(this,"autoBindGuesses",null);oi(this,"warnedForeignSource",!1);oi(this,"lastAppliedIdentity",new WeakMap);oi(this,"navigationReplayPending",!1);oi(this,"navigationBindingReplay",!1);oi(this,"revealLedger",new ln);oi(this,"display",new dn);oi(this,"fragmentStats",{rendered:0,failed:0,superseded:0});oi(this,"routeStats",{refreshes:0,partial:0,failed:0,refused:0,loopStopped:0});oi(this,"fragmentControllers",new Map);oi(this,"routeController",null);oi(this,"routeRetry",null);oi(this,"routeRefreshOwed",!1);oi(this,"routeAwaitsSave",!1);oi(this,"fragmentsOwed",new Set);oi(this,"readyTimers",[]);oi(this,"revealer",new sn);oi(this,"changes",new Vi);oi(this,"merges",new tn);oi(this,"protocol",new nn);oi(this,"relationships",new rn)}isRunning(){return this.started}isCurrent(e){return this.started&&this.activeUpdate===e}complete(e){this.display.requestSettle(e),!e.completed&&(e.completed=!0,e.countsAsUpdate&&(this.completedCount+=1))}forgetOwedWork(){this.routeRefreshOwed=!1,this.routeAwaitsSave=!1,this.fragmentsOwed.clear()}supersedeStrategies(){null!==this.routeRetry&&(clearTimeout(this.routeRetry),this.routeRetry=null,this.routeRefreshOwed=!0);for(let[e,t]of this.fragmentControllers){for(let e of t)this.fragmentsOwed.add(e);e.abort()}this.fragmentControllers.clear()}abortStrategies(){this.supersedeStrategies();let e=this.routeController;this.routeController=null,e?.abort()}},cn=class{constructor(e,t){oi(this,"deps",e);oi(this,"state",t);oi(this,"writing");oi(this,"instanceContext");this.instanceContext=function(e){let t={};for(let[i,n]of Object.entries(e))void 0!==n&&(t[i]=n);return t}({renderRichText:e.renderRichText,sanitizerPolicy:e.sanitizerPolicy,serverURL:e.serverURL,reportUnfaithful:(i,n)=>{s(e,t,i,n,this.writing)}})}apply(e){let{deps:t,state:i}=this,n=i.activeUpdate;if(null===n||void 0===e.revision||!b(n.revision,e.revision)||!i.isCurrent(n))return!1;let{target:r,value:a}=e,d=void 0!==n.schemaIndex?T(n.schemaIndex,r.fieldName):void 0,u=function(e,t){if(e.explicitFieldType)return e.fieldType;if(void 0!==t){let e=function(e){if(Object.prototype.hasOwnProperty.call(xi,e))return xi[e]}(t);if(void 0!==e)return e}return e.fieldType}(r,d?.type);"text"===u&&!0!==r.explicitFieldType&&se(a)&&(u="richText");let c;try{c=t.resolveRenderer(u,r)}catch(e){return this.fail(n,r.fieldName,e)}if(!i.isCurrent(n))return!1;let h=t.emitter.listenerCount("elementUpdate")>0,f=h?function(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value:"IMG"===e.tagName?e.src:e.textContent}(r.element):void 0;if(!i.isCurrent(n))return!1;let p={allFields:e.allFields,locale:r.locale??n.locale,schema:d,...this.instanceContext};!0===r.hidesWhenEmpty&&r.element.toggleAttribute("hidden",function(e){return null==e||("string"==typeof e?0===e.trim().length:Array.isArray(e)&&0===e.length||ae(e))}(a));try{if(void 0!==r.targetAttribute){if("blocked"===function(e,t,i){let n=t.toLowerCase().trim();if(0===n.length||!function(e){return!e.startsWith("on")&&!Di.has(e)}(n))return"blocked";if(null==i)return e.removeAttribute(n),"applied";if("string"!=typeof i&&"number"!=typeof i&&"boolean"!=typeof i)return"blocked";let r=String(i);return zi.has(n)&&!R(r)?"blocked":(e.setAttribute(n,r),"applied")}(r.element,r.targetAttribute,a))return t.warn(`[live-preview] LP0401: refused to write "${r.fieldName}" into attribute "${r.targetAttribute}"`),i.display.shortfall(n,{kind:"write",field:r.fieldName,code:"LP0401"}),!1}else{if(void 0===c)return t.log("no renderer for",u),s(t,i,r,`has no renderer for "${u}"`,a),!1;{let e=function(e,t,i,n){if("ignore"===e.onUnfaithfulPatch||void 0!==i.format||!Ci.has(n)||t.checkedServerFormat.has(i.element))return;t.checkedServerFormat.add(i.element);let r=l(i.element);return r.trim().length>0?r:void 0}(t,i,r,u);if(this.writing=a,!1===function(e,t,i,n){return e.render(t,i,n)}(c,r,a,p)&&function(e){return qi.has(e.render)}(c))return s(t,i,r,`is a value ${c.name} cannot render`,a),!1;void 0!==e&&function(e,t,i){let n=l(t.element);n!==i&&e.warn(`[live-preview] LP0412: "${t.fieldName}" showed ${o(i)}, the patch wrote ${o(n)} \\u2014 either an edit that arrived before the preview connected, or a template that formats this value differently. Set data-payload-format to match it.`)}(t,r,e)}}}catch(e){return this.fail(n,r.fieldName,e)}if(!i.isCurrent(n))return!1;h&&t.emitter.emitWhile("elementUpdate",{element:r.element,fieldName:r.fieldName,previousValue:f,nextValue:a,revision:n.revision.revision,receivedAt:n.receivedAt,source:"patch"},()=>i.isCurrent(n));let g=i.isCurrent(n);return g&&(void 0!==e.valueIdentity?i.lastAppliedIdentity.set(r.element,e.valueIdentity):i.lastAppliedIdentity.delete(r.element)),g}fail(e,t,i){if(!this.state.isCurrent(e))return!1;this.state.display.shortfall(e,{kind:"write",field:t,code:"LP0603"});let n=i instanceof Error?i:new Error(String(i));return this.deps.emitter.emitWhile("error",{error:n,context:"renderer",code:"LP0603"},()=>this.state.isCurrent(e)),!1}},hn="payload-live-preview:update",fn="data-payload-island",pn=`astro-island, [${fn}]`,gn="data-payload-field",mn="data-payload-type",vn="data-payload-attribute",yn="data-payload-href",bn="data-payload-src",wn="data-payload-alt",Sn="data-payload-array-template",kn="data-payload-array-separator",An="data-payload-locale",Tn="data-payload-format",Rn="data-payload-richtext",Cn="data-payload-html",$n="data-payload-array",Fn="data-payload-structural",Nn="data-payload-owner",On="data-payload-depends",Mn="data-payload-strategy",Ln="data-payload-boundary",Un="data-payload-covers",En=[gn,mn,vn,yn,bn,wn,Sn,kn,An,Tn,Rn,Cn,$n,Fn,Nn,On,Mn,Ln,"type"],xn=`[${gn}]`,Pn=`[${Nn}]`,In=`[${Gi}], [${Mn}="route"]`,jn=/^[a-z][a-z0-9-]*:[a-z][a-z0-9-]*$/i,Bn=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"]),_n=class{constructor(e={}){oi(this,"entriesByField",new Map);oi(this,"entryByElement",new WeakMap);oi(this,"filter");oi(this,"count",0);oi(this,"dependencies",null);oi(this,"islandRoots",[]);oi(this,"ownersByIsland",new Map);oi(this,"navigationRoots",[]);oi(this,"coverDeclarations",[]);oi(this,"renderedDeclarations",[]);this.filter=e.filter??ve}dependencyMap(){if(null!==this.dependencies)return this.dependencies;let e=[];for(let t of this.values())void 0!==t.dependsOn&&e.push(de(t.fieldName,t.dependsOn));return this.dependencies=oe(...e),this.dependencies}get islands(){return this.islandRoots}get islandOwners(){return this.ownersByIsland}get covers(){return this.coverDeclarations}get rendered(){return this.renderedDeclarations}get navigationReplayRoots(){return this.navigationRoots}buildFromRoot(e){let t=performance.now();this.clear();let i=0;for(let t of e.querySelectorAll(xn))void 0!==this.add(t)&&(i+=1);return this.islandRoots=function(e){let t=[];for(let i of e.querySelectorAll(pn))ue(i)||t.push(i);return t}(e),this.ownersByIsland=new Map(this.islandRoots.map(e=>[e,fe(e)])),this.navigationRoots=[...e.querySelectorAll(In)].filter(e=>this.filter(e)&&(e.hasAttribute(Gi)||0===(e.getAttribute(gn)??"").length)),this.coverDeclarations=[...e.querySelectorAll(`[${Un}]`)].filter(e=>this.filter(e)).map(e=>({paths:le(e.getAttribute(Un)),owner:fe(e)})),this.renderedDeclarations=[...e.querySelectorAll(`[${On}]`)].filter(e=>this.filter(e)).flatMap(e=>{let t=function(e){if((e.getAttribute(Gi)??"").length>0)return"fragment";let t=e.getAttribute(Mn);return null!==t?"route"===t?"route":void 0:e.hasAttribute(gn)&&null!==e.closest("head")?"route":void 0}(e);return void 0===t?[]:[{strategy:t,paths:le(e.getAttribute(On)),owner:fe(e)}]}),{elementCount:i,fieldCount:this.entriesByField.size,durationMs:performance.now()-t}}add(e){let t=this.filter(e)?this.resolveBinding(e):void 0,i=this.entryByElement.get(e);if(this.dependencies=null,void 0!==t)return void 0!==i&&this.replaceEntry(i,t)?(this.entryByElement.set(e,t),t):(void 0!==i&&this.removeEntry(e,i),this.append(t),this.entryByElement.set(e,t),t);void 0!==i&&this.removeEntry(e,i)}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=[],this.ownersByIsland=new Map,this.navigationRoots=[],this.coverDeclarations=[],this.renderedDeclarations=[]}replaceEntry(e,t){if(e.fieldName!==t.fieldName)return!1;let i=this.entriesByField.get(e.fieldName),n=void 0===i?-1:i.indexOf(e);return!(void 0===i||n<0||(i[n]=t,0))}removeEntry(e,t){this.entryByElement.delete(e);let i=this.entriesByField.get(t.fieldName),n=void 0===i?-1:i.indexOf(t);return!(void 0===i||n<0||(i.splice(n,1),0===i.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(gn);if(null===t||0===t.length)return;let i=e.getAttribute(mn),n=e.getAttribute(vn),r=e.getAttribute(yn),s=e.getAttribute(bn),a=e.getAttribute(wn),l=e.getAttribute(Sn),o=e.getAttribute(kn),d=e.getAttribute(An),u=e.getAttribute(Tn),c=fe(e),h=le(e.getAttribute(On)),f=e.getAttribute(Mn),p=e.getAttribute("data-payload-guessed"),g=U(e);return{element:e,fieldName:t,fieldType:me(e),explicitFieldType:null!==i&&pe(i),strategyKind:E(e)??"unknown",...null!==g?{fragmentBoundary:g}:{},...null!==n&&n.length>0?{targetAttribute:n}:{},...null!==r&&r.length>0?{hrefField:r}:{},...null!==s&&s.length>0?{srcField:s}:{},...null!==a&&a.length>0?{altField:a}:{},...null!==l?{arrayTemplate:l}:{},...null!==o?{arraySeparator:o}:{},...null!==d&&d.length>0?{locale:d}:{},...null!==u&&u.length>0?{format:u}:{},...void 0!==c?{owner:c}:{},...h.length>0?{dependsOn:h}:{},...null!==f&&f.length>0?{strategy:f}:{},...e.hasAttribute(Ln)?{hidesWhenEmpty:!0}:{},...null!==p?{guessed:p}:{}}}},Wn=64,Dn=1e4,zn=1e3,qn=64,Vn=8192,Hn=1048576,Gn=1e4,Jn=20,Kn=new Set(["__proto__","constructor","prototype"]),Qn=class{constructor(e){oi(this,"serverURL");oi(this,"apiRoute");oi(this,"depth");oi(this,"fetchFn");oi(this,"log");oi(this,"inflight",null);oi(this,"attempt",0);oi(this,"destroyDepth",0);this.serverURL=function(e){let t=e.length;for(;e.endsWith("/",t);)t-=1;return e.slice(0,t)}(e.serverURL);let n=e.apiRoute??"/api";this.apiRoute=n.startsWith("/")?n:`/${n}`,this.depth=e.depth??1,this.fetchFn=e.fetchFn,this.log=t(e.log??i)}canMerge(e){try{let t=e.schema;return void 0!==t?($e(e.data,t,this.serverURL,this.apiRoute,this.depth,e.locale),!0):null!==this.endpointOf(e)}catch{return!1}}endpointOf(e){try{let t=e.globalSlug;if(t)return Me(t)?{path:`globals/${encodeURIComponent(t)}`,field:"globalType",value:t}:null;let i=e.collectionSlug??"",n=e.data.id;return Me(i)&&Le(n)?{path:`${encodeURIComponent(i)}/${encodeURIComponent(String(n))}`,field:"id",value:String(n)}:null}catch{return null}}async merge(e){if(this.destroyDepth>0)return{status:"superseded"};let t=this.attempt+=1,i=this.inflight;this.inflight=null;let n=null,r=!1,s=()=>this.attempt!==t;try{if(i?.abort(),s())return{status:"superseded"};let t=e.schema;if(r=void 0!==t,void 0!==t){let i=$e(e.data,t,this.serverURL,this.apiRoute,this.depth,e.locale);if(s())return{status:"superseded"};if(0===i.requests.length)return{status:"merged",doc:i.doc};let r=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(s())return{status:"superseded"};if(void 0===r)return{status:"unavailable"};n=new AbortController,this.inflight=n;for(let e of i.requests){let t=await r(e.url,{method:"GET",credentials:"include",redirect:"error",signal:n.signal});if(s())return{status:"superseded"};let i=t.ok;if(s())return{status:"superseded"};if(!i){let e=t.status;return s()?{status:"superseded"}:(n.abort(),s()?{status:"superseded"}:(this.log("merge HTTP",e),s()?{status:"superseded"}:{status:"unavailable"}))}let a=await Fe(t,n.signal,()=>!s());if(s())return{status:"superseded"};if(Ne(e,a),s())return{status:"superseded"}}return{status:"merged",doc:i.doc}}let a=this.endpointOf(e);if(s())return{status:"superseded"};if(null===a)return{status:"unavailable"};let l=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(s())return{status:"superseded"};if(void 0===l)return{status:"unavailable"};let o=JSON.stringify({data:e.data,depth:this.depth,flattenLocales:!1,locale:e.locale});if(s())return{status:"superseded"};n=new AbortController,this.inflight=n;let d=`${this.serverURL}${this.apiRoute}/${a.path}`,u=await l(d,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","X-Payload-HTTP-Method-Override":"GET"},body:o,signal:n.signal});if(s())return{status:"superseded"};let c=u.ok;if(s())return{status:"superseded"};if(!c){let e=u.status;return s()?{status:"superseded"}:(this.log("merge HTTP",e,d),s()?{status:"superseded"}:{status:"unavailable"})}let h=u.json.bind(u);if(s())return{status:"superseded"};let f=await h();if(s())return{status:"superseded"};if(null===f||"object"!=typeof f||Array.isArray(f))return this.log("merge invalid",d),s()?{status:"superseded"}:{status:"unavailable"};let p=f,g=p[a.field],m=Object.hasOwn(p,a.field)&&("id"===a.field?!Le(g)||String(g)!==a.value:g!==a.value);return s()?{status:"superseded"}:m?(this.log("merge invalid",d),s()?{status:"superseded"}:{status:"unavailable"}):{status:"merged",doc:p}}catch(e){return s()||r&&(n?.abort(),s())?{status:"superseded"}:(this.log("merge exception",r?new Error("legacy population could not be resolved"):e),s()?{status:"superseded"}:{status:"unavailable"})}finally{this.inflight===n&&(this.inflight=null)}}destroy(){this.attempt+=1;let e=this.inflight;this.inflight=null,this.destroyDepth+=1;try{e?.abort()}finally{this.destroyDepth-=1}}},Xn="2.2.1",Zn={name:"payload-2",fieldTyping:"schema",populatesRelationships:"admin",documentEvents:!1},Yn={name:"payload-3",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!0},er={name:"unknown",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!1},tr="ssr",ir=1,nr=[gn,Nn,Un,On],rr=`[${gn}], [${Un}], ${pn}, ${In}`,sr=class{constructor(e,t={}){oi(this,"callbacks");oi(this,"debounceMs");oi(this,"rootMargin");oi(this,"visible",new Set);oi(this,"mutation",null);oi(this,"intersection",null);oi(this,"debounceTimer",null);oi(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 i=t+1;if(this.generation!==i)return;let n=null,r=null;try{n=new MutationObserver(e=>{this.handleMutations(e,i)}),r=new IntersectionObserver(e=>{this.handleIntersection(e,i)},{rootMargin:this.rootMargin,threshold:0}),n.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...En,Un,fn,tr]})}catch(e){throw n?.disconnect(),r?.disconnect(),e}this.generation===i?(this.mutation=n,this.intersection=r):(n.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,i=this.intersection;this.debounceTimer=null,this.mutation=null,this.intersection=null,this.visible.clear(),null!==e&&clearTimeout(e);try{t?.disconnect()}finally{i?.disconnect()}}handleMutations(e,t){if(!this.isCurrentGeneration(t))return;for(let i of e){let e=Ee(i);if(null!==e&&(this.callbacks.onIslandHydrated?.(e),!this.isCurrentGeneration(t)))return}if(!function(e){for(let t of e){if("attributes"===t.type&&t.attributeName===fn||"attributes"===t.type&&null!==t.attributeName&&(nr.includes(t.attributeName)||En.includes(t.attributeName)&&t.target.nodeType===ir&&t.target.hasAttribute(gn)))return!0;for(let e of t.addedNodes)if(xe(e))return!0;for(let e of t.removedNodes)if(xe(e))return!0}return!1}(e))return;null!==this.debounceTimer&&clearTimeout(this.debounceTimer);let i=setTimeout(()=>{!this.isCurrentGeneration(t)||this.debounceTimer!==i||(this.debounceTimer=null,this.callbacks.onStructuralChange())},this.debounceMs);this.debounceTimer=i}handleIntersection(e,t){for(let i of e){if(!this.isCurrentGeneration(t))return;let{target:e}=i;if(i.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}},ar=class{constructor(e){ci(this,ur);ci(this,lr,[]);ci(this,or);ci(this,dr,!1);hi(this,or,e)}get closed(){return ui(this,dr)}own(e){ui(this,dr)?fi(this,ur,cr).call(this,e):ui(this,lr).push(e)}close(){if(ui(this,dr))return;hi(this,dr,!0);let e=ui(this,lr).splice(0).reverse();for(let t of e)fi(this,ur,cr).call(this,t)}},lr=new WeakMap,or=new WeakMap,dr=new WeakMap,ur=new WeakSet,cr=function(e){try{e()}catch(e){ui(this,or).call(this,"runtime cleanup failed:",e)}},hr="__livePreviewHydration",fr="[data-payload-field]",pr="__vue_app__",gr="__livePreviewVueHydration",mr="app:suspense:resolve",vr={react:(e,t)=>function(e,t=5e3){Ie();let i=Pe();if(void 0===i)return null;if(void 0===i.onCommit){let e=e=>{!i.committed&&function(e){let t=e;return null!=t&&function(e){let t=e;return 9===t?.nodeType||null!=t?.querySelector?.(fr)}(t.containerInfo)&&!function(e){let t=[];for(null!==e.current&&void 0!==e.current&&t.push(e.current);t.length>0;){let e=t.pop();if(void 0===e)continue;let i=e.memoizedState;if((13===e.tag||31===e.tag)&&"object"==typeof i&&null!==i&&"dehydrated"in i&&"object"==typeof i.dehydrated&&null!==i.dehydrated&&"nodeType"in i.dehydrated&&8===i.dehydrated.nodeType)return!0;null!==e.sibling&&void 0!==e.sibling&&t.push(e.sibling),null!==e.child&&void 0!==e.child&&t.push(e.child)}return!1}(t)}(e)&&je(i)};i.onCommit=e;for(let t of i.commits.splice(0))e(t)}return _e(i,e,t)}(t),vue:function(e,t,i=5e3){ze();let n=We();return void 0===n?null:(!n.committed&&function(e){for(let t=e.querySelector(fr);null!==t;t=t.parentElement)if(void 0!==De(t))return!0;return!1}(e)&&je(n),_e(n,t,i))},sveltekit:function(e,t,i=5e3){let n=e.ownerDocument??e,r=()=>null!==n.querySelector("#svelte-announcer");if(r()||!Object.keys(window).some(e=>e.startsWith("__sveltekit_")))return null;let s={committed:!1,waiters:[]},a=new MutationObserver(()=>{!s.committed&&r()&&je(s)});a.observe(n,{childList:!0,subtree:!0});let l=_e(s,e=>{a.disconnect(),t(e)},i);return()=>{a.disconnect(),l?.()}}},yr={react:"React commit",vue:"Vue mount",sveltekit:"SvelteKit mount"},br=class{constructor(e){oi(this,"timeoutMs");oi(this,"onTimeout");oi(this,"handle",null);oi(this,"lastKick",null);this.timeoutMs=e.timeoutMs??0,this.onTimeout=e.onTimeout}kick(){this.lastKick=Date.now(),!(this.timeoutMs<=0)&&(this.stop(),this.arm(this.timeoutMs))}resume(){if(this.timeoutMs<=0||null!==this.handle||null===this.lastKick)return!1;let e=Math.max(0,Date.now()-this.lastKick),t=this.timeoutMs-e;return t<=0?(this.lastKick=null,this.onTimeout(),!0):(this.arm(Math.min(t,this.timeoutMs)),!1)}arm(e){let t=setTimeout(()=>{this.handle===t&&(this.handle=null,this.lastKick=null,this.onTimeout())},e);this.handle=t}stop(){null!==this.handle&&(clearTimeout(this.handle),this.handle=null)}get lastKickAt(){return this.lastKick??0}get pending(){return null!==this.handle}},wr=class{constructor(){oi(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)}},Sr=class{constructor(e,t,i){oi(this,"deps",e);oi(this,"state",t);oi(this,"host",i);oi(this,"awaitingHydration",new WeakSet);oi(this,"delivered",new WeakMap);oi(this,"confirmations",new WeakMap)}reapplyBindings(e){let t=this.currentTransaction();void 0!==t?.renderData&&this.host.schedule(t,t.renderData,e)}reapplyIslands(e,t=!1){let i=t?e.filter(e=>this.awaitingHydration.delete(e)):e,n=this.state.activeUpdate,r=t&&null!==n&&this.state.isCurrent(n)?n:this.currentTransaction();void 0!==r?.renderData&&this.dispatchIslands(r,r.renderData,i)}dispatchIslands(e,t,i){let n=Je(this.deps,this.state,e,t.fields),r=()=>!e.cancelled&&this.state.isCurrent(e);if(!r())return;let s=this.delivered.get(t);void 0===s&&(s=new WeakSet,this.delivered.set(t,s));for(let a of i){let i=fe(a);if(!r())return;if(!1!==n&&!j(i,n)){this.awaitingHydration.delete(a);continue}let l=this.confirmation(a,e);if(he(a))this.awaitingHydration.add(a);else{if(this.awaitingHydration.delete(a),s.has(a))continue;s.add(a),Ke(e,t,[a],r,l)}}}hasLateRouteBinding(e,t,i,n){for(let n of e){if((n.getAttribute(gn)??"").length>0||"route"!==n.getAttribute(Mn)||!1!==t&&!j(fe(n),t))continue;let e=le(n.getAttribute(On));if(0===e.length||e.some(e=>i.touched.has(e)))return!0}for(let[r,s]of this.deps.cache.entries())for(let a of s){if(!e.has(a.element)||!1!==t&&!j(a.owner,t)||"route"!==(a.strategyKind??E(a.element)??"unknown"))continue;let s=M(n.fields,a,r,i.locale);if(!this.state.isCurrent(i))return!1;if(void 0!==s)return!0}return!1}fieldsForElements(e,t){let i=new Set(t);for(let[t,n]of this.deps.cache.entries())n.some(t=>e.has(t.element))&&i.add(t);return i}unrunFragmentPlan(e,t,i){if(null===t)return null;let n=t.boundaries.filter(t=>!e.fragmentBoundariesRun.has(t)&&(void 0===i||[...i].some(e=>e===t||t.contains(e))));return function(e,t,i){let n=new Set(t);return{boundaries:t,strategy:e,ownerKeys:i,covers:e=>void 0!==e.fragmentBoundary&&n.has(e.fragmentBoundary)}}(t.strategy,n,t.ownerKeys)}confirmation(e,t){let i=this.confirmations.get(e);if(i?.transaction===t)return i.displayed;let n=this.state.display.handIsland(t);return this.confirmations.set(e,{transaction:t,displayed:n}),n}currentTransaction(){let e=this.state.activeUpdate;return this.state.navigationBindingReplay&&null!==e&&this.state.isCurrent(e)?e:null}},kr="payload-live-preview",Ar=Symbol.for("payload-live-preview.trusted-types"),Tr="__payloadLivePreviewDeprecationsWarned",Rr=new Set,Cr="data-payload-",$r=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"]),Fr=new Set(["input","button","textarea","select","option","label"]),Nr=new Set(["script","style","iframe","object","embed","link","meta","base","form","input","button","select","textarea","svg","math","template","frame","frameset","noframes","noscript"]),Or=new Set(["id","class","lang","dir","title","role","tabindex"]),Mr="aria-",Lr="data-",Ur="data-payload-",Er={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"])},xr=new Set(["href","src","cite","poster"]),Pr=6,Ir=1,jr=8,Br=(Error,new Set(["id","name","data-payload-key","data-payload-morph","data-payload-nested-key","data-payload-nested-template"])),_r="strict",Wr=(Object.freeze({allowedTags:$r,removeCompletely:Nr,globalAttributes:Or,attributesByTag:Er,urlAttributes:xr}),Object.freeze({"&":"&","<":"<",">":">",\'"\':""","\'":"'","/":"/","`":"`","=":"="})),Dr=/[&<>"\'/`=]/g,zr=Object.freeze({"&":"&","<":"<",">":">",\'"\':""","\'":"'"}),qr=/[&<>"\']/g,Vr=new Set,Hr={kind:"merge"},Gr=class{constructor(e,t,i){oi(this,"deps",e);oi(this,"state",t);oi(this,"strategies");oi(this,"navigationReplay");t.changes.keepValues="declared"===e.subfieldCoverage,t.display.host=function(e,t){return{outstanding:i=>!i.completed||i.pendingFragments>0||null!==t.routeController||null!==t.routeRetry||e.scheduler.pendingCount>0,report:t=>{"partial"===t.state&&e.a11y?.announcePartial(),e.emitter.emit("revisionDisplay",t)},failed:t=>{e.log("revision display failed:",t)}}}(e,t),this.strategies=function(e,t){return{planFragments:()=>null,escalateUnfaithful:(e,i,n)=>{for(let{fieldName:i}of n)t.display.shortfall(e,{kind:"unfaithful",field:i})},hasUnboundChange:(i,n)=>{if(i.baseline)return!1;let r=function(e,t,i,n,r){let s=G(e,n,void 0),a=K(e,i,n,s),l=[];for(let e of t){if(Xi.has(e))continue;let t=a(e);if("none"===t&&l.push(e),"below"!==t||void 0===r)continue;let n=J(e,i),{previous:o,next:d}=r;for(let{path:t}of H(n,o[e],d[e],s))l.push(t)}return l}(e.cache,i.touched,i.locale,n,function(e,t,i){return"declared"===e&&void 0!==t&&void 0!==i?{previous:t,next:i}:void 0}(e.subfieldCoverage,t.changes.previousFields,i.renderData?.fields));for(let e of r)a(t,e),t.display.shortfall(i,{kind:"unbound",field:e});return!1},plansRoute:()=>!1,runFragments:()=>Promise.resolve(),refreshRoute:()=>(w("route refreshes"),Promise.resolve()),refreshAfterSave:()=>{},warnFragmentFallback:i=>{w("server-rendered fragments"),function(e,t,i){t.warnedFragmentFallback||(t.warnedFragmentFallback=!0,e.warn(`[live-preview] LP0806: "${i.fieldName}" asks for the fragment strategy but no handler is configured; patching instead`))}(e,t,i)},warnUnsupportedStrategy:i=>{!function(e,t,i){t.warnedStrategy.has(i.element)||(t.warnedStrategy.add(i.element),e.warn(`[live-preview] LP0407: "${i.fieldName}" asks for strategy "${String(i.strategy)}"; only patch, fragment and route exist`))}(e,t,i)}}}(e,t),this.navigationReplay=new Sr(e,t,{schedule:(e,t,i)=>{this.scheduleAllFields(e,t,i)}})}handleUpdate(e,t,i){let{deps:n,state:r}=this;n.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),n.log);let s=e.data;void 0!==s?void 0!==i&&this.acceptDataUpdate(e,s,t,i,!0):void 0!==e.protocolVersion&&r.protocol.applyVersion(e.protocolVersion,n.log)}handleReplay(e,t,i){let n=e.data;void 0!==n&&this.acceptDataUpdate(e,n,t,i,!1)}reapplyNavigationBindings(e){this.navigationReplay.reapplyBindings(e)}reapplyNavigationIslands(e,t=!1){this.navigationReplay.reapplyIslands(e,t)}acceptDataUpdate(e,t,i,n,r){let{deps:s,state:a}=this,l=r?a.relationships.inspect(e):null,o="string"==typeof e.locale?e.locale:a.locale,d=a.schema,u=a.schemaIndex;Array.isArray(e.fieldSchemaJSON)&&(d=e.fieldSchemaJSON,u=function(e,t=""){let i=new Map;return A(e,t,i,!1),A(e,t,i,!0),i}(e.fieldSchemaJSON));let c=a.activeUpdate;if(!a.isRunning()||null!==c&&c.revision.revision>n.revision)return;let h=null===l?null:a.relationships.commit(l),f=c,p={revision:n,message:e,rawData:t,locale:o,schema:d,schemaIndex:u,receivedAt:Date.now(),forceRender:null!==h||ie(f),countsAsUpdate:r,renderData:void 0,fragmentBoundariesRun:new WeakSet,touched:new Set,baseline:!1,navigated:!1,invalidated:new Set,revealTarget:void 0,revealIdentities:[],pendingFragments:0,routeRefreshed:!1,cancelled:!1,completed:!1};a.locale=o,a.schema=d,a.schemaIndex=u,null!==f&&!f.completed&&f.countsAsUpdate&&(a.supersededCount+=1),a.activeUpdate=p,r&&(a.updateCount+=1),a.display.begin(p,n.revision),a.isCurrent(p)&&(s.scheduler.acceptRevision(n),a.isCurrent(p)&&(a.supersedeStrategies(),a.isCurrent(p)&&(null!==h&&(s.emitter.emitWhile("relationshipUpdate",{detail:h,timestamp:Date.now()},()=>a.isCurrent(p)),!a.isCurrent(p))||r&&void 0!==e.protocolVersion&&(a.protocol.applyVersion(e.protocolVersion,s.log),!a.isCurrent(p))||r&&s.connection.markConnected()&&(s.a11y?.announceConnected(),s.emitter.emit("connect",{origin:i,timestamp:Date.now()}),!a.isCurrent(p)||(s.log("connection","disconnected","\\u2192","connected"),!a.isCurrent(p)))||this.processUpdate(p).catch(e=>{s.log("update failed:",e)}))))}async processUpdate(e){let{deps:t,state:i}=this,n=await this.resolveIncomingFields(e);if(null===n||!i.isCurrent(e))return;let r=this.dataFor(e,n);t.emitter.listenerCount("beforeUpdate")>0&&(!await t.emitter.emitWhile("beforeUpdate",{data:r,revision:e.revision.revision,receivedAt:e.receivedAt,source:"patch",cancel:()=>{e.cancelled=!0,t.scheduler.cancelRevision(e.revision)}},()=>!e.cancelled&&i.isCurrent(e))||e.cancelled||!i.isCurrent(e))||this.applyFields(e,r,!1)}dataFor(e,t){let{message:i}=e;return{fields:t,...void 0!==e.schema?{schema:e.schema}:{},..."string"==typeof i.globalSlug?{globalSlug:i.globalSlug}:{},..."string"==typeof i.collectionSlug?{collectionSlug:i.collectionSlug}:{},...void 0!==e.locale?{locale:e.locale}:{}}}applyFields(e,t,i){let{deps:n,state:r}=this;if(!r.isCurrent(e)||r.changes.isBaseline&&!i&&"off"!==n.autoBind&&(w("auto-binding"),!r.isCurrent(e)))return;let s=oe(n.dependencies,n.cache.dependencyMap());if(!r.isCurrent(e))return;let a=r.changes.diff(t.fields,s,()=>r.isCurrent(e));if(null===a)return;let l=!i&&r.navigationReplayPending;l&&(r.navigationReplayPending=!1,r.navigationBindingReplay=!0),e.baseline=a.baseline&&!l,e.navigated=l,e.invalidated=i?Vr:a.invalidated,e.touched=i?Vr:new Set([...a.changed,...a.invalidated]),e.renderData=t,this.scheduleAllFields(e,t)}async resolveIncomingFields(e){let{deps:t,state:i}=this,n=e.rawData;if(null===t.merger)return n;let r=i.merges.decide(t,e);if(!r.merge)return r.fields;let{message:s}=e,a=i.merges.request(t.merger,t.mergeWindowMs,{collectionSlug:s.collectionSlug,globalSlug:s.globalSlug,data:n,...void 0===e.schema?{}:{schema:e.schema},locale:e.locale});if(!a.leading)return this.applyMerged(e,a.result).catch(e=>{t.log("update failed:",e)}),r.fields;let l=await a.result;return i.isCurrent(e)?"merged"===l.status?(i.merges.recordMerged(l.doc,e.locale),l.doc):"superseded"===l.status?null:(i.display.shortfall(e,Hr),r.fields):null}async applyMerged(e,t){let{state:i}=this,n=await t;"unavailable"===n.status&&i.display.shortfall(e,Hr),"merged"===n.status&&i.isCurrent(e)&&(i.merges.recordMerged(n.doc,e.locale),this.applyFields(e,this.dataFor(e,n.doc),!0))}scheduleAllFields(e,t,i){let{deps:n,state:r}=this;if(!r.isCurrent(e))return;let s=void 0!==i,a=()=>r.isCurrent(e),l=Je(n,r,e,t.fields);if(!a())return;let{touched:o}=e,d=n.strategies.route;if(s&&void 0!==d&&!e.routeRefreshed&&this.navigationReplay.hasLateRouteBinding(i,l,e,t)){a()&&this.strategies.refreshRoute(e,t,d);return}let u=!s&&this.strategies.hasUnboundChange(e,l),c=r.routeRefreshOwed;if(!s&&void 0!==d&&!e.routeRefreshed&&(u||c||this.strategies.plansRoute(d,e,l))&&a()){r.routeRefreshOwed=!1,this.strategies.refreshRoute(e,t,d);return}let h=s?this.navigationReplay.fieldsForElements(i,o):o,f=this.navigationReplay.unrunFragmentPlan(e,this.strategies.planFragments(h,l),i);if(!a())return;let p=n.skipUnchanged,g=0;for(let[o,d]of n.cache.entries()){if(!a())return;for(let u of d){if(void 0!==i&&!i.has(u.element)||!1!==l&&!j(u.owner,l))continue;if(!0===f?.covers(u)){if(n.revealEditedField){let i=M(t.fields,u,o,e.locale);r.revealLedger.note(e,u,i)}continue}let d=u.strategyKind??E(u.element)??"unknown";if("unknown"===d){this.strategies.warnUnsupportedStrategy(u);continue}"fragment"===d&&null===f&&this.strategies.warnFragmentFallback(u);let c=M(t.fields,u,o,e.locale);if(void 0===c){r.absentFields.add(o);continue}if(!s&&n.revealEditedField&&r.revealLedger.note(e,u,c),!a())return;let h=mt(n,u,c,t.fields,a);if(!a())return;let m=p?L(u,h,t.fields,e.locale):void 0,v=r.lastAppliedIdentity.get(u.element);if(!e.forceRender&&n.skipUnchanged&&void 0!==m&&v===m&&!e.invalidated.has(o)){r.skippedUnchangedCount+=1;continue}let y={target:u,value:h,allFields:t.fields,revision:e.revision,...s?{}:{data:t},valueIdentity:m};n.scheduler.schedule(y),g+=1}}if(s||function(e,t,i,n,r){let{cache:s,strategies:a}=e,l={cache:s,warned:t,warn:e.warn};if(0===s.fieldCount||!1!==r&&!function(e,t){for(let i of e.values())if(j(i.owner,t))return!0;return!1}(s,r))return;let o=function(e,t,i,n){let r=K(e,t,i,G(e,i,n));return e=>"none"!==r(e)}(s,n,r,a);for(let[e,t]of Object.entries(i)){if(Xi.has(e))continue;if(Xe(t)){Qe(l,o,e,n,t);continue}if(!Ye(t)||o(e)||Ze(t))continue;let i=J(e,n);for(let[e,r]of Object.entries(t))!Xe(r)||Xi.has(e)||Qe(l,o,`${i}.${e}`,n,r)}if("declared"!==e.subfieldCoverage)return;let d=function(e,t,i,n,r){let s=G(e,n,r),a=K(e,i,n,s),l=[];for(let[e,n]of Object.entries(t)){if(Xi.has(e)||"below"!==a(e))continue;let t=J(e,i);l.push(...H(t,void 0,n,s))}return l}(s,i,n,r,a);for(let{path:e,value:t}of d)if(Xe(t)&&Qe(l,o,e,n,t),Ye(t)&&!Ze(t))for(let[i,r]of Object.entries(t))Xe(r)&&Qe(l,o,`${e}.${i}`,n,r)}(n,r.warnedOrphanFields,e.rawData,e.locale,l),a()){if(null!==f&&f.boundaries.length>0){for(let t of f.boundaries)e.fragmentBoundariesRun.add(t);e.pendingFragments+=f.boundaries.length,this.strategies.runFragments(e,t,f)}s||!a()||0===g&&(0===e.pendingFragments&&0===n.scheduler.pendingCount&&(r.complete(e),this.revealPending(e)),this.notifyIslands(e,t))}}notifyIslands(e,t){0!==e.touched.size&&this.navigationReplay.dispatchIslands(e,t,this.deps.cache.islands)}restoreGuesses(e,t){let{deps:i,state:n}=this;"off"===i.autoBind||n.autoBindGuesses}onFlush(e){let{deps:t,state:i}=this;i.lastFlush=e,e.deferred>0&&!i.warnedVisibilityGate&&(i.warnedVisibilityGate=!0,t.warn(`[live-preview] LP0301: visibility gate held ${String(e.deferred)} off-screen update(s) until scrolled into view; see visibilityGateThreshold`));let{revision:n,data:r}=e;if(void 0===n)return;let s=i.activeUpdate;if(null===s||!i.isCurrent(s)||!b(s.revision,n))return;i.display.deferred(s,e.deferred),0===s.pendingFragments&&i.complete(s);let a=()=>i.isCurrent(s)&&b(s.revision,n),l=r??s.renderData;if(this.revealPending(s),!a())return;let o=i.unfaithfulPatches;if(o.length>0){if(i.unfaithfulPatches=[],void 0!==l){let e=Je(t,i,s,l.fields);this.strategies.escalateUnfaithful(s,l,o,e)}if(!a())return}void 0!==r&&(e.applied>0&&t.a11y?.announceUpdate(e.applied),a()&&(this.notifyIslands(s,r),a()&&0!==e.applied&&0!==t.emitter.listenerCount("afterUpdate")&&t.emitter.emitWhile("afterUpdate",{data:r,updatedCount:e.applied,durationMs:e.durationMs,revision:n.revision,receivedAt:s.receivedAt,source:"patch"},a)))}revealPending(e){let t=this.state.revealLedger.commit(e);if(void 0!==t)try{re(this.state.revealer,t)}catch(e){this.deps.log("reveal",e)}}revealField(e){let t=this.deps.cache.get(e)?.[0];return void 0===t?"no-element":re(this.state.revealer,t)}documentSaved(){this.strategies.refreshAfterSave()}},Jr=class{constructor(e,t){oi(this,"apply");oi(this,"debounceMs");oi(this,"maxWaitMs");oi(this,"isVisible");oi(this,"gateThresholdValue");oi(this,"gateDisabled");oi(this,"getCacheSize");oi(this,"onFlush");oi(this,"scheduleFrame");oi(this,"cancelFrame");oi(this,"pending",new Map);oi(this,"replay",new Map);oi(this,"activeFlushes",new Set);oi(this,"debounceTimer",null);oi(this,"debounceToken",0);oi(this,"deadlineTimer",null);oi(this,"frameHandle",null);oi(this,"frameFallback",null);oi(this,"frameToken",0);oi(this,"windowUntil",0);oi(this,"activeRevision",null);oi(this,"activeRevisionCancelled",!1);oi(this,"destroying",!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(this.destroying||void 0!==e.revision&&(this.activeRevisionCancelled||null===this.activeRevision||!b(e.revision,this.activeRevision)))return;let t=this.pending.get(e.target.element);t?(t.value=e.value,t.allFields=e.allFields,t.revision=e.revision,t.data=e.data,t.valueIdentity=e.valueIdentity):this.pending.set(e.target.element,{target:e.target,value:e.value,allFields:e.allFields,revision:e.revision,data:e.data,valueIdentity:e.valueIdentity}),this.armDebounce()}acceptRevision(e){this.destroying||null!==this.activeRevision&&b(e,this.activeRevision)||null!==this.activeRevision&&function(e,t){return e.generation!==t.generation?e.generation-t.generation:e.revision-t.revision}(e,this.activeRevision)<0||(this.clearWork(),this.activeRevision=e,this.activeRevisionCancelled=!1,this.cancelScheduledWork())}cancelRevision(e){null===this.activeRevision||!b(e,this.activeRevision)||(this.clearWork(),this.activeRevisionCancelled=!0,this.cancelScheduledWork())}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 i=performance.now(),n=this.didApply(t)?1:0;this.onFlush?.(this.statsFor(t,n,0,performance.now()-i,1===n?[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(){if(!this.destroying){this.destroying=!0;try{this.clearWork(),this.activeRevision=null,this.activeRevisionCancelled=!1,this.windowUntil=0,this.cancelScheduledWork()}finally{this.destroying=!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=Date.now(),t=e>=this.windowUntil;if(this.windowUntil=e+this.debounceMs,t){this.requestFrame();return}let i=this.debounceToken+=1,n=this.debounceTimer;if(this.debounceTimer=null,null!==n&&clearTimeout(n),this.debounceToken!==i)return;let r=setTimeout(()=>{this.debounceToken===i&&(this.debounceTimer=null,this.pending.size>0&&this.requestFrame())},this.debounceMs);this.debounceToken===i&&(this.debounceTimer=r),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,this.clearFrameFallback(),null!==t&&this.cancelFrame(t),this.frameToken!==e)return;let i=!1,n=()=>{if(this.frameToken!==e||i)return;i=!0;let t=this.frameHandle;this.frameHandle=null,this.clearFrameFallback(),null!==t&&this.cancelFrame(t),this.flush()},r=this.scheduleFrame(n);i||this.frameToken!==e||(this.frameHandle=r,this.frameFallback=setTimeout(n,100))}clearFrameFallback(){clearTimeout(this.frameFallback??void 0),this.frameFallback=null}flush(){let e=performance.now();this.clearDeadline();let t=this.gateActive,i=this.pending;this.pending=new Map;let n,r=0,s=[],a=0;this.activeFlushes.add(i);try{for(let e of i.values()){if(!this.isCurrent(e))continue;let i=!t||this.isVisible(e.target.element)||vt(e.target);if(this.isCurrent(e)){if(n??(n=e),!i){this.replay.set(e.target.element,e),a+=1;continue}this.replay.delete(e.target.element),this.didApply(e)&&(r+=1,s.push(e.target.fieldName))}}}finally{this.activeFlushes.delete(i)}let l=this.statsFor(n,r,a,performance.now()-e,s);return this.onFlush?.(l),l}isCurrent(e){return void 0===e.revision||!this.activeRevisionCancelled&&null!==this.activeRevision&&b(e.revision,this.activeRevision)}didApply(e){return!1!==this.apply(e)||!function(e){return qi.has(e)}(this.apply)}retargetBuffer(e,t){let i=e.get(t.element);if(void 0!==i){if(!ge(i.target,t)){e.delete(t.element);return}i.target=t}}clearWork(){this.pending.clear(),this.replay.clear();for(let e of this.activeFlushes)e.clear()}statsFor(e,t,i,n,r){return{applied:t,appliedFields:r,deferred:i,durationMs:n,...void 0!==e?.revision?{revision:e.revision}:{},...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(),this.clearFrameFallback(),null!==e&&clearTimeout(e),null!==t&&this.cancelFrame(t)}},Kr=[0,500,1e3,2e3],Qr=class{constructor(e){oi(this,"deps");oi(this,"state",new un);oi(this,"pipeline");oi(this,"writer");oi(this,"rootSentinel",null);oi(this,"scope",null);oi(this,"closingSession",!1);oi(this,"observedRoot",null);oi(this,"replayRetainedOnStart",!1);let{emitter:n,renderers:s}=e,a=void 0===e.log?i:t(e.log),l=void 0===e.warn?gi:t(e.warn),o=e.root??(typ','eof document<"u"?document:void 0);if(void 0===o)throw new Error("LivePreviewRuntime: no document; pass options.root");let d=new _n({filter:e=>!function(e){let t=e;for(;null!==t;){if(ce(t))return!0;t=t.parentElement}return!1}(e)}),u=new sr({onStructuralChange:()=>{this.rebuildCache()},onIslandHydrated:e=>{this.pipeline.reapplyNavigationIslands([e],!0)},onVisibilityChange:(e,t)=>{t&&c.notifyVisible(e)}},void 0!==e.intersectionRootMargin?{intersectionRootMargin:e.intersectionRootMargin}:{}),c=new Jr($(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:()=>d.elementCount,onFlush:e=>{this.pipeline.onFlush(e)}}),h=new Mi(e.originMatcher,{onUpdate:(e,t,i)=>{this.pipeline.handleUpdate(e,t,i)},onReplay:(e,t,i)=>{this.pipeline.handleReplay(e,t,i)},onDocumentEvent:()=>{this.state.protocol.observe(["document-events"],a),n.emit("documentSave",{timestamp:Date.now()}),this.pipeline.documentSaved()},onFocusField:e=>{this.deps.revealEditedField&&this.pipeline.revealField(e)},onInvalid:(e,t)=>{if("token"===e){let e=new Error(`Preview token rejected (origin: ${t})`);n.emit("error",{error:e,context:"token",code:"LP0502"})}("shape"===e||"type"===e)&&!this.state.warnedProtocolShape&&(this.state.warnedProtocolShape=!0,l(`[live-preview] LP0503: ${t} posted a message this runtime does not recognise (${"type"===e?"unknown message type":"unexpected shape"}); it was ignored. A newer Payload or a custom sender: check that the versions match.`)),"source"===e&&!this.state.warnedForeignSource&&(this.state.warnedForeignSource=!0,l(`[live-preview] LP0501: a message from ${t} was ignored because it did not come from the window that framed or opened this page. \\`eventSourcePolicy\\` is \'parent-or-opener\' by default since 2.0, where 1.x accepted any window on a trusted origin. Set \\`eventSourcePolicy: \'any\'\\` if the admin posts from elsewhere.`)),a("LP0501 message rejected:",e,t)},...void 0!==e.validateToken?{validateToken:e.validateToken}:{},...void 0!==e.eventSourcePolicy?{sourcePolicy:e.eventSourcePolicy}:{}}),f=e.dataMerge;this.deps={emitter:n,cache:d,observers:u,scheduler:c,bus:h,connection:new wr,heartbeat:new br({...void 0!==e.heartbeatMs?{timeoutMs:e.heartbeatMs}:{},onTimeout:()=>{this.onHeartbeatTimeout()}}),renderers:s,resolveRenderer:e.resolveRenderer??(e=>s[e]),transformValue:e.transformValue,renderRichText:e.renderRichText,sanitizerPolicy:e.sanitizerPolicy,root:o,readyTargets:"function"==typeof e.readyTargets?e.readyTargets:(e=>()=>e)(e.readyTargets),sendReady:e.sendReady??k,onHeartbeatTimeout:e.onHeartbeatTimeout,log:a,warn:l,a11y:S(e),serverURL:f?.serverURL,merger:void 0===f?null:new Qn({serverURL:f.serverURL,...void 0!==f.apiRoute?{apiRoute:f.apiRoute}:{},...void 0!==f.depth?{depth:f.depth}:{},...void 0!==f.fetchFn?{fetchFn:f.fetchFn}:{},log:a}),mergeWindowMs:e.debounceMs??50,scopeBindingsByOwner:!0===e.scopeBindingsByOwner,subfieldCoverage:e.subfieldCoverage??"descendant",lockedOrigin:e.lockedOrigin??(()=>{}),skipUnchanged:!0===e.skipUnchanged,dependencies:e.dependencies??{},strategies:e.strategies??{},revealEditedField:!0===e.revealEditedField,onUnfaithfulPatch:r(e),autoBind:e.autoBind??"off",hydration:e.hydration},this.writer=new cn(this.deps,this.state),this.pipeline=new Gr(this.deps,this.state,()=>{this.rebuildCache()})}start(){let{state:e}=this;if(e.isRunning()||this.closingSession)return!1;e.suspended&&(this.replayRetainedOnStart=!0),e.started=!0,e.suspended=!1,this.openScope();try{return function(e){"react"===e.hydration?Ie():"vue"===e.hydration&&ze();let{root:t}=e;if(!He(t)||"loading"!==t.readyState){qe(e);return}let i=()=>{e.isRunning()&&e.later(()=>{qe(e)})};t.addEventListener("DOMContentLoaded",i,{once:!0}),e.defer(()=>{t.removeEventListener("DOMContentLoaded",i)})}(this.startupHost()),!0}catch(e){throw this.rollbackFailedStart(),e}}startupHost(){let{state:e,deps:t}=this;return{root:t.root,hydration:t.hydration,isRunning:()=>e.isRunning(),defer:t=>{e.deferredStart=t,this.scope?.own(()=>{e.deferredStart===t&&(e.deferredStart=null,t())})},later:t=>{e.deferredStart=null;try{t()}catch(e){this.rollbackFailedStart(),this.reportError(e,"startup","LP0605")}},hydrated:t=>{e.hydration=t},warn:t.warn,startNow:()=>{this.startNow()}}}startNow(){let{state:e,deps:t}=this;if(!e.isRunning())return;let i=He(t.root)?Ge(t.root):t.root;if(null===i)throw new Error("LivePreviewRuntime: document.body unavailable");if(t.observers.start(i),this.observedRoot=i,this.watchRootReplacement(),this.buildCacheAndObserve(),!e.isRunning()||(t.bus.attach(),t.emitter.emitWhile("init",{timestamp:Date.now()},()=>e.isRunning()),!e.isRunning()))return;let n=this.replayRetainedOnStart;this.replayRetainedOnStart=!1;let r=n&&t.heartbeat.resume();if(e.isRunning()&&(!n||r||(e.forgetOwedWork(),e.merges.resetRawChanges(),e.unfaithfulPatches=[],e.revealer.reset(),e.lastAppliedIdentity=new WeakMap,e.changes.reset(),e.navigationReplayPending=!0,t.bus.replayLastAccepted()||(e.navigationReplayPending=!1),e.isRunning())))for(let i of Kr){if(!e.isRunning())return;0===i?t.sendReady(t.readyTargets()):e.readyTimers.push(setTimeout(()=>{e.isRunning()&&this.sendReadyAfterStart()},i))}}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 i=!!e.isRunning()&&this.release();e.suspended=!1,this.replayRetainedOnStart=!1,t.bus.forgetLastAccepted(),i&&t.emitter.emit("disconnect",{reason:"destroy",timestamp:Date.now()}),t.a11y?.detach(),t.emitter.emit("destroy",{timestamp:Date.now()})}openScope(){let{state:e,deps:t}=this,i=new ar(t.log);i.own(()=>{t.merger?.destroy(),e.merges.destroy()}),i.own(()=>{t.scheduler.destroy()}),i.own(()=>{t.observers.stop()}),i.own(()=>{this.rootSentinel?.disconnect(),this.rootSentinel=null,this.observedRoot=null}),i.own(()=>{e.abortStrategies()}),i.own(()=>{t.bus.detach()}),i.own(()=>{t.heartbeat.stop()}),i.own(()=>{for(let t of e.readyTimers)clearTimeout(t);e.readyTimers.length=0}),this.scope=i}release(){let{state:e,deps:t}=this;e.display.end(),e.activeUpdate=null,e.navigationBindingReplay=!1,e.started=!1;let i=this.scope;this.scope=null,this.closingSession=!0;try{i?.close()}finally{this.closingSession=!1}return t.cache.clear(),t.connection.markDisconnected()}rollbackFailedStart(){this.release();try{this.deps.a11y?.detach()}catch(e){this.deps.log("runtime cleanup failed:",e)}}refreshCache(){this.state.isRunning()&&(this.state.revealer.reset(),this.followReplacedRoot()||this.rebuildCache())}navigationCommit(){let{state:e,deps:t}=this;!e.isRunning()||null!==e.deferredStart||(this.cancelActiveUpdate(!0),t.merger?.destroy(),e.merges.destroy(),e.abortStrategies(),this.cancelActiveUpdate(!0),e.forgetOwedWork(),e.merges.resetRawChanges(),e.unfaithfulPatches=[],e.revealer.reset(),e.lastAppliedIdentity=new WeakMap,e.changes.reset(),e.isRunning()&&(t.bus.advanceGeneration(),e.navigationReplayPending=!0,this.followReplacedRoot()||this.rebuildCache(),e.isRunning()&&(t.bus.replayLastAccepted(),e.isRunning()&&this.sendReadyAfterStart())))}watchRootReplacement(){let{root:e}=this.deps;!He(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()||!He(e))return!1;let t=Ge(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:i,scheduler:n}=e,r=t.protocol.negotiation,s=t.activeUpdate,a=t.lastFlush,l=[],o=new Set,d=[];for(let[e,t]of i.entries()){l.push(e);for(let i of t)void 0!==i.owner&&o.add(i.owner),void 0!==i.guessed&&d.push({field:e,matched:i.guessed,attribute:i.targetAttribute??("IMG"===i.element.tagName?"src":void 0)})}return{version:Xn,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:Ue(r.observed).name},revisions:{accepted:t.updateCount,superseded:t.supersededCount,completed:t.completedCount,skippedUnchanged:t.skippedUnchangedCount,active:null===s?void 0:s.revision.revision,display:t.display.snapshot()},bindings:{elements:i.elementCount,fields:i.fieldCount,fieldNames:l.sort(),absentFields:[...t.absentFields].sort(),orphanFields:[...t.warnedOrphanFields].sort(),ownerScoped:e.scopeBindingsByOwner,owners:[...o].sort(),guessed:d.sort((e,t)=>e.field.localeCompare(t.field)),autoBind:{mode:e.autoBind,searchMs:t.autoBindSearchMs}},route:{handler:void 0!==e.strategies.route,...t.routeStats},fidelity:{mode:e.onUnfaithfulPatch,canEscalate:void 0!==e.strategies.fragment||void 0!==e.strategies.route,unfaithful:t.unfaithfulCount,escalated:t.escalatedCount,fields:[...t.unfaithfulFields].sort()},hydration:{mode:e.hydration??"off",state:t.hydration},fragments:{handler:void 0!==e.strategies.fragment,inFlight:s?.pendingFragments??0,...t.fragmentStats},scheduler:{pending:n.pendingCount,deferred:n.replayCount,visibilityGateThreshold:n.gateThreshold,visibilityGateActive:n.gateActive,lastFlush:null===a?void 0:{applied:a.applied,appliedFields:a.appliedFields,deferred:a.deferred,durationMs:a.durationMs}},plugins:[],renderers:Object.keys(e.renderers).sort()}}(this.deps,this.state)}buildCacheAndObserve(){let{state:e,deps:t}=this;if(!e.isRunning())return;let i=t.cache.buildFromRoot(t.root);if(t.log("cache",i),e.isRunning()&&(t.emitter.emitWhile("cacheRefresh",i,()=>e.isRunning()),e.isRunning()))for(let i of t.cache.values()){if(!e.isRunning())return;t.observers.observeElement(i.element)}}rebuildCache(){let{state:e,deps:t}=this;if(!e.isRunning())return;let i=new Map,n=t.cache.islandOwners,r=new Set(t.cache.navigationReplayRoots);for(let e of t.cache.values())i.set(e.element,e),t.observers.unobserveElement(e.element);if(this.buildCacheAndObserve(),!e.isRunning())return;let s=new Set(t.cache.navigationReplayRoots.filter(e=>!r.has(e)));for(let e of t.cache.values()){let n=i.get(e.element);void 0!==n&&ge(n,e)?t.scheduler.retarget(e):(t.scheduler.forget(e.element),s.add(e.element)),i.delete(e.element)}for(let e of i.values())t.scheduler.forget(e.element);s.size>0&&this.pipeline.reapplyNavigationBindings(s);let a=t.cache.islands.filter(e=>!n.has(e)||t.scopeBindingsByOwner&&n.get(e)!==t.cache.islandOwners.get(e));a.length>0&&this.pipeline.reapplyNavigationIslands(a)}onHeartbeatTimeout(){let{state:e,deps:t}=this;if(!e.isRunning()||(this.cancelActiveUpdate(!1),t.merger?.destroy(),e.merges.destroy(),e.abortStrategies(),this.cancelActiveUpdate(!1),!e.isRunning()))return;t.bus.advanceGeneration(),t.bus.forgetLastAccepted(),e.navigationBindingReplay=!1;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())}cancelActiveUpdate(e){let{state:t,deps:i}=this,n=t.activeUpdate;t.display.end(),t.activeUpdate=null,null!==n&&(n.cancelled=!0,i.scheduler.cancelRevision(n.revision),e&&!n.completed&&n.countsAsUpdate&&(t.supersededCount+=1))}sendReadyAfterStart(){try{this.deps.sendReady(this.deps.readyTargets())}catch(e){this.reportError(e,"ready","LP0606")}}reportError(e,t,i){let n=e instanceof Error?e:new Error(String(e));this.deps.emitter.emit("error",{error:n,context:t,code:i})}isIdleDisconnected(){return this.state.isRunning()&&"disconnected"===this.deps.connection.status&&null===this.state.activeUpdate}},Xr=/^https?:\\/\\/(localhost|127\\.0\\.0\\.1)(?::\\d+)?$/i,Zr=/^https?:\\/\\/[^/?#\\s]+$/i,Yr=[3e3,3001,3333,4e3,4321,5e3,5173,5174,8e3,8080,8888,9e3],es=class{constructor(e={}){ci(this,ts);let t=new Set;for(let i of e.additionalOrigins??[]){let e=bt(i);void 0!==e&&t.add(e)}let i;if(e.enableReferrerDetection??1){let t=e.referrer??(typ','eof document<"u"?document.referrer:"");if(t.length>0)try{let e=new URL(t).origin;e&&"null"!==e&&(i=e)}catch{}}let n=(e.enableLocalhostMatching??!0)&&(e.forceDevMode??function(){let e=function(){if(!(typ','eof process>"u"))return"production"}();if(void 0!==e)return"production"!==e;if(typ','eof window<"u"){let e=window.location.hostname;return"localhost"===e||"127.0.0.1"===e}return!1}());hi(this,ts,[t,i,n,void 0!==i,void 0,typeof location>"u"?void 0:location.ancestorOrigins?.[0]])}matches(e){return 0!==e.length&&"null"!==e&&(void 0!==ui(this,ts)[4]?e===ui(this,ts)[4]:!!(ui(this,ts)[0].has(e)||0===ui(this,ts)[0].size&&void 0!==ui(this,ts)[1]&&e===ui(this,ts)[1]||ui(this,ts)[2]&&Xr.test(e)))}lockOrigin(e){return!!this.matches(e)&&(ui(this,ts)[4]=e,!0)}unlockOrigin(){let e=ui(this,ts)[4];return ui(this,ts)[4]=void 0,e}get lockedOrigin(){return ui(this,ts)[4]}enumerate(){if(void 0!==ui(this,ts)[4])return[ui(this,ts)[4]];let e=new Set(ui(this,ts)[0]);0===ui(this,ts)[0].size&&void 0!==ui(this,ts)[1]&&e.add(ui(this,ts)[1]);let t=ui(this,ts)[5];if(ui(this,ts)[2]&&void 0!==t)Xr.test(t)&&e.add(t);else if(ui(this,ts)[2])for(let t of Yr)e.add(`http://localhost:${String(t)}`),e.add(`http://127.0.0.1:${String(t)}`);return[...e]}get referrerWasAvailable(){return ui(this,ts)[3]}get isProductionUnconfigured(){return!(!yt()||ui(this,ts)[0].size>0||ui(this,ts)[2]||void 0!==ui(this,ts)[1])}get isReferrerOnlyTrust(){return!(ui(this,ts)[0].size>0||ui(this,ts)[2])&&void 0!==ui(this,ts)[1]}},ts=new WeakMap,is="astro:page-load",ns="astro:after-swap",rs={1:"left",2:"center",3:"right",4:"justify"},ss=new Set(["left","center","right","justify","start","end"]),as=new Set(["h1","h2","h3","h4","h5","h6"]),ls=\' target="_blank" rel="noopener noreferrer"\',os=(e,t)=>{let i=t.renderChildren(e.children??[]),n=Tt(e.fields),r=function(e,t){if("internal"===t?.linkType)return function(e){let t=Tt(Tt(e)?.value),i=t?.url;if("string"==typeof i&&i.length>0)return i;let n=t?.slug;return"string"==typeof n&&n.length>0?`/${n}`:void 0}(t.doc);let i=t?.url??e.url;return"string"==typeof i&&i.length>0?i:void 0}(e,n);if(void 0===r||!R(r))return i;let s="string"==typeof e.title?` title="${ut(e.title)}"`:"";return`<a href="${ct(r)}"${function(e,t,i){if(!0===t?.newTab||C(i))return ls;let n="string"==typeof e.target?e.target:"";return""===n?"":"_blank"===n?ls:` target="${ut(n)}"`}(e,n,r)}${s}>${i}</a>`},ds=new Map,us=".lp-block:empty,.lp-inline-block:empty",cs={text:e=>{let t=ut("string"==typeof e.text?e.text:""),i="number"==typeof e.format?e.format:0;return!!(16&i)&&(t=`<code>${t}</code>`),!!(1&i)&&(t=`<strong>${t}</strong>`),!!(2&i)&&(t=`<em>${t}</em>`),!!(8&i)&&(t=`<u>${t}</u>`),!!(4&i)&&(t=`<s>${t}</s>`),!!(32&i)&&(t=`<sub>${t}</sub>`),!!(64&i)&&(t=`<sup>${t}</sup>`),!!(128&i)&&(t=`<mark>${t}</mark>`),t},paragraph:(e,t)=>{let i=t.renderChildren(e.children??[]);return`<p${kt(e)}${At(e)}>${i}</p>`},heading:(e,t)=>{let i="string"==typeof e.tag?e.tag.toLowerCase():"h2",n=as.has(i)?i:"h2",r=t.renderChildren(e.children??[]);return`<${n}${kt(e)}${At(e)}>${r}</${n}>`},list:(e,t)=>{let i="string"==typeof e.listType?e.listType:"bullet",n="number"===i?"ol":"ul",r="number"===i&&"number"==typeof e.start&&e.start>1?` start="${String(e.start)}"`:"",s="check"===i?\' role="list"\':"",a=t.renderChildren(e.children??[]);return`<${n}${kt(e)}${At(e)}${r}${s}>${a}</${n}>`},listitem:(e,t)=>{let i=t.renderChildren(e.children??[]);if("boolean"==typeof e.checked)return`<li role="checkbox" aria-checked="${e.checked?"true":"false"}"${At(e)}>${i}</li>`;let n="number"==typeof e.value?` value="${ut(String(e.value))}"`:"";return`<li${kt(e)}${At(e)}${n}>${i}</li>`},link:os,autolink:os,quote:(e,t)=>{let i=t.renderChildren(e.children??[]);return`<blockquote${kt(e)}${At(e)}>${i}</blockquote>`},code:e=>{let t=$t("string"==typeof e.language?e.language:"");return`<pre><code${""===t?"":` class="language-${t}"`}>${ut(Ot(e))}</code></pre>`},"code-highlight":e=>{let t="string"==typeof e.text?e.text:"";return`<span${"string"==typeof e.highlightType?` class="token-${$t(e.highlightType)}"`:""}>${ut(t)}</span>`},linebreak:()=>"<br>",horizontalrule:()=>"<hr>",tab:()=>"\\t",upload:e=>{let t=Rt(e.value);if(void 0===t)return"";let i=t.url;if("string"!=typeof i||!R(i))return"";let n="string"==typeof t.mimeType?t.mimeType:"";return n.startsWith("video/")?function(e,t){return`<video controls${Mt(e)}><source src="${ct(t)}"${Lt(e)}></video>`}(t,i):n.startsWith("audio/")?function(e,t){return`<audio controls><source src="${ct(t)}"${Lt(e)}></audio>`}(t,i):""===n||n.startsWith("image/")?function(e,t){let i="string"==typeof e.alt?ut(e.alt):"";return`<img src="${ct(t)}" alt="${i}"${Mt(e)} loading="lazy" decoding="async">`}(t,i):function(e,t){let i="string"==typeof e.filename?ut(e.filename):ut(t);return`<a href="${ct(t)}" target="_blank" rel="noopener noreferrer">${i}</a>`}(t,i)},relationship:e=>{let t="string"==typeof e.relationTo?e.relationTo:"",i=Tt(e.value),n=ut((i&&Nt(i))??`#${t}`),r=$t(t),s=""===r?\' class="lp-relation"\':` class="lp-relation lp-relation--${r}"`,a=i?.url;return"string"==typeof a&&R(a)?`<a href="${ct(a)}"${s}>${n}</a>`:`<span${s}>${n}</span>`},block:(e,t)=>Et(e,t,"div","lp-block"),inlineBlock:(e,t)=>Et(e,t,"span","lp-inline-block"),table:(e,t)=>`<table${kt(e)}><tbody>${t.renderChildren(e.children??[])}</tbody></table>`,tablerow:(e,t)=>`<tr>${t.renderChildren(e.children??[])}</tr>`,tablecell:(e,t)=>{let i="number"==typeof e.headerState?e.headerState:0,n=3&i?"th":"td";return`<${n}${1===i?\' scope="col"\':2===i?\' scope="row"\':""}${xt("colspan",e.colSpan)}${xt("rowspan",e.rowSpan)}>${t.renderChildren(e.children??[])}</${n}>`}},hs=new Map,fs=!1,ps="data-payload-text",gs=new Set,ms=new Set,vs=new Set(["DIV","SECTION","ARTICLE"]),ys={name:"richText",render:$((e,t,i)=>{let n=e.element;if(ft(t)){n.textContent="";return}let r=i.sanitizerPolicy;if(void 0!==i.renderRichText){let s=i.renderRichText(t,{fieldName:e.fieldName,element:n,locale:i.locale});n.innerHTML=et(nt(s,r));return}if(Pt(t)){if(ae(t)){n.textContent="";return}let s=new Map,a=_t(n,nt(function(e,t={}){if(!Pt(e))return"";let i=function(e){let t={renderChildren:e=>{let i="";for(let n of e)i+=It(n,t);return i},resolveAlignment:wt,resolveIndent:St,onUnrenderedBlock:e};return t}(t.onUnrenderedBlock).renderChildren(e.root.children);return!1===t.sanitize?i:void 0!==t.document?it(i,{document:t.document}):!0===t.requireDocument||void 0!==at()?it(i):(function(){if(!fs){fs=!0;try{console.warn(\'[live-preview] lexicalToHtml() has no sanitizer document and returned unsanitised HTML; pass { document } (linkedom, jsdom) per call. 3.0 throws here instead: opt in now with { requireDocument: true }. See "HTML sanitization" in docs/security.md.\')}catch{}}}(),i)}(t,{sanitize:!1,onUnrenderedBlock:(e,t)=>{s.set(t,e)}}),r));for(let[t,n]of a){let r=s.get(t);void 0!==r&&Dt(e,i,r,n)}return}if("string"!=typeof t)return!1;n.innerHTML=et(nt(t,r))})},bs={name:"html",render(e,t,i){if(ft(t)){e.element.textContent="";return}let n="string"==typeof t?t:ht(t);e.element.innerHTML=et(nt(n,i.sanitizerPolicy))}},ws=new WeakSet,Ss=qt("url"),ks=/^[a-zA-Z][a-zA-Z0-9+.-]*:/,As=qt("email",function(e){let t=e.trim();return ks.test(t)||!t.includes("@")?t:`mailto:${t}`}),Ts=["src","srcset","sizes"],Rs=new WeakMap,Cs=/^\\S*[/.:]\\S*$/,$s={name:"image",render:$((e,t,i)=>{let n=e.element;if("IMG"===n.tagName&&e.altField===e.fieldName&&void 0===e.srcField&&("string"==typeof t||ft(t))){n.alt=t??"";return}if(ft(t)){Kt(n);return}let r=void 0!==e.locale,{media:s,candidate:a}=function(e,t,i,n){let r=void 0!==e.srcField&&e.srcField.length>0?N(i.allFields,e.srcField,i.locale,n):t,s=Rt(r);return{media:s,candidate:void 0===s?r:s.url}}(e,t,i,r);if(void 0===s&&"string"==typeof a&&!Cs.test(a.trim()))return!1;let l=zt(n,e.fieldName,a,void 0===s?void 0:i.serverURL);if("none"===l.kind)return!1;if("unsafe"!==l.kind){if("IMG"===n.tagName){let t=n;Ht(t,l.url,s,i.serverURL);let a=function(e,t,i,n,r){if(void 0!==t&&t.length>0){let e=N(i,t,n,r);return"string"==typeof e?e:void 0}return e?.alt}(s,e.altField,i.allFields,i.locale,r);void 0!==a&&(t.alt=a);return}n.style.backgroundImage=`url(\'${function(e){return e.replace(/[\'"()\\\\]/g,"\\\\$&")}(l.url)}\')`}else Kt(n)})},Fs={name:"upload",render:$((e,t,i)=>{let n=e.element;if(ft(t)){Qt(n);return}let r=Rt(t);if(void 0===r)return!1;let s=zt(n,e.fieldName,r.url,i.serverURL);if("none"===s.kind)return!1;if("unsafe"===s.kind){Qt(n);return}let a=s.url;if("IMG"===n.tagName){let e=n;Ht(e,a,r,i.serverURL),void 0!==r.alt&&(e.alt=r.alt);return}if("A"===n.tagName){n.setAttribute("href",a),n.textContent=r.filename??a;return}let l=ut(r.filename??a);n.innerHTML=et(`<a href="${ct(a)}">${l}</a>`)})},Ns={name:"relationship",render(e,t){let i=e.element;if(ft(t))i.removeAttribute("href"),i.textContent="";else{if("A"===i.tagName&&!Array.isArray(t)){let n=zt(i,e.fieldName,Tt(t)?.url);"safe"===n.kind?i.setAttribute("href",n.url):"unsafe"===n.kind&&i.removeAttribute("href")}i.textContent=Array.isArray(t)?t.map(Xt).join(", "):Xt(t)}}},Os={name:"select",render(e,t,i){let n=e.element,r=ft(t)?[]:function(e){return Array.isArray(e)?e.map(ht):[ht(e)]}(t);if("SELECT"!==n.tagName){if("INPUT"===n.tagName&&"radio"===n.type){let e=n;e.checked=r.includes(e.value);return}n.textContent=r.map(e=>function(e,t){let i=t.schema?.options;if(!Array.isArray(i))return e;for(let t of i){let i=Tt(t);if(void 0!==i&&ht(i.value)===e)return"string"==typeof i.label?i.label:e}return e}(e,i)).join(", ")}else!function(e,t){if(e.multiple)for(let i of Array.from(e.options))i.selected=t.includes(i.value);else e.value=t[0]??""}(n,r)}},Ms=new Set(["","false","0","off","no"]),Ls={name:"checkbox",render(e,t){let i=e.element,n=function(e){return"boolean"==typeof e?e:"string"==typeof e?!Ms.has(e.trim().toLowerCase()):"number"==typeof e?0!==e:null!=e}(t);"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}},Us=new Map,Es=new Map,xs=new Set(["short","medium","long","full"]),Ps=new Set(["short","medium","long","full"]),Is=/^[A-Za-z]{3}$/u,js=/^[0-4]$/u,Bs=new WeakSet,_s={name:"date",render(e,t,i){let n=e.element;if(ft(t)){"INPUT"===n.tagName?n.value="":(n.removeAttribute("datetime"),n.textContent="");return}let r="number"==typeof t?t:ht(t),s=new Date(r),a=!Number.isNaN(s.getTime()),l=String(r);"INPUT"!==n.tagName?("TIME"===n.tagName&&n.setAttribute("datetime",a?s.toISOString():l),n.textContent=a?function(e,t,i){let n=t.locale??i.locale??d(),r=ii("date",t.format,t.element,t.fieldName)??Ws;try{return function(e,t){let i=Zt(e,t);return pt(Es,i)??gt(Es,i,new Intl.DateTimeFormat(e,t),64)}(n,r).format(e)}catch{return e.toISOString()}}(s,e,i):l):n.value=a?function(e,t){let i=`${String(t.getFullYear()).padStart(4,"0")}-${ni(t.getMonth()+1)}-${ni(t.getDate())}`,n=`${ni(t.getHours())}:${ni(t.getMinutes())}`;return"date"===e?i:"datetime-local"===e?`${i}T${n}`:"time"===e?n:t.toISOString()}(n.type,s):l}},Ws={dateStyle:"medium",timeStyle:"short"},Ds={name:"number",render(e,t,i){let n=e.element;if(ft(t)){"INPUT"===n.tagName?n.value="":n.textContent="";return}let r="number"==typeof t?t:Number(ht(t));Number.isNaN(r)?n.textContent=ht(t):"INPUT"!==n.tagName?n.textContent=function(e,t,i){let n=t.locale??i.locale??d(),r=ii("number",t.format,t.element,t.fieldName);try{return function(e,t){let i=Zt(e,t);return pt(Us,i)??gt(Us,i,new Intl.NumberFormat(e,t),64)}(n,r).format(e)}catch{return String(e)}}(r,e,i):n.value=String(r)}},zs=new Map;!function(){if(typ','eof window>"u"||!yt()&&(typ','eof window>"u"||null==window.opener))return;let e=window.__livePreview,t=JSON.stringify(si());if(void 0!==e&&(void 0===e.configSignature||e.configSignature===t))return e.refresh(),e;let[i=[],n="",s="/api",a=1,l=!1,o=50,d=!0,u=0,c=!1,h=50,f="200px",p=!0,g=!1,m=!1,v=!0,y="parent-or-opener",b="strict",w,S=!1,k=!1,A,T,R="off",C,$,F=[],N="descendant"]=si(),O=function(e){let t=typeof __LIVE_PREVIEW_FRAGMENT__<"u"?__LIVE_PREVIEW_FRAGMENT__:void 0,i=t??(typeof __LIVE_PREVIEW_ROUTE__<"u"?__LIVE_PREVIEW_ROUTE__:void 0);if(void 0===i)return;let n=i.createRouteStrategy();return void 0===t||void 0===e||""===e?{route:n}:{fragment:t.createFragmentStrategy({endpoint:e}),route:n}}(w),M=new es({additionalOrigins:i,enableReferrerDetection:!p,enableLocalhostMatching:!g});M.isProductionUnconfigured?gi("[live-preview] LP0101: No trusted origin. Pass allowedOrigins to generateInlineScript() (or to the adapter) \\u2014 the runtime reads no environment variable in the browser."):M.isReferrerOnlyTrust&&gi("[live-preview] LP0102: document.referrer fallback trusts any framing site. Set allowedOrigins and a frame-ancestors CSP in production.");let L=new vi,U=function(){let e=[ys,bs,Ss,As,$s,Fs,Ns,Os,{...Os,name:"radio"},Ls,_s,Ds,ri("array","structural arrays"),ri("blocks","structural arrays")];return function(e=[]){let t={};for(let i of e)t[i.name]=i;for(let[e,i]of zs)t[e]=i;return Object.freeze(t)}([Bt("text"),Bt("textarea"),...e])}(),E=new Qr({renderers:U,originMatcher:e=>M.matches(e),lockedOrigin:()=>M.lockedOrigin,readyTargets:()=>M.enumerate(),emitter:L,eventSourcePolicy:y,...""!==n?{dataMerge:{serverURL:n,apiRoute:s,depth:a}}:{},debounceMs:o,heartbeatMs:u,intersectionRootMargin:f,disableVisibilityGate:c,visibilityGateThreshold:h,enableA11y:d,scopeBindingsByOwner:m,subfieldCoverage:N,skipUnchanged:v,revealEditedField:S,onUnfaithfulPatch:r({onUnfaithfulPatch:T,onUnboundChange:A}),autoBind:R,...void 0!==C?{hydration:C}:{},sanitizerPolicy:b,...void 0!==O?{strategies:O}:{},onHeartbeatTimeout:()=>{M.unlockOrigin()},...l?{log:(...e)=>{mi("[live-preview]",...e)}}:{}});L.on("connect",e=>{M.lockOrigin(e.origin)}),E.start(),e?.destroy();let x=function(e,t={}){let i=t.windowTarget??globalThis.window,n=t.documentTarget??globalThis.document,r=[...new Set(t.softNavigationEvents??[])],s=()=>{e.suspend()},a=t=>{!0===t.persisted&&e.resume()},l=!1,o=()=>{l=!0},d=t=>{if(t.type===is){if(!l)return;l=!1}void 0===e.refreshAfterNavigation?e.refreshCache():e.refreshAfterNavigation()},u=!1;i?.addEventListener("pagehide",s),i?.addEventListener("pageshow",a);for(let e of r)n?.addEventListener(e,d);let c=r.includes(is);return c&&n?.addEventListener(ns,o),()=>{if(!u){u=!0,i?.removeEventListener("pagehide",s),i?.removeEventListener("pageshow",a);for(let e of r)n?.removeEventListener(e,d);c&&n?.removeEventListener(ns,o)}}}({suspend:()=>E.suspend(),resume:()=>E.start(),refreshCache:()=>{E.refreshCache()},refreshAfterNavigation:()=>{E.navigationCommit()}},{softNavigationEvents:F}),P=Object.freeze({version:Xn,configSignature:t,destroy:()=>{x(),E.destroy();let e=window;e.__livePreview===P&&delete e.__livePreview},refresh:()=>{E.refreshCache()},refreshAfterNavigation:()=>{E.navigationCommit()},enumerateOrigins:()=>M.enumerate(),inspect:()=>E.inspect()});try{Object.defineProperty(window,"__livePreview",{value:P,writable:!1,configurable:!0})}catch(e){throw x(),E.destroy(),e}}()})();'].join(""),t=Object.freeze({profile:"lean",source:e,contentHash:"b3cf9274bb5fbed9",integrity:"sha384-DOfAqKl24uIqGoomFoZhLg6RpNZSlJQmzGShKlWS94EJP2mZ6efN4m8eNaiorqpk"});exports.LEAN_RUNTIME=t;
|
|
2
2
|
//# sourceMappingURL=lean.cjs.map
|