payload-live-preview 2.3.1 → 2.3.2
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 +1 -1
- 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.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.js.map +1 -1
- package/dist/client.cjs +1 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +15 -13
- package/dist/core.d.ts +15 -13
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- 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/plugins.cjs +1 -1
- package/dist/plugins.cjs.map +1 -1
- package/dist/plugins.js +1 -1
- package/dist/plugins.js.map +1 -1
- package/package.json +1 -1
package/dist/lean.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
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),u=Date.now(),d=void 0!==l&&("escalate"!==a||void 0===o||o===l.identity||u-l.at<Fi);if((d||"escalate"!==a)&&t.display.shortfall(t.activeUpdate,{kind:"unfaithful",field:i.fieldName}),!d){if(t.reportedUnfaithful.set(i.element,{identity:o,at:u}),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"select"===e||"radio"===e}function o(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value:e.textContent}function u(e){let t=e.trim();return JSON.stringify(t.length>Mi?`${t.slice(0,Mi)}\\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 c(e){if(++e.nodes>1e4)throw new Error("invalid or oversized field schema")}function h(e,t,i){if(c(t),i>64||t.active.has(e))throw new Error("invalid or oversized field schema");t.active.add(e)}function f(e){try{return p(e,{nodes:0,active:new WeakSet},0)}catch{return[]}}function p(e,t,i){if(!Array.isArray(e))return[];h(e,t,i);let n=[];for(let r of e){let e=g(r,t,i);e&&n.push(e)}return t.active.delete(e),n}function g(e,t,i){if(c(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=p(n.fields,t,i+1),l=function(e,t,i){if("object"==typeof e&&null!==e&&!Array.isArray(e)){h(e,t,i);let n=[];for(let r in e){if(!Object.hasOwn(e,r))continue;c(t);let s=Reflect.get(e,r);"object"!=typeof s||null===s||["__proto__","constructor","prototype"].includes(r)||n.push({...s,slug:r,fields:p(s.fields,t,i+1)})}return t.active.delete(e),n}if(!Array.isArray(e))return[];h(e,t,i);let n=[];for(let r of e){if(c(t),"object"!=typeof r||null===r)continue;let e=r,s=e.slug;if("string"!=typeof s||0===s.length)continue;let a=p(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},u=n.relationTo;if(Array.isArray(u)){let e=[];for(let i of u)c(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 m(e,t){return void 0===e||t(e)}function v(e,t){return null==e||t(e)}function y(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}function b(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 Pi)(n>=Li[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 w(e,t){return e.generation===t.generation&&e.revision===t.revision}function S(e){xi.has(e)||(xi.add(e),yi(`[live-preview] LP0104: this page carries the lean runtime, which leaves out ${e} (${Ei[e]}). The elements are left as the server rendered them. Remove \\`runtime: LEAN_RUNTIME\\` to get the full runtime.`))}function k(e){return function(e){return!1!==e.enableA11y&&S("screen-reader announcements"),null}(e)}function A(e){if(typ','eof window>"u")return;let t=[];window.parent!==window&&t.push(window.parent),window.opener instanceof Window&&t.push(window.opener),Ui.sendReady(t,e)}function T(e,t,i,n){for(let r of e){if(Ii.has(r.type)){let e=r.fields;e&&T(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&&T(r.fields,e,i,n);else if("array"===r.type&&r.fields)T(r.fields,`${e}.*`,i,n);else if("blocks"===r.type&&r.blocks)for(let t of r.blocks)T(t.fields,`${e}.*.${t.slug}`,i,n)}}function R(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 C(e){if("string"!=typeof e)return!1;let t=e.trim().replace(Di,"");if(0===t.length)return!1;if(t.startsWith("#")||t.startsWith("?")||Wi.test(t)||t.startsWith("/"))return!0;try{let e=new URL(t);return ji.has(e.protocol)}catch{return Bi.test(t)&&!function(e){let t=qi.exec(e.replace(zi,""))?.[1];return void 0!==t&&!ji.has(`${t.toLowerCase()}:`)}(t)}}function $(e){let t=e.trim().replace(Di,"");return/^https?:\\/\\//i.test(t)||Wi.test(t)}function F(e){return Gi.add(e),e}function N(){return!0}function M(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(Ki.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(!Ki.has(t)&&Object.prototype.hasOwnProperty.call(e,t))return e[t]}function L(e,t,i,n){return M(e,i,t.locale??n,void 0!==t.locale)}function P(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(L(i,e,t,r));if(void 0===s)return;l+=`|${t}=${s}`}return l}function U(e){return e.closest(`[${Qi}]`)}function E(e){let t=e.getAttribute(Xi);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 I(e,t){return void 0===t||""===t?`collection:${e}`:`collection:${e}:${t}`}function _(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 W(e){return"object"==typeof e&&null!==e}function D(e){return Array.isArray(e)?"array":W(e)?"object":"scalar"}function z(e,t){return W(e)?e[t]:void 0}function q(e,t){return("string"==typeof t||"number"==typeof t)&&W(e)&&!Array.isArray(e)&&e.id===t}function V(e,t){if(!W(e)||!W(t))return q(e,t)||q(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)&&V(z(e,i),z(t,i)))}function H(e,t){let i=n(t),r=n(e);return!!(void 0!==i&&i===r||q(e,t)||q(t,e))||void 0!==i&&void 0!==r&&V(e,t)}function G(e,t,i,n){let r=[],s=0,a=(e,t,i,l)=>{if(s+=1,n.covers(e)||H(t,i))return;if(!((void 0===t||D(t)===D(i))&&W(i)&&n.reachesBelow(e)&&l<Zi)){r.push({path:e,value:i});return}let o=function(e,t){let i=new Set(Object.keys(t));if(W(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>=Yi){r.push({path:e,value:i});return}a(`${e}.${n}`,z(t,n),z(i,n),l+1)}};return a(e,t,i,0),r}function J(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 K(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 Q(e,t,i,n=J(e,i)){let r,s=n.covers,a=n.reachesBelow;return n=>{let l=K(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 X(e,t,i,n,r){return ee(i)?!ee(t)||function(e,t,i){let n=void 0===i?void 0:R(i,e);return void 0!==n&&!tn.has(n.type)||!0===t.get(e)?.some(Z)||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 Z(e){return!tn.has(e.fieldType)}function Y(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(!nn.has(n)||"internal"===r?.linkType)return!0;if(Array.isArray(s))for(let e of s)t.push(e)}return!1}function ee(e){return null===e||"object"!=typeof e&&"function"!=typeof e}function te(e){return!0===e?.includes(".")}function ie(){if(typ','eof window>"u")return!1;try{return window.self!==window.top}catch{return!0}}function ne(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 re(e){return null!==e&&e.forceRender&&!e.completed}function se(e){try{return!0===e.matchMedia?.("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function ae(e,t){let i=t.element.ownerDocument.defaultView;return null===i?"no-element":e.reveal(`${t.owner??""} ${t.fieldName}`,t.element,i)}function le(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 oe(e){return!!le(e)&&e.root.children.every(e=>{let{type:t,children:i}=e??{};return"paragraph"===t&&(!Array.isArray(i)||0===i.length)})}function ue(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 de(...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 ce(e,t){let i={};for(let n of t)n!==e&&(i[n]=[e]);return i}function he(e){return"patch"===e.getAttribute(mn)}function fe(e){return function(e){return"astro-island"===e.tagName.toLowerCase()||e.hasAttribute(mn)}(e)&&!he(e)}function pe(e){return"astro-island"===e.tagName.toLowerCase()&&e.hasAttribute("ssr")}function ge(e){let t=e.closest(jn)?.getAttribute(Ln);return null==t||0===t.length?void 0:t}function me(e){return Dn.has(e)||Wn.test(e)}function ve(e,t){return e.fieldName===t.fieldName&&e.locale===t.locale&&e.owner===t.owner&&e.strategyKind===t.strategyKind&&e.fragmentBoundary===t.fragmentBoundary}function ye(e){let t=e.getAttribute(bn);if(null!==t&&me(t))return t;if(e.hasAttribute(Fn))return"richText";if(e.hasAttribute(Nn))return"html";if(e.hasAttribute(On))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 be(){return!0}function we(){throw new Error("invalid or oversized legacy population")}function Se(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 ke(e,t){if("string"!=typeof e||0===e.length||e.length>t||"."===e||".."===e||e.includes("/")||e.includes("\\\\")||Se(e))return!1;try{return encodeURIComponent(e),!0}catch{return!1}}function Ae(e){return ke(e,128)&&!/[?#%]/u.test(e)&&!Zn.has(e)}function Te(e){return Number.isFinite(e)?String(e):ke(e,512)?e:we()}function Re(e,t){return Object.hasOwn(e,t)?Reflect.get(e,t):void 0}function Ce(e,t,i){Object.defineProperty(e,t,{value:i,writable:!0,configurable:!0,enumerable:!0})}function $e(e){let t=e.length;for(;t>0&&47===e.charCodeAt(t-1);)t-=1;return e.slice(0,t)}function Fe(e){let t=new WeakSet,i=0,n=0;return function e(r,s){if(++i>Vn||s>qn)return we();if("string"==typeof r)return n+=r.length,n>Kn&&we(),r;if(null==r||"boolean"==typeof r)return r;if("number"==typeof r)return Number.isFinite(r)?r:we();if(!Array.isArray(r)&&!y(r))return we();if(Array.isArray(r)){r.length>Vn&&we();for(let e=0;e<r.length;e+=1)Object.hasOwn(r,e)||we()}if(t.has(r))return we();t.add(r);let a=Array.isArray(r)?[]:{};for(let t of Object.keys(r))Ce(a,t,e(Reflect.get(r,t),s+1));return t.delete(r),a}(e,0)}function Ne(e,t,i,n,r,s){function a(e,t,i,n){if(null==n||""===n)return;let s=y(n)?Re(n,"id"):n,a=Te(s);if(0===r){Ce(e,t,s);return}let l=JSON.stringify([i,a]);c.add(l),c.size>Hn&&we();let o=d.get(i)??[];o.push({owner:e,key:t,id:a}),d.set(i,o)}function l(e,t,i){void 0!==i.hasMany&&"boolean"!=typeof i.hasMany&&we();let n=i.relationTo,r=Re(e,t);if(Array.isArray(n)){0===n.length&&we();let e,t=y(r)?Re(r,"relationTo"):void 0;for(let i of n)p(0),Ae(i)||we(),i===t&&(e=i);if(null==r||""===r)return;(!y(r)||void 0===e)&&we(),a(r,"value",e,Re(r,"value"))}else Ae(n)||we(),a(e,t,n,r)}function o(e,t){if(p(t),Array.isArray(e)||y(e)){if(y(e)&&Object.hasOwn(e,"relationTo")&&Object.hasOwn(e,"value")){let t=Re(e,"relationTo");Ae(t)||we(),a(e,"value",t,Re(e,"value"));return}for(let i of Object.keys(e))o(Reflect.get(e,i),t+1)}}if(!Number.isSafeInteger(r)||r<0||r>qn)return we();void 0!==s&&("string"!=typeof s||s.length>128||Se(s))&&we();let u=Fe(e);if(!y(u))return we();let d=new Map,c=new Set,h=0,f=new WeakSet,p=e=>{(++h>Vn||e>qn)&&we()};(function e(t,i,n){p(n),f.has(t)&&we(),f.add(t);for(let r of t){p(n),(!y(r)||!ke(r.name,512)||Zn.has(r.name))&&we();let t=Re(i,r.name);if("relationship"===r.type||"upload"===r.type)if(r.hasMany)if(null!=t&&!Array.isArray(t)&&we(),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&&!y(t)&&we(),y(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?Ce(i,r.name,[]):null!=t&&!Array.isArray(t)&&we(),Array.isArray(t))for(let i of t)if(y(i)||we(),"array"===r.type&&r.fields)e(r.fields,i,n+1);else if("blocks"===r.type){let t=Re(i,"blockType"),s=r.blocks?.find(e=>(p(n),e.slug===t));void 0===s&&we(),e(s.fields,i,n+1)}}else"richText"===r.type&&o(t,n+1)}f.delete(t)})(t,u,0),d.size>25&&we();let g=[];if(0===d.size)return{doc:u,requests:g};let m=new URL(i);(!["http:","https:"].includes(m.protocol)||m.username||m.password||m.search||m.hash)&&we(),(!n.startsWith("/")||n.includes("\\\\")||/[%?#]/u.test(n)||Se(n))&&we(),n.split("/").some(e=>"."===e||".."===e)&&we();let v=`${$e(i)}${$e(n)}/`;for(let[e,t]of d){let i=[...new Set(t.map(e=>e.id))],n=0;for(;n<i.length;){let a=i[n];void 0===a&&we();let l=a.includes(","),o=[],u="";for(;n<i.length&&o.length<Xn;){let t=i[n];if(void 0===t||o.length>0&&(l||t.includes(",")))break;let a=[...o,t],d=new URLSearchParams({depth:String(r),limit:String(a.length)});void 0!==s&&d.set("locale",s),d.set(l?"where[id][equals]":"where[id][in]",l?t:a.join(","));let c=`${v}${encodeURIComponent(e)}?${d}`;if(c.length>Jn){0===o.length&&we();break}new URL(c).origin!==m.origin&&we(),o.push(t),n+=1,u=c}(0===o.length||g.length>=Gn)&&we();let d=new Set(o);g.push({url:u,ids:d,slots:t.filter(e=>d.has(e.id))})}}return{doc:u,requests:g}}async function Me(e,t,i){let n,r,s=!1,a=!1,l=Symbol(),o=new Promise(e=>{r=()=>{e(l)}}),u=()=>{(!i()||t.aborted)&&we()},d=()=>{if(void 0!==n&&!s){s=!0;try{Promise.resolve(n.cancel()).catch(()=>{})}catch{}}},c=()=>{r?.(),d()};t.addEventListener("abort",c,{once:!0});try{u();let t=e.body??null;if(u(),null===t){let t=e.json.bind(e);u();let i=await Promise.race([Promise.resolve().then(()=>(u(),t())),o]);return u(),i===l&&we(),i}let i=t.getReader.bind(t);u();let r=i();n=r,u();let s=[],d=0,c=0;for(;;){let e=Promise.resolve().then(()=>{u();let e=r.read.bind(r);return u(),e()}),t=await Promise.race([e,o]);if(u(),t===l&&we(),t.done)break;d+=t.value.byteLength,(++c>Qn||d>Kn)&&we(),s.push(t.value)}a=!0;let h=new Uint8Array(d),f=0;for(let e of s)h.set(e,f),f+=e.byteLength;try{return JSON.parse((new TextDecoder).decode(h))}catch{return we()}}finally{t.removeEventListener("abort",c),a||d();try{n?.releaseLock()}catch{}}}function Oe(e,t){let i=Fe(t);y(i)||we();let n=Re(i,"docs");(!Array.isArray(n)||n.length>Xn)&&we();let r=new Map;for(let t of n){y(t)||we();let i=Te(Re(t,"id"));(!e.ids.has(i)||r.has(i))&&we(),r.set(i,t)}r.size!==e.ids.size&&we();for(let t of e.slots)Ce(t.owner,t.key,r.get(t.id))}function Le(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 Pe(e){return Le(e,128)&&!e.includes("?")&&!e.includes("#")}function Ue(e){return"number"==typeof e?Number.isFinite(e):"string"==typeof e&&Le(e,512)}function Ee(e){return e.has("schema-json")?ir:e.has("document-events")||e.has("relationship-events")?nr:rr}function xe(e){if("attributes"!==e.type||e.attributeName!==sr||e.target.nodeType!==ar)return null;let t=e.target;return"astro-island"!==t.tagName.toLowerCase()||t.hasAttribute(sr)?null:t}function Ie(e){if(e.nodeType!==ar)return!1;let t=e;return t.matches(or)||null!==t.querySelector(or)}function _e(){if(typ','eof window>"u")return;let e=window;return e[mr]??(e[mr]={armed:!1,committed:!1,commits:[],onCommit:void 0,waiters:[]})}function je(){let e=_e();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 Be(e){e.committed=!0;let t=e.waiters;e.waiters=[];for(let e of t)e()}function We(e,t){let i=e.waiters.indexOf(t);i>=0&&e.waiters.splice(i,1)}function De(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,We(e,r),t("timed-out")},i),()=>{null!==n&&clearTimeout(n),n=null,We(e,r)}}function ze(){if(typ','eof window>"u")return;let e=window;return e[br]??(e[br]={armed:!1,committed:!1,waiters:[]})}function qe(e){return Object.prototype.hasOwnProperty.call(e,yr)?e[yr]:void 0}function Ve(){let e=ze();if(void 0===e||e.armed)return;e.armed=!0;let t=Element.prototype;void 0===Object.getOwnPropertyDescriptor(t,yr)&&Object.defineProperty(t,yr,{configurable:!0,get:()=>{},set(e){Object.defineProperty(this,yr,{value:e,writable:!0,configurable:!0,enumerable:!0});let t=ze();void 0===t||t.committed||null===this.querySelector(vr)||function(e,t){let i=t?.$nuxt;!0!==i?.isHydrating||"function"!=typeof i.hook?Be(e):i.hook(wr,()=>{e.committed||Be(e)})}(t,e)}})}function He(e){let t=e.hydration;if(void 0===t){e.startNow();return}let i=kr[t](e.root,i=>{e.later(()=>{Ge(e,t,i)})});null!==i?(e.defer(i),e.hydrated("waiting")):Ge(e,t,"committed")}function Ge(e,t,i){e.hydrated(i),"timed-out"===i&&e.warn(`[live-preview] LP0607: no ${Ar[t]} in ${String(5e3)} ms; started without waiting for hydration.`),e.startNow()}function Je(e){return 9===e.nodeType}function Ke(e){return e.body}function Qe(e,t,i,n){if(!e.scopeBindingsByOwner)return!1;let{message:r}=i,s=function(e){if(_(e.globalSlug))return[x(e.globalSlug)];if(!_(e.collectionSlug))return null;let t=I(e.collectionSlug);return _(e.documentId)?[t,I(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 Xe(e,t,i,n,r){!function(e,t,i){let n=0;for(let r of e)if(!i()||(r.dispatchEvent(new CustomEvent(gn,{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 Ze(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="${K(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 Ye(e){let t=typeof e;return"string"===t||"number"===t||"boolean"===t||"bigint"===t}function et(e){return Array.isArray(e.docs)&&"boolean"==typeof e.hasNextPage}function tt(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function it(e){let t=function(){let e=function(){let e=globalThis,t=e[Fr];if(void 0!==t)return t;let i={};return e[Fr]=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($r,{createHTML:e=>e})}catch{e.auto=null}return e.auto}();return null===t?e:t.createHTML(e)}function nt(e){Mr.has(e)||(Mr.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(Or)?"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 rt(e,t){return st(e,void 0,t)}function st(e,t,i){let n=i?.document??ot();if(!n)throw at();if(""===e)return"";let r=function(e,t){let i=e?.policy??t??Vr;if(!e){let e=new Map;for(let[t,i]of Object.entries(jr))e.set(t,i);return{allowedTags:Lr,attrByTag:e,allowFormControls:!1,templateMode:!1,mode:i,allowedData:new Set}}let n=new Set(Lr);if(e.additionalAllowedTags?.forEach(e=>n.add(e)),!0===e.allowFormControls)for(let e of Pr)n.add(e);let r=new Map;for(let[e,t]of Object.entries(jr))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<Wr;e+=1){let e=n.createElement("template");e.innerHTML=it(s);let t=e.content;ut(t,r);let i=lt(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[Nr]??(i[Nr]=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(Wr)} passes, so it returned an empty string (ADR 0016).`),""}function at(){return new Error("sanitizeHtml needs a DOM")}function lt(e){let t=e.ownerDocument?.createElement("div");if(void 0===t)throw at();let i=e.firstChild;if(t.append(e),t.firstChild!==i)throw at();return t.innerHTML}function ot(){if(!(typ','eof document>"u"))return document}function ut(e,t){for(let i of Array.from(e.childNodes))i.nodeType===Dr?dt(i,t):i.nodeType===zr&&i.remove()}function dt(e,t){let i=e.tagName.toLowerCase();!Ur.has(i)||t.allowFormControls&&Pr.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&&qr.has(r))continue;if("id"===r||"name"===r||r.startsWith(_r)){e.removeAttribute(t.name),("name"!==r||!0===n?.has(r))&&nt(r);continue}if(r.startsWith(Ir)){i.allowedData.has(r)||(e.removeAttribute(t.name),nt(r));continue}if(Er.has(r)||r.startsWith(xr))continue}else if(Er.has(r)||r.startsWith(xr)||r.startsWith(Ir))continue;n?.has(r)?(Br.has(r)&&!C(t.value)||"srcset"===r&&!ct(t.value)||"ping"===r&&!t.value.trim().split(/\\s+/u).every(C))&&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||!$(t)||(e.setAttribute("rel","noopener noreferrer"),e.hasAttribute("target")||e.setAttribute("target","_blank"))}(e),ut(e,t)):(ut(e,t),e.replaceWith(...e.childNodes)):e.remove()}function ct(e){for(let t of e.split(",")){let e=t.trim();if(0===e.length)continue;let[i=e]=e.split(/\\s/,1);if(!C(i)||!C(e))return!1}return!0}function ht(e){return e.replace(Gr,e=>Hr[e])}function ft(e){return e.replace(Kr,e=>Jr[e])}function pt(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 gt(e){return null==e||""===e}function mt(e,t){let i=e.get(t);return void 0!==i&&(e.delete(t),e.set(t,i)),i}function vt(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 yt(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 bt(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 wt(e){let t=e.trim();if(0!==t.length)try{let e=new URL(t);return"http:"!==e.protocol&&"https:"!==e.protocol||!ns.test(e.origin)?void 0:e.origin}catch{return}}function St(e){let t=e.format;return"string"==typeof t&&ds.has(t)?t:"number"==typeof t?us[t]:void 0}function kt(e){let t=e.indent;return"number"==typeof t&&t>0?t:0}function At(e){return"rtl"===e.direction?\' dir="rtl"\':"ltr"===e.direction?\' dir="ltr"\':""}function Tt(e){let t=St(e),i=kt(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 Rt(e){return"object"==typeof e&&null!==e?e:void 0}function Ct(e){return Rt(e)}function $t(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 Ft(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-").toLowerCase()}function Nt(e){return"string"==typeof e&&e.length>0?e:void 0}function Mt(e){let t=Nt(e.title)??Nt(e.name)??Nt(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 Lt(e){return`${"number"==typeof e.width?` width="${String(e.width)}"`:""}${"number"==typeof e.height?` height="${String(e.height)}"`:""}`}function Pt(e){return"string"==typeof e.mimeType?` type="${ft(e.mimeType)}"`:""}function Ut(e){return gs.get(e)}function Et(e,t,i,n){let r=Rt(e.fields)??{},s="string"==typeof r.blockType?r.blockType:"",a=Ft(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,r)}return`<${i} class="${l}"></${i}>`}function xt(e,t){return"number"==typeof t&&t>1?` ${e}="${String(t)}"`:""}function It(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 _t(e,t){let i=function(e){return ys.get(e)??vs[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:F((e,i)=>{let n=e.element,r=function(e){return null==e?"":It(e)?function(e){return It(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(ws))return function(e,t,i){e.has(t)||(e.add(t),yi(`[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=it(function(e){return ht(e).replace(/\\r\\n|\\r|\\n/g,"<br>")}(r));return}n.textContent=r}}else n.value=r})}}function Wt(e,t){let i=e.cloneNode(!1);i.innerHTML=it(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||!Ts.has(i.tagName)||i.hasAttribute(yn)||n?.tagName===i.tagName||!0===n?.matches(ms))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(ms);if(s.length>0&&null!==n.firstElementChild){let e=[];Dt(n,i,e);for(let[t,i]of e)t.replaceWith(i),i.matches(ms)||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 Dt(e,t,i){let n=(e,t)=>{e.matches(ms)?i.push([e,t]):Dt(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(ms)||a.add(e.tagName);let l=(e,t)=>e.matches(ms)?!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 u=Math.min(e.children.length,t.children.length);r=e.lastElementChild,s=t.lastElementChild;for(let e=o;e<u&&null!==r&&null!==s;e+=1){if(!l(s,r))return;n(s,r),r=r.previousElementSibling,s=s.previousElementSibling}}function zt(e,t,i,n){n&&t.reportUnfaithful?.(e,`lost the markup the server drew for block "${i}"`);let r=n?ks:Ss;r.has(i)||(r.add(i),yi(`[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 qt(e,t,i,n){if("string"!=typeof i||0===i.length)return{kind:"none"};let r=$t(i,n);return C(r)?{kind:"safe",url:r}:($s.has(e)||($s.add(e),yi(`[live-preview] LP0401: refused an unsafe URL for "${t}" on <${e.tagName.toLowerCase()}>; the attribute was cleared.`)),{kind:"unsafe"})}function Vt(e,t=e=>e){return{name:e,render(e,i,n){let r=e.element;if(gt(i)){!function(e){"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):e.value=""}(r);return}let s=pt(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):M(n.allFields,i,n.locale,void 0!==e.locale),l=qt(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 Ht(e){for(let t of Os)e.removeAttribute(t);Gt(e)}function Gt(e){if("PICTURE"===e.parentElement?.tagName)for(let t of e.parentElement.querySelectorAll("source"))t.remove()}function Jt(e,t,i,n){let r=function(e,t){let i=[];for(let[n,r]of Object.entries(e?.sizes??e?.variants??{})){if("string"!=typeof r.url||"number"!=typeof r.width)continue;let e=$t(r.url,t);C(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&&Kt(e,t.url,s))??r.find(t=>t.name===Ls.get(e));void 0===a?.name?Ls.delete(e):Ls.set(e,a.name),(null===s||!(Kt(e,t,s)||r.some(t=>Kt(e,t.url,s))))&&Gt(e),e.src=a?.url??t;let l=a??i,o=r.filter(e=>Qt(e,l)),u=o.length>0?o:r.filter(e=>Qt({...e,mimeType:void 0},l));if(0===u.length){e.removeAttribute("srcset"),e.removeAttribute("sizes");return}if("number"==typeof i?.width&&"string"==typeof i.url){let e=$t(i.url,n),t={...i,url:e,width:i.width};C(e)&&Qt(t,l)&&u.push(t)}let d=new Set,c=[];for(let e of u)d.has(e.width)||(d.add(e.width),c.push(`${Xt(e.url)} ${String(e.width)}w`));let h=c.join(", ");e.setAttribute("srcset",h)}function Kt(e,t,i){try{return new URL(t,e.baseURI).href===new URL(i,e.baseURI).href}catch{return t===i}}function Qt(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 Xt(e){return e.replace(/[\\s,]/g,encodeURIComponent)}function Zt(e){"IMG"===e.tagName?Ht(e):e.style.backgroundImage=""}function Yt(e){"IMG"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):Ht(e)}function ei(e){let t=Rt(e);return void 0===t?pt(e):Mt(t)??""}function ti(e,t){let i=e??"";if(null==t)return i;let n=ii(t);return"{}"===n?i:`${i}|${n}`}function ii(e){if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(e=>ii(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)}:${ii(i)}`)}return`{${n.join(",")}}`}function ni(e){return{kind:"date",options:e}}function ri(e){return{kind:"number",options:e}}function si(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?ni({dateStyle:"medium"}):Ds.has(n)?ni({dateStyle:n}):void 0;case"time":return void 0===n?ni({timeStyle:"short"}):zs.has(n)?ni({timeStyle:n}):void 0;case"datetime":return void 0===n?ni({dateStyle:"medium",timeStyle:"short"}):Ds.has(n)?ni({dateStyle:n,timeStyle:"short"===n?"short":"medium"}):void 0;case"number":return void 0===n?ri({}):Vs.test(n)?ri({minimumFractionDigits:Number(n),maximumFractionDigits:Number(n)}):void 0;case"currency":return void 0!==n&&qs.test(n)?ri({style:"currency",currency:n.toUpperCase()}):void 0;case"percent":return void 0===n?ri({style:"percent"}):void 0;default:return}}(t);if(void 0!==r)return r.kind===e?r.options:void 0;!function(e,t,i){Hs.has(e)||(Hs.add(e),yi(`[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 ai(e){return String(e).padStart(2,"0")}function li(e,t){return{name:e,render(){S(t)}}}function oi(){return typeof __LIVE_PREVIEW_CONFIG__>"u"?[]:__LIVE_PREVIEW_CONFIG__}var ui=Object.defineProperty,di=e=>{throw TypeError(e)},ci=(e,t,i)=>((e,t,i)=>t in e?ui(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i),hi=(e,t,i)=>t.has(e)||di("Cannot "+i),fi=(e,t,i)=>(hi(e,t,"read from private field"),i?i.call(e):t.get(e)),pi=(e,t,i)=>t.has(e)?di("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),gi=(e,t,i,n)=>(hi(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),mi=(e,t,i)=>(hi(e,t,"access private method"),i),vi=t((...e)=>console.error(...e)),yi=t((...e)=>console.warn(...e)),bi=t((...e)=>console.debug(...e)),wi=class{constructor(){pi(this,Ai);pi(this,Si,new Map);pi(this,ki,new Map)}on(e,t){return mi(this,Ai,Ri).call(this,fi(this,Si),e,t)}once(e,t){return mi(this,Ai,Ri).call(this,fi(this,ki),e,t)}off(e,t){mi(this,Ai,Ci).call(this,fi(this,Si),e,t),mi(this,Ai,Ci).call(this,fi(this,ki),e,t)}async emit(e,t){await mi(this,Ai,Ti).call(this,e,t)}async emitWhile(e,t,i){return mi(this,Ai,Ti).call(this,e,t,i)}listenerCount(e){return(fi(this,Si).get(e)?.size??0)+(fi(this,ki).get(e)?.size??0)}removeAllListeners(e){void 0!==e?(fi(this,Si).delete(e),fi(this,ki).delete(e)):(fi(this,Si).clear(),fi(this,ki).clear())}eventNames(){let e=new Set;for(let t of fi(this,Si).keys())e.add(t);for(let t of fi(this,ki).keys())e.add(t);return[...e]}},Si=new WeakMap,ki=new WeakMap,Ai=new WeakSet,Ti=async function(e,t,i){let n=()=>i?.()??!0;if(!n())return!1;let r=fi(this,Si).get(e);if(r)for(let i of[...r])if(!n()||(await mi(this,Ai,$i).call(this,i,t,e),!n()))return!1;if(!n())return!1;let s=fi(this,ki).get(e);if(s&&s.size>0){let i=[...s];fi(this,ki).delete(e);for(let r of i)if(!n()||(await mi(this,Ai,$i).call(this,r,t,e),!n()))return!1}return n()},Ri=function(e,t,i){let n=e.get(t);return n||(n=new Set,e.set(t,n)),n.add(i),()=>{mi(this,Ai,Ci).call(this,e,t,i)}},Ci=function(e,t,i){let n=e.get(t);void 0!==n&&(n.delete(i),0===n.size&&e.delete(t))},$i=async function(e,t,i){try{await e(t)}catch(e){let t="string"==typeof i||"number"==typeof i?String(i):"<event>";vi(`[live-preview] LP0601: handler for "${t}" threw:`,e)}},Fi=1e3,Ni=new Set(["date","number","checkbox","select","radio"]),Mi=40,Oi=["data","fieldSchemaJSON","globalSlug","collectionSlug","locale","ready","previewToken","protocolVersion"],Li={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"}},Pi=Object.keys(Li),Ui=class{constructor(e,t){ci(this,"matcher");ci(this,"handlers");ci(this,"boundListener");ci(this,"attachedTarget");ci(this,"generation",0);ci(this,"revision",0);ci(this,"queueHead");ci(this,"queueTail");ci(this,"lastAccepted");ci(this,"replayedGeneration",0);ci(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&&!y(t.data))&&v(t.fieldSchemaJSON,e=>Array.isArray(e))&&v(t.globalSlug,e=>"string"==typeof e)&&v(t.collectionSlug,e=>"string"==typeof e)&&v(t.locale,e=>"string"==typeof e)&&v(t.ready,e=>"boolean"==typeof e)&&v(t.previewToken,e=>"string"==typeof e)&&v(t.protocolVersion,e=>"number"==typeof e)}(r)){this.reportInvalid("shape",n,t);return}this.dispatchUpdate(function(e){let t={...e};for(let e of Oi)null===Reflect.get(t,e)&&Reflect.deleteProperty(t,e);return Array.isArray(t.fieldSchemaJSON)?{...t,fieldSchemaJSON:f(t.fieldSchemaJSON)}:t}(r),n,t);return;case"payload-document-event":if(!function(e){let t=e;return m(t.action,e=>"updated"===e||"created"===e||"deleted"===e)&&m(t.slug,e=>"string"==typeof e)&&m(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=y(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}},Ei={"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\'"},xi=new Set,Ii=new Set(["tabs","row","collapsible"]),_i={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"},ji=new Set(["http:","https:","mailto:","tel:"]),Bi=/^(?:\\.{1,2}\\/|[a-zA-Z0-9_-]+\\/?)/,Wi=/^[\\\\/]{2}/,Di=/[\\t\\n\\r]/g,zi=/[\\s\\u0000-\\u001f\\u180e\\u2000-\\u2029]/g,qi=/^([a-z][a-z0-9+.-]*):/i,Vi=new Set(["style","srcdoc","formaction","form","id","name","is","srcset","imagesrcset"]),Hi=new Set(["href","src","poster","cite","action","xlink:href","data"]),Gi=new WeakSet,Ji=class{constructor(){ci(this,"previous",null);ci(this,"lastFields");ci(this,"priorFields");ci(this,"keepValues",!1)}get previousFields(){return this.priorFields}get isBaseline(){return null===this.previous}diff(e,t,i=N){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 u=new Set,d=Object.entries(t);if(!i())return null;for(let[e,t]of d)if(l.has(e))for(let e of t)if(u.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:u,baseline:s}):null}reset(){this.previous=null,this.lastFields=void 0,this.priorFields=void 0}},Ki=new Set(["__proto__","prototype","constructor"]),Qi="data-payload-fragment",Xi="data-payload-strategy",Zi=8,Yi=1024,en=new Set(["id","_id","createdAt","updatedAt","createdBy","updatedBy","_status","globalType","collection","locale","localized"]),tn=new Set(["text","textarea","email","number","checkbox","date","select","radio","point","code","json","ui","html"]),nn=new Set(["root","paragraph","text","heading","quote","list","listitem","linebreak","tab","horizontalrule","code","code-highlight","table","tablerow","tablecell","link","autolink"]),rn={},sn=class{constructor(){ci(this,"rawChanges",new Ji);ci(this,"resolved",null);ci(this,"resolvedLocale",null);ci(this,"trailing",null);ci(this,"openUntil",0);ci(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(Z(e)||e.fieldName.includes(".")||te(e.hrefField)||te(e.srcField)||te(e.altField))return!0;return void 0!==e.strategies.fragment&&null!==e.root.querySelector(`[${Qi}]`)}(e)&&!function(e,t,i){for(let n of e.values()){if("text"!==n.fieldType||!0===n.explicitFieldType)continue;let e=L(t,n,n.fieldName,i);if(le(e)&&Y(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,rn),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(en.has(r)){a[r]=n;continue}let o=X(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))}},an=class{constructor(){ci(this,"negotiation",b(void 0));ci(this,"observed",new Set)}observe(e,t,i){let n=e.filter(e=>!this.observed.has(e));if(0!==n.length){for(let e of n)this.observed.add(e);this.negotiation=b(this.negotiation.theirs,this.observed),t("protocol",`observed=${n.join(",")}`)}}applyVersion(e,t){let i=this.negotiation;if(i.theirs===e)return;let n=b(e,this.observed);this.negotiation=n,n.negotiated!==i.negotiated&&t("protocol","ours=4",`theirs=${e}`,`negotiated=${n.negotiated}`)}},ln=class{constructor(){ci(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&&ne(t,e)?t:null}}commit(e){let t=e.identity!==this.lastIdentity;return this.lastIdentity=e.identity,t?e.edit:null}},on=class{constructor(){pi(this,un)}reveal(e,t,i){return e===fi(this,un)?"skipped-same":(gi(this,un,e),function(e,t){for(let t;t=e.closest?.("details:not([open])");)t.setAttribute("open","");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:se(t)?"auto":"smooth",block:"center"}),"revealed")}(t,i))}reset(){gi(this,un,void 0)}},un=new WeakMap,dn=class{constructor(){ci(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}},cn=()=>{},hn=class{constructor(){ci(this,"host",{outstanding:()=>!1,report:cn,failed:cn});ci(this,"entry",null);ci(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 cn;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}}},fn=class{constructor(){ci(this,"started",!1);ci(this,"suspended",!1);ci(this,"deferredStart",null);ci(this,"hydration","idle");ci(this,"activeUpdate",null);ci(this,"locale");ci(this,"schema");ci(this,"schemaIndex");ci(this,"updateCount",0);ci(this,"supersededCount",0);ci(this,"completedCount",0);ci(this,"skippedUnchangedCount",0);ci(this,"lastFlush",null);ci(this,"absentFields",new Set);ci(this,"warnedOrphanFields",new Set);ci(this,"warnedStrategy",new WeakSet);ci(this,"warnedUnattributableMessage",!1);ci(this,"warnedVisibilityGate",!1);ci(this,"warnedFragmentFallback",!1);ci(this,"warnedIslandStart",!1);ci(this,"warnedEscalationUnavailable",!1);ci(this,"warnedProtocolShape",!1);ci(this,"reportedUnfaithful",new WeakMap);ci(this,"checkedServerFormat",new WeakSet);ci(this,"rowsOfBinding",new WeakMap);ci(this,"unfaithfulPatches",[]);ci(this,"unfaithfulCount",0);ci(this,"escalatedCount",0);ci(this,"unfaithfulFields",new Set);ci(this,"autoBindSearchMs");ci(this,"autoBindGuesses",null);ci(this,"warnedForeignSource",!1);ci(this,"lastAppliedIdentity",new WeakMap);ci(this,"navigationReplayPending",!1);ci(this,"navigationBindingReplay",!1);ci(this,"revealLedger",new dn);ci(this,"display",new hn);ci(this,"fragmentStats",{rendered:0,failed:0,superseded:0});ci(this,"routeStats",{refreshes:0,partial:0,failed:0,refused:0,loopStopped:0});ci(this,"fragmentControllers",new Map);ci(this,"routeController",null);ci(this,"routeRetry",null);ci(this,"routeRefreshOwed",!1);ci(this,"routeAwaitsSave",!1);ci(this,"fragmentsOwed",new Set);ci(this,"readyTimers",[]);ci(this,"revealer",new on);ci(this,"changes",new Ji);ci(this,"merges",new sn);ci(this,"protocol",new an);ci(this,"relationships",new ln)}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()}},pn=class{constructor(e,t){ci(this,"deps",e);ci(this,"state",t);ci(this,"writing");ci(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,internalLinkPattern:e.internalLinkPattern,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||!w(n.revision,e.revision)||!i.isCurrent(n))return!1;let{target:r,value:a}=e,d=void 0!==n.schemaIndex?R(n.schemaIndex,r.fieldName):void 0,c=function(e,t){if(e.explicitFieldType)return e.fieldType;if(void 0!==t){let e=function(e){if(Object.prototype.hasOwnProperty.call(_i,e))return _i[e]}(t);if(void 0!==e)return e}return e.fieldType}(r,d?.type);"text"===c&&!0!==r.explicitFieldType&&le(a)&&(c="richText");let h;try{h=t.resolveRenderer(c,r)}catch(e){return this.fail(n,r.fieldName,e)}if(!i.isCurrent(n))return!1;let f=t.emitter.listenerCount("elementUpdate")>0,p=f?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 g={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||oe(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")&&!Vi.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 Hi.has(n)&&!C(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===h)return t.log("no renderer for",c),s(t,i,r,`has no renderer for "${c}"`,a),!1;{let e=function(e,t,i,n){if("ignore"===e.onUnfaithfulPatch||void 0!==i.format||!Ni.has(n)||l(n)&&i.element.matches("select,input")||t.checkedServerFormat.has(i.element))return;t.checkedServerFormat.add(i.element);let r=o(i.element);return r.trim().length>0?r:void 0}(t,i,r,c);if(this.writing=a,!1===function(e,t,i,n){return e.render(t,i,n)}(h,r,a,g)&&function(e){return Gi.has(e.render)}(h))return s(t,i,r,`is a value ${h.name} cannot render`,a),!1;void 0!==e&&function(e,t,i,n){let r=o(t.element);r!==i&&e.warn(`[live-preview] LP0412: "${t.fieldName}" showed ${u(i)}, the patch wrote ${u(r)} \\u2014 `+(l(n)?\'Payload sends the value of an option, not its label. Render the label in a data-payload-fragment boundary, or bind it with data-payload-strategy="route".\':"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,c)}}}catch(e){return this.fail(n,r.fieldName,e)}if(!i.isCurrent(n))return!1;f&&t.emitter.emitWhile("elementUpdate",{element:r.element,fieldName:r.fieldName,previousValue:p,nextValue:a,revision:n.revision.revision,receivedAt:n.receivedAt,source:"patch"},()=>i.isCurrent(n));let m=i.isCurrent(n);return m&&(void 0!==e.valueIdentity?i.lastAppliedIdentity.set(r.element,e.valueIdentity):i.lastAppliedIdentity.delete(r.element)),m}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}},gn="payload-live-preview:update",mn="data-payload-island",vn=`astro-island, [${mn}]`,yn="data-payload-field",bn="data-payload-type",wn="data-payload-attribute",Sn="data-payload-href",kn="data-payload-src",An="data-payload-alt",Tn="data-payload-array-template",Rn="data-payload-array-separator",Cn="data-payload-locale",$n="data-payload-format",Fn="data-payload-richtext",Nn="data-payload-html",Mn="data-payload-array",On="data-payload-structural",Ln="data-payload-owner",Pn="data-payload-depends",Un="data-payload-strategy",En="data-payload-boundary",xn="data-payload-covers",In=[yn,bn,wn,Sn,kn,An,Tn,Rn,Cn,$n,Fn,Nn,Mn,On,Ln,Pn,Un,En,"type"],_n=`[${yn}]`,jn=`[${Ln}]`,Bn=`[${Qi}], [${Un}="route"]`,Wn=/^[a-z][a-z0-9-]*:[a-z][a-z0-9-]*$/i,Dn=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"]),zn=class{constructor(e={}){ci(this,"entriesByField",new Map);ci(this,"entryByElement",new WeakMap);ci(this,"filter");ci(this,"count",0);ci(this,"dependencies",null);ci(this,"islandRoots",[]);ci(this,"ownersByIsland",new Map);ci(this,"navigationRoots",[]);ci(this,"coverDeclarations",[]);ci(this,"renderedDeclarations",[]);this.filter=e.filter??be}dependencyMap(){if(null!==this.dependencies)return this.dependencies;let e=[];for(let t of this.values())void 0!==t.dependsOn&&e.push(ce(t.fieldName,t.dependsOn));return this.dependencies=de(...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(_n))void 0!==this.add(t)&&(i+=1);return this.islandRoots=function(e){let t=[];for(let i of e.querySelectorAll(vn))he(i)||t.push(i);return t}(e),this.ownersByIsland=new Map(this.islandRoots.map(e=>[e,ge(e)])),this.navigationRoots=[...e.querySelectorAll(Bn)].filter(e=>this.filter(e)&&(e.hasAttribute(Qi)||0===(e.getAttribute(yn)??"").length)),this.coverDeclarations=[...e.querySelectorAll(`[${xn}]`)].filter(e=>this.filter(e)).map(e=>({paths:ue(e.getAttribute(xn)),owner:ge(e)})),this.renderedDeclarations=[...e.querySelectorAll(`[${Pn}]`)].filter(e=>this.filter(e)).flatMap(e=>{let t=function(e){if((e.getAttribute(Qi)??"").length>0)return"fragment";let t=e.getAttribute(Un);return null!==t?"route"===t?"route":void 0:e.hasAttribute(yn)&&null!==e.closest("head")?"route":void 0}(e);return void 0===t?[]:[{strategy:t,paths:ue(e.getAttribute(Pn)),owner:ge(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(yn);if(null===t||0===t.length)return;let i=e.getAttribute(bn),n=e.getAttribute(wn),r=e.getAttribute(Sn),s=e.getAttribute(kn),a=e.getAttribute(An),l=e.getAttribute(Tn),o=e.getAttribute(Rn),u=e.getAttribute(Cn),d=e.getAttribute($n),c=ge(e),h=ue(e.getAttribute(Pn)),f=e.getAttribute(Un),p=e.getAttribute("data-payload-guessed"),g=U(e);return{element:e,fieldName:t,fieldType:ye(e),explicitFieldType:null!==i&&me(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!==u&&u.length>0?{locale:u}:{},...null!==d&&d.length>0?{format:d}:{},...void 0!==c?{owner:c}:{},...h.length>0?{dependsOn:h}:{},...null!==f&&f.length>0?{strategy:f}:{},...e.hasAttribute(En)?{hidesWhenEmpty:!0}:{},...null!==p?{guessed:p}:{}}}},qn=64,Vn=1e4,Hn=1e3,Gn=64,Jn=8192,Kn=1048576,Qn=1e4,Xn=20,Zn=new Set(["__proto__","constructor","prototype"]),Yn=new Error,er=class{constructor(e){ci(this,"serverURL");ci(this,"apiRoute");ci(this,"depth");ci(this,"fetchFn");ci(this,"log");ci(this,"timeoutMs");ci(this,"inflight",null);ci(this,"attempt",0);ci(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);let r=e.timeoutMs??0;this.timeoutMs=r>0&&r<Number.POSITIVE_INFINITY?r:void 0}canMerge(e){try{let t=e.schema;return void 0!==t?(Ne(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 Pe(t)?{path:`globals/${encodeURIComponent(t)}`,field:"globalType",value:t}:null;let i=e.collectionSlug??"",n=e.data.id;return Pe(i)&&Ue(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,r,s=null,a=!1,l=()=>this.attempt!==t,o=this.timeoutMs,u=!1,d=(e,t)=>void 0===o?e:(void 0===r&&(r=new Promise((e,i)=>{n=setTimeout(()=>{u=!0,t.abort(),i(Yn)},o)}),r.catch(()=>{})),Promise.race([e,r]));try{if(i?.abort(),l())return{status:"superseded"};let t=e.schema;if(a=void 0!==t,void 0!==t){let i=Ne(e.data,t,this.serverURL,this.apiRoute,this.depth,e.locale);if(l())return{status:"superseded"};if(0===i.requests.length)return{status:"merged",doc:i.doc};let n=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(l())return{status:"superseded"};if(void 0===n)return{status:"unavailable"};s=new AbortController,this.inflight=s;for(let e of i.requests){let t=await d(n(e.url,{method:"GET",credentials:"include",redirect:"error",signal:s.signal}),s);if(l())return{status:"superseded"};let i=t.ok;if(l())return{status:"superseded"};if(!i){let e=t.status;return l()?{status:"superseded"}:(s.abort(),l()?{status:"superseded"}:(this.log("merge HTTP",e),l()?{status:"superseded"}:{status:"unavailable"}))}let r=await d(Me(t,s.signal,()=>!l()),s);if(l())return{status:"superseded"};if(Oe(e,r),l())return{status:"superseded"}}return{status:"merged",doc:i.doc}}let n=this.endpointOf(e);if(l())return{status:"superseded"};if(null===n)return{status:"unavailable"};let r=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(l())return{status:"superseded"};if(void 0===r)return{status:"unavailable"};let o=JSON.stringify({data:e.data,depth:this.depth,flattenLocales:!1,locale:e.locale});if(l())return{status:"superseded"};s=new AbortController,this.inflight=s;let u=`${this.serverURL}${this.apiRoute}/${n.path}`,c=await d(r(u,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","X-Payload-HTTP-Method-Override":"GET"},body:o,signal:s.signal}),s);if(l())return{status:"superseded"};let h=c.ok;if(l())return{status:"superseded"};if(!h){let e=c.status;return l()?{status:"superseded"}:(this.log("merge HTTP",e,u),l()?{status:"superseded"}:{status:"unavailable"})}let f=c.json.bind(c);if(l())return{status:"superseded"};let p=await d(f(),s);if(l())return{status:"superseded"};if(null===p||"object"!=typeof p||Array.isArray(p))return this.log("merge invalid",u),l()?{status:"superseded"}:{status:"unavailable"};let g=p,m=g[n.field],v=Object.hasOwn(g,n.field)&&("id"===n.field?!Ue(m)||String(m)!==n.value:m!==n.value);return l()?{status:"superseded"}:v?(this.log("merge invalid",u),l()?{status:"superseded"}:{status:"unavailable"}):{status:"merged",doc:g}}catch(e){return l()?{status:"superseded"}:u?(this.log("merge timeout",o),{status:"unavailable"}):a&&(s?.abort(),l())?{status:"superseded"}:(this.log("merge exception",a?new Error("legacy population could not be resolved"):e),l()?{status:"superseded"}:{status:"unavailable"})}finally{clearTimeout(n),this.inflight===s&&(this.inflight=null)}}destroy(){this.attempt+=1;let e=this.inflight;this.inflight=null,this.destroyDepth+=1;try{e?.abort()}finally{this.destroyDepth-=1}}},tr="2.3.1",ir={name:"payload-2",fieldTyping:"schema",populatesRelationships:"admin",documentEvents:!1},nr={name:"payload-3",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!0},rr={name:"unknown",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!1},sr="ssr",ar=1,lr=[yn,Ln,xn,Pn],or=`[${yn}], [${xn}], ${vn}, ${Bn}`,ur=class{constructor(e,t={}){ci(this,"callbacks");ci(this,"debounceMs");ci(this,"rootMargin");ci(this,"visible",new Set);ci(this,"mutation",null);ci(this,"intersection",null);ci(this,"debounceTimer",null);ci(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:[...In,xn,mn,sr]})}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=xe(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===mn||"attributes"===t.type&&null!==t.attributeName&&(lr.includes(t.attributeName)||In.includes(t.attributeName)&&t.target.nodeType===ar&&t.target.hasAttribute(yn)))return!0;for(let e of t.addedNodes)if(Ie(e))return!0;for(let e of t.removedNodes)if(Ie(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}},dr=class{constructor(e){pi(this,pr);pi(this,cr,[]);pi(this,hr);pi(this,fr,!1);gi(this,hr,e)}get closed(){return fi(this,fr)}own(e){fi(this,fr)?mi(this,pr,gr).call(this,e):fi(this,cr).push(e)}close(){if(fi(this,fr))return;gi(this,fr,!0);let e=fi(this,cr).splice(0).reverse();for(let t of e)mi(this,pr,gr).call(this,t)}},cr=new WeakMap,hr=new WeakMap,fr=new WeakMap,pr=new WeakSet,gr=function(e){try{e()}catch(e){fi(this,hr).call(this,"runtime cleanup failed:",e)}},mr="__livePreviewHydration",vr="[data-payload-field]",yr="__vue_app__",br="__livePreviewVueHydration",wr="app:suspense:resolve",Sr="__livePreviewHydrated",kr={react:(e,t)=>function(e,t=5e3){je();let i=_e();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?.(vr)}(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)&&Be(i)};i.onCommit=e;for(let t of i.commits.splice(0))e(t)}return De(i,e,t)}(t),vue:function(e,t,i=5e3){Ve();let n=ze();return void 0===n?null:(!n.committed&&function(e){for(let t=e.querySelector(vr);null!==t;t=t.parentElement)if(void 0!==qe(t))return!0;return!1}(e)&&Be(n),De(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()&&Be(s)});a.observe(n,{childList:!0,subtree:!0});let l=De(s,e=>{a.disconnect(),t(e)},i);return()=>{a.disconnect(),l?.()}},manual:function(e,t,i=5e3){let n=function(){if(typ','eof window>"u")return;let e=window;return e[Sr]??(e[Sr]={committed:!1,waiters:[]})}();return void 0===n?null:De(n,t,i)}},Ar={react:"React commit",vue:"Vue mount",sveltekit:"SvelteKit mount",manual:"markHydrated() call"},Tr=class{constructor(e){ci(this,"timeoutMs");ci(this,"onTimeout");ci(this,"handle",null);ci(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}},Rr=class{constructor(){ci(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)}},Cr=class{constructor(e,t,i){ci(this,"deps",e);ci(this,"state",t);ci(this,"host",i);ci(this,"awaitingHydration",new WeakSet);ci(this,"delivered",new WeakMap);ci(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=ge(a);if(!r())return;if(!1!==n&&!j(i,n)){this.awaitingHydration.delete(a);continue}let l=this.confirmation(a,e);if(pe(a))this.awaitingHydration.add(a);else{if(this.awaitingHydration.delete(a),s.has(a))continue;s.add(a),Xe(e,t,[a],r,l)}}}hasLateRouteBinding(e,t,i,n){for(let n of e){if((n.getAttribute(yn)??"").length>0||"route"!==n.getAttribute(Un)||!1!==t&&!j(ge(n),t))continue;let e=ue(n.getAttribute(Pn));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=L(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}},$r="payload-live-preview",Fr=Symbol.for("payload-live-preview.trusted-types"),Nr="__payloadLivePreviewDeprecationsWarned",Mr=new Set,Or="data-payload-",Lr=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"]),Pr=new Set(["input","button","textarea","select","option","label"]),Ur=new Set(["script","style","iframe","object","embed","link","meta","base","form","input","button","select","textarea","svg","math","template","frame","frameset","noframes","noscript"]),Er=new Set(["id","class","lang","dir","title","role","tabindex"]),xr="aria-",Ir="data-",_r="data-payload-",jr={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"])},Br=new Set(["href","src","cite","poster","action","formaction"]),Wr=6,Dr=1,zr=8,qr=(Error,new Set(["id","name","data-payload-key","data-payload-morph","data-payload-nested-key","data-payload-nested-template"])),Vr="strict",Hr=(Object.freeze({allowedTags:Lr,removeCompletely:Ur,globalAttributes:Er,attributesByTag:jr,urlAttributes:Br}),Object.freeze({"&":"&","<":"<",">":">",\'"\':""","\'":"'","/":"/","`":"`","=":"="})),Gr=/[&<>"\'/`=]/g,Jr=Object.freeze({"&":"&","<":"<",">":">",\'"\':""","\'":"'"}),Kr=/[&<>"\']/g,Qr=new Set,Xr={kind:"merge"},Zr=class{constructor(e,t,i){ci(this,"deps",e);ci(this,"state",t);ci(this,"strategies");ci(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=J(e,n,void 0),a=Q(e,i,n,s),l=[];for(let e of t){if(en.has(e))continue;let t=a(e);if("none"===t&&l.push(e),"below"!==t||void 0===r)continue;let n=K(e,i),{previous:o,next:u}=r;for(let{path:t}of G(n,o[e],u[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:()=>(S("route refreshes"),Promise.resolve()),refreshAfterSave:()=>{},warnFragmentFallback:i=>{S("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 Cr(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,n.warn);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,u=a.schema,d=a.schemaIndex;Array.isArray(e.fieldSchemaJSON)&&(u=e.fieldSchemaJSON,d=function(e,t=""){let i=new Map;return T(e,t,i,!1),T(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:u,schemaIndex:d,receivedAt:Date.now(),forceRender:null!==h||re(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=u,a.schemaIndex=d,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&&(S("auto-binding"),!r.isCurrent(e)))return;let s=de(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?Qr:a.invalidated,e.touched=i?Qr: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,Xr),r.fields):null}async applyMerged(e,t){let{state:i}=this,n=await t;"unavailable"===n.status&&i.display.shortfall(e,Xr),"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,u=n.strategies.route;if(s&&void 0!==u&&!e.routeRefreshed&&this.navigationReplay.hasLateRouteBinding(i,l,e,t)){a()&&this.strategies.refreshRoute(e,t,u);return}let d=!s&&this.strategies.hasUnboundChange(e,l),c=r.routeRefreshOwed;if(!s&&void 0!==u&&!e.routeRefreshed&&(d||c||this.strategies.plansRoute(u,e,l))&&a()){r.routeRefreshOwed=!1,this.strategies.refreshRoute(e,t,u);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,u]of n.cache.entries()){if(!a())return;for(let d of u){if(void 0!==i&&!i.has(d.element)||!1!==l&&!j(d.owner,l))continue;if(!0===f?.covers(d)){if(n.revealEditedField){let i=L(t.fields,d,o,e.locale);r.revealLedger.note(e,d,i)}continue}let u=d.strategyKind??E(d.element)??"unknown";if("unknown"===u){this.strategies.warnUnsupportedStrategy(d);continue}"fragment"===u&&null===f&&this.strategies.warnFragmentFallback(d);let c=L(t.fields,d,o,e.locale);if(void 0===c){r.absentFields.add(o);continue}if(t.fields,e.navigated,!s&&n.revealEditedField&&r.revealLedger.note(e,d,c),!a())return;let h=yt(n,d,c,t.fields,a);if(!a())return;let m=p?P(d,h,t.fields,e.locale):void 0,v=r.lastAppliedIdentity.get(d.element);if(!e.forceRender&&n.skipUnchanged&&void 0!==m&&v===m&&!e.invalidated.has(o)){r.skippedUnchangedCount+=1;continue}let y={target:d,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=Q(e,t,i,J(e,i,n));return e=>"none"!==r(e)}(s,n,r,a);for(let[e,t]of Object.entries(i)){if(en.has(e))continue;if(Ye(t)){Ze(l,o,e,n,t);continue}if(!tt(t)||o(e)||et(t))continue;let i=K(e,n);for(let[e,r]of Object.entries(t))!Ye(r)||en.has(e)||Ze(l,o,`${i}.${e}`,n,r)}if("declared"!==e.subfieldCoverage)return;let u=function(e,t,i,n,r){let s=J(e,n,r),a=Q(e,i,n,s),l=[];for(let[e,n]of Object.entries(t)){if(en.has(e)||"below"!==a(e))continue;let t=K(e,i);l.push(...G(t,void 0,n,s))}return l}(s,i,n,r,a);for(let{path:e,value:t}of u)if(Ye(t)&&Ze(l,o,e,n,t),tt(t)&&!et(t))for(let[i,r]of Object.entries(t))Ye(r)&&Ze(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)||!w(s.revision,n))return;i.display.deferred(s,e.deferred),0===s.pendingFragments&&i.complete(s);let a=()=>i.isCurrent(s)&&w(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{ae(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":ae(this.state.revealer,t)}documentSaved(){this.strategies.refreshAfterSave()}},Yr=class{constructor(e,t){ci(this,"apply");ci(this,"debounceMs");ci(this,"maxWaitMs");ci(this,"isVisible");ci(this,"gateThresholdValue");ci(this,"gateDisabled");ci(this,"getCacheSize");ci(this,"onFlush");ci(this,"scheduleFrame");ci(this,"cancelFrame");ci(this,"pending",new Map);ci(this,"replay",new Map);ci(this,"activeFlushes",new Set);ci(this,"debounceTimer",null);ci(this,"debounceToken",0);ci(this,"deadlineTimer",null);ci(this,"frameHandle",null);ci(this,"frameFallback",null);ci(this,"frameToken",0);ci(this,"windowUntil",0);ci(this,"activeRevision",null);ci(this,"activeRevisionCancelled",!1);ci(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||!w(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&&w(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||!w(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)||bt(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&&w(e.revision,this.activeRevision)}didApply(e){return!1!==this.apply(e)||!function(e){return Gi.has(e)}(this.apply)}retargetBuffer(e,t){let i=e.get(t.element);if(void 0!==i){if(!ve(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)}},es=[0,500,1e3,2e3],ts=class{constructor(e){ci(this,"deps");ci(this,"state",new fn);ci(this,"pipeline");ci(this,"writer");ci(this,"rootSentinel",null);ci(this,"scope",null);ci(this,"closingSession",!1);ci(this,"observedRoot",null);ci(this,"replayRetainedOnStart",!1);let{emitter:n,renderers:s}=e,a=void 0===e.log?i:t(e.log),l=void 0===e.warn?yi: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 u=new zn({filter:e=>!function(e){let t=e;for(;null!==t;){if(fe(t))return!0;t=t.parentElement}return!1}(e)}),d=new ur({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 Yr(F(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=>d.isVisible(e),getCacheSize:()=>u.elementCount,onFlush:e=>{this.pipeline.onFlush(e)}}),h=new Ui(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,l),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:u,observers:d,scheduler:c,bus:h,connection:new Rr,heartbeat:new Tr({...void 0!==e.heartbeatMs?{timeoutMs:e.heartbeatMs}:{},onTimeout:()=>{this.onHeartbeatTimeout()}}),renderers:s,resolveRenderer:e.resolveRenderer??(e=>s[e]),transformValue:e.transformValue,renderRichText:e.renderRichText,internalLinkPattern:e.internalLinkPattern,routeAfterSave:!0===e.routeAfterSave,sanitizerPolicy:e.sanitizerPolicy,root:o,readyTargets:"function"==typeof e.readyTargets?e.readyTargets:(e=>()=>e)(e.readyTargets),sendReady:e.sendReady??A,onHeartbeatTimeout:e.onHeartbeatTimeout,log:a,warn:l,a11y:k(e),serverURL:f?.serverURL,merger:void 0===f?null:new er({...f,log:a}),mergeWindowMs:e.debounceMs??50,scopeBindingsByOwner:!0===e.scopeBindingsByOwner,subfieldCoverage:e.subfieldCoverage??"descendant",coverageByDefault:void 0===e.subfieldCoverage,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 pn(this.deps,this.state),this.pipeline=new Zr(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?je():"vue"===e.hydration&&Ve();let{root:t}=e;if(!Je(t)||"loading"!==t.readyState){He(e);return}let i=()=>{e.isRunning()&&e.later(()=>{He(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=Je(t.root)?Ke(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 es){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 dr(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;!Je(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()||!Je(e))return!1;let t=Ke(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,u=[];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&&u.push({field:e,matched:i.guessed,attribute:i.targetAttribute??("IMG"===i.element.tagName?"src":void 0)})}return{version:tr,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:Ee(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:u.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&&ve(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}},is=/^https?:\\/\\/(localhost|127\\.0\\.0\\.1)(?::\\d+)?$/i,ns=/^https?:\\/\\/[^/?#\\s]+$/i,rs=[3e3,3001,3333,4e3,4321,5e3,5173,5174,8e3,8080,8888,9e3],ss=class{constructor(e={}){pi(this,as);let t=new Set;for(let i of e.additionalOrigins??[]){let e=wt(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}());gi(this,as,[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!==fi(this,as)[4]?e===fi(this,as)[4]:!!(fi(this,as)[0].has(e)||0===fi(this,as)[0].size&&void 0!==fi(this,as)[1]&&e===fi(this,as)[1]||fi(this,as)[2]&&is.test(e)))}lockOrigin(e){return!!this.matches(e)&&(fi(this,as)[4]=e,!0)}unlockOrigin(){let e=fi(this,as)[4];return fi(this,as)[4]=void 0,e}get lockedOrigin(){return fi(this,as)[4]}enumerate(){if(void 0!==fi(this,as)[4])return[fi(this,as)[4]];let e=new Set(fi(this,as)[0]);0===fi(this,as)[0].size&&void 0!==fi(this,as)[1]&&e.add(fi(this,as)[1]);let t=fi(this,as)[5];if(fi(this,as)[2]&&void 0!==t)is.test(t)&&e.add(t);else if(fi(this,as)[2])for(let t of rs)e.add(`http://localhost:${String(t)}`),e.add(`http://127.0.0.1:${String(t)}`);return[...e]}get referrerWasAvailable(){return fi(this,as)[3]}get isProductionUnconfigured(){return!(!ie()||fi(this,as)[0].size>0||fi(this,as)[2]||void 0!==fi(this,as)[1])}get isReferrerOnlyTrust(){return!(fi(this,as)[0].size>0||fi(this,as)[2])&&void 0!==fi(this,as)[1]}},as=new WeakMap,ls="astro:page-load",os="astro:after-swap",us={1:"left",2:"center",3:"right",4:"justify"},ds=new Set(["left","center","right","justify","start","end"]),cs=new Set(["h1","h2","h3","h4","h5","h6"]),hs=/\\{(slug|id|collection|locale)\\}/gu,fs=\' target="_blank" rel="noopener noreferrer"\',ps=(e,t)=>{let i=t.renderChildren(e.children??[]),n=Rt(e.fields),r=function(e,t,i){if("internal"===t?.linkType)return function(e,t){let i=Rt(e),n=Rt(i?.value),r=n?.url;if("string"==typeof r&&r.length>0)return r;let s=void 0===t.internalLinkPattern?void 0:function(e,t){let i=e=>{let i=t[e];return"string"==typeof i&&i.length>0||"number"==typeof i?encodeURIComponent(i):void 0};for(let[,t=""]of e.matchAll(hs))if(void 0===i(t))return;return e.replace(hs,(e,t)=>i(t)??"")}(t.internalLinkPattern,{slug:n?.slug,id:void 0===n?i?.value:n.id,collection:i?.relationTo,locale:t.locale});if(void 0!==s)return s;let a=n?.slug;return"string"==typeof a&&a.length>0?`/${a}`:void 0}(t.doc,i);let n=t?.url??e.url;return"string"==typeof n&&n.length>0?n:void 0}(e,n,t);if(void 0===r||!C(r))return i;let s="string"==typeof e.title?` title="${ht(e.title)}"`:"";return`<a href="${ft(r)}"${function(e,t,i){if(!0===t?.newTab||$(i))return fs;let n="string"==typeof e.target?e.target:"";return""===n?"":"_blank"===n?fs:` target="${ht(n)}"`}(e,n,r)}${s}>${i}</a>`},gs=new Map,ms=".lp-block:empty,.lp-inline-block:empty",vs={text:e=>{let t=ht("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${At(e)}${Tt(e)}>${i}</p>`},heading:(e,t)=>{let i="string"==typeof e.tag?e.tag.toLowerCase():"h2",n=cs.has(i)?i:"h2",r=t.renderChildren(e.children??[]);return`<${n}${At(e)}${Tt(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}${At(e)}${Tt(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"}"${Tt(e)}>${i}</li>`;let n="number"==typeof e.value?` value="${ht(String(e.value))}"`:"";return`<li${At(e)}${Tt(e)}${n}>${i}</li>`},link:ps,autolink:ps,quote:(e,t)=>{let i=t.renderChildren(e.children??[]);return`<blockquote${At(e)}${Tt(e)}>${i}</blockquote>`},code:e=>{let t=Ft("string"==typeof e.language?e.language:"");return`<pre><code${""===t?"":` class="language-${t}"`}>${ht(Ot(e))}</code></pre>`},"code-highlight":e=>{let t="string"==typeof e.text?e.text:"";return`<span${"string"==typeof e.highlightType?` class="token-${Ft(e.highlightType)}"`:""}>${ht(t)}</span>`},linebreak:()=>"<br>",horizontalrule:()=>"<hr>",tab:()=>"\\t",upload:e=>{let t=Ct(e.value);if(void 0===t)return"";let i=t.url;if("string"!=typeof i||!C(i))return"";let n="string"==typeof t.mimeType?t.mimeType:"";return n.startsWith("video/")?function(e,t){return`<video controls${Lt(e)}><source src="${ft(t)}"${Pt(e)}></video>`}(t,i):n.startsWith("audio/")?function(e,t){return`<audio controls><source src="${ft(t)}"${Pt(e)}></audio>`}(t,i):""===n||n.startsWith("image/")?function(e,t){let i="string"==typeof e.alt?ht(e.alt):"";return`<img src="${ft(t)}" alt="${i}"${Lt(e)} loading="lazy" decoding="async">`}(t,i):function(e,t){let i="string"==typeof e.filename?ht(e.filename):ht(t);return`<a href="${ft(t)}" target="_blank" rel="noopener noreferrer">${i}</a>`}(t,i)},relationship:e=>{let t="string"==typeof e.relationTo?e.relationTo:"",i=Rt(e.value),n=ht((i&&Mt(i))??`#${t}`),r=Ft(t),s=""===r?\' class="lp-relation"\':` class="lp-relation lp-relation--${r}"`,a=i?.url;return"string"==typeof a&&C(a)?`<a href="${ft(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${At(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}>`}},ys=new Map,bs=!1,ws="data-payload-text",Ss=new Set,ks=new Set,As=new WeakMap,Ts=new Set(["DIV","SECTION","ARTICLE"]),Rs={name:"richText",render:F((e,t,i)=>{let n=e.element;if(gt(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=it(st(s,r));return}if(It(t)){if(oe(t)){n.textContent="";return}let s=new Map,a=[],l=Wt(n,st(function(e,t={}){if(!It(e))return"";let i=function(e){let t={renderChildren:e=>{let i="";for(let n of e)i+=_t(n,t);return i},resolveAlignment:St,resolveIndent:kt,onUnrenderedBlock:e.onUnrenderedBlock,internalLinkPattern:e.internalLinkPattern,locale:e.locale};return t}(t).renderChildren(e.root.children);return!1===t.sanitize?i:void 0!==t.document?rt(i,{document:t.document}):!0===t.requireDocument||void 0!==ot()?rt(i):(function(){if(!bs){bs=!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,internalLinkPattern:i.internalLinkPattern,locale:i.locale,onUnrenderedBlock:(e,t,i)=>{s.set(t,e),a.push(i)}}),r));for(let[t,n]of l){let r=s.get(t);void 0!==r&&zt(e,i,r,n)}!function(e,t,i,n){let r=function(e){try{return JSON.stringify(e,(e,t)=>"object"==typeof t&&null!==t&&"id"in t&&"updatedAt"in t?t.id:t)}catch{return}}(i),s=As.get(e.element);void 0===r?As.delete(e.element):As.set(e.element,r),void 0!==r&&void 0!==s&&r!==s&&[...n.values()].includes(!1)&&t.reportUnfaithful?.(e,"changed a block no renderer draws")}(e,i,a,l);return}if("string"!=typeof t)return!1;n.innerHTML=it(st(t,r))})},Cs={name:"html",render(e,t,i){if(gt(t)){e.element.textContent="";return}let n="string"==typeof t?t:pt(t);e.element.innerHTML=it(st(n,i.sanitizerPolicy))}},$s=new WeakSet,Fs=Vt("url"),Ns=/^[a-zA-Z][a-zA-Z0-9+.-]*:/,Ms=Vt("email",function(e){let t=e.trim();return Ns.test(t)||!t.includes("@")?t:`mailto:${t}`}),Os=["src","srcset","sizes"],Ls=new WeakMap,Ps=/^(?:\\.{0,2}\\/|\\S*[/.:]\\S*$|.*\\.(?:avif|bmp|gif|ico|jpe?g|png|svg|tiff?|webp)$)/i,Us={name:"image",render:F((e,t,i)=>{let n=e.element;if("IMG"===n.tagName&&e.altField===e.fieldName&&void 0===e.srcField&&("string"==typeof t||gt(t))){n.alt=t??"";return}if(gt(t)){Zt(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?M(i.allFields,e.srcField,i.locale,n):t,s=Ct(r);return{media:s,candidate:void 0===s?r:s.url}}(e,t,i,r);if(void 0===s&&"string"==typeof a&&!Ps.test(a.trim()))return!1;let l=qt(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;Jt(t,l.url,s,i.serverURL);let a=function(e,t,i,n,r){if(void 0!==t&&t.length>0){let e=M(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 Zt(n)})},Es={name:"upload",render:F((e,t,i)=>{let n=e.element;if(gt(t)){Yt(n);return}let r=Ct(t);if(void 0===r)return!1;let s=qt(n,e.fieldName,r.url,i.serverURL);if("none"===s.kind)return!1;if("unsafe"===s.kind){Yt(n);return}let a=s.url;if("IMG"===n.tagName){let e=n;Jt(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=ht(r.filename??a);n.innerHTML=it(`<a href="${ft(a)}">${l}</a>`)})},xs={name:"relationship",render(e,t){let i=e.element;if(gt(t))i.removeAttribute("href"),i.textContent="";else{if("A"===i.tagName&&!Array.isArray(t)){let n=qt(i,e.fieldName,Rt(t)?.url);"safe"===n.kind?i.setAttribute("href",n.url):"unsafe"===n.kind&&i.removeAttribute("href")}i.textContent=Array.isArray(t)?t.map(ei).join(", "):ei(t)}}},Is={name:"select",render(e,t,i){let n=e.element,r=gt(t)?[]:function(e){return Array.isArray(e)?e.map(pt):[pt(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=Rt(t);if(void 0!==i&&pt(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)}},_s=new Set(["","false","0","off","no"]),js={name:"checkbox",render(e,t){let i=e.element,n=function(e){return"boolean"==typeof e?e:"string"==typeof e?!_s.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}},Bs=new Map,Ws=new Map,Ds=new Set(["short","medium","long","full"]),zs=new Set(["short","medium","long","full"]),qs=/^[A-Za-z]{3}$/u,Vs=/^[0-4]$/u,Hs=new WeakSet,Gs={name:"date",render(e,t,i){let n=e.element;if(gt(t)){"INPUT"===n.tagName?n.value="":(n.removeAttribute("datetime"),n.textContent="");return}let r="number"==typeof t?t:pt(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=si("date",t.format,t.element,t.fieldName)??Js;try{return function(e,t){let i=ti(e,t);return mt(Ws,i)??vt(Ws,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")}-${ai(t.getMonth()+1)}-${ai(t.getDate())}`,n=`${ai(t.getHours())}:${ai(t.getMinutes())}`;return"date"===e?i:"datetime-local"===e?`${i}T${n}`:"time"===e?n:t.toISOString()}(n.type,s):l}},Js={dateStyle:"medium",timeStyle:"short"},Ks={name:"number",render(e,t,i){let n=e.element;if(gt(t)){"INPUT"===n.tagName?n.value="":n.textContent="";return}let r="number"==typeof t?t:Number(pt(t));Number.isNaN(r)?n.textContent=pt(t):"INPUT"!==n.tagName?n.textContent=function(e,t,i){let n=t.locale??i.locale??d(),r=si("number",t.format,t.element,t.fieldName);try{return function(e,t){let i=ti(e,t);return mt(Bs,i)??vt(Bs,i,new Intl.NumberFormat(e,t),64)}(n,r).format(e)}catch{return String(e)}}(r,e,i):n.value=String(r)}},Qs=new Map;!function(){if(typ','eof window>"u"||!ie()&&(typ','eof window>"u"||null==window.opener))return;let e=window.__livePreview,t=JSON.stringify(oi());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,u=!0,d=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,M,O]=oi(),L=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),P=new ss({additionalOrigins:i,enableReferrerDetection:!p,enableLocalhostMatching:!g});P.isProductionUnconfigured?yi("[live-preview] LP0101: No trusted origin. Pass allowedOrigins to generateInlineScript() (or to the adapter) \\u2014 the runtime reads no environment variable in the browser."):P.isReferrerOnlyTrust&&yi("[live-preview] LP0102: document.referrer fallback trusts any framing site. Set allowedOrigins and a frame-ancestors CSP in production.");let U=new wi,E=function(){let e=[Rs,Cs,Fs,Ms,Us,Es,xs,Is,{...Is,name:"radio"},js,Gs,Ks,li("array","structural arrays"),li("blocks","structural arrays")];return function(e=[]){let t={};for(let i of e)t[i.name]=i;for(let[e,i]of Qs)t[e]=i;return Object.freeze(t)}([Bt("text"),Bt("textarea"),...e])}(),x=new ts({renderers:E,originMatcher:e=>P.matches(e),lockedOrigin:()=>P.lockedOrigin,readyTargets:()=>P.enumerate(),emitter:U,eventSourcePolicy:y,...""!==n?{dataMerge:{serverURL:n,apiRoute:s,depth:a,...void 0===M?{}:{timeoutMs:M}}}:{},...void 0===O?{}:{internalLinkPattern:O},..."after-save"===k?{routeAfterSave:!0}:{},debounceMs:o,heartbeatMs:d,intersectionRootMargin:f,disableVisibilityGate:c,visibilityGateThreshold:h,enableA11y:u,scopeBindingsByOwner:m,...void 0===N?{}:{subfieldCoverage:N},skipUnchanged:v,revealEditedField:S,onUnfaithfulPatch:r({onUnfaithfulPatch:T,onUnboundChange:A}),autoBind:R,...void 0!==C?{hydration:C}:{},sanitizerPolicy:b,...void 0!==L?{strategies:L}:{},onHeartbeatTimeout:()=>{P.unlockOrigin()},...l?{log:(...e)=>{bi("[live-preview]",...e)}}:{}});U.on("connect",e=>{P.lockOrigin(e.origin)}),x.start(),e?.destroy();let I=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},u=t=>{if(t.type===ls){if(!l)return;l=!1}void 0===e.refreshAfterNavigation?e.refreshCache():e.refreshAfterNavigation()},d=!1;i?.addEventListener("pagehide",s),i?.addEventListener("pageshow",a);for(let e of r)n?.addEventListener(e,u);let c=r.includes(ls);return c&&n?.addEventListener(os,o),()=>{if(!d){d=!0,i?.removeEventListener("pagehide",s),i?.removeEventListener("pageshow",a);for(let e of r)n?.removeEventListener(e,u);c&&n?.removeEventListener(os,o)}}}({suspend:()=>x.suspend(),resume:()=>x.start(),refreshCache:()=>{x.refreshCache()},refreshAfterNavigation:()=>{x.navigationCommit()}},{softNavigationEvents:F}),_=Object.freeze({version:tr,configSignature:t,destroy:()=>{I(),x.destroy();let e=window;e.__livePreview===_&&delete e.__livePreview},refresh:()=>{x.refreshCache()},refreshAfterNavigation:()=>{x.navigationCommit()},enumerateOrigins:()=>P.enumerate(),inspect:()=>x.inspect()});try{Object.defineProperty(window,"__livePreview",{value:_,writable:!1,configurable:!0})}catch(e){throw I(),x.destroy(),e}}()})();'].join(""),t=Object.freeze({profile:"lean",source:e,contentHash:"06728d8640e9d5be",integrity:"sha384-01MIkgq6CDBPGpE0pIMn1n9LAbeNC/gshWmxXUdHCXZrX4D352b9sNMGv59PWCmA"});export{t as LEAN_RUNTIME};
|
|
1
|
+
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),u=Date.now(),d=void 0!==l&&("escalate"!==a||void 0===o||o===l.identity||u-l.at<Fi);if((d||"escalate"!==a)&&t.display.shortfall(t.activeUpdate,{kind:"unfaithful",field:i.fieldName}),!d){if(t.reportedUnfaithful.set(i.element,{identity:o,at:u}),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"select"===e||"radio"===e}function o(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value:e.textContent}function u(e){let t=e.trim();return JSON.stringify(t.length>Mi?`${t.slice(0,Mi)}\\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 c(e){if(++e.nodes>1e4)throw new Error("invalid or oversized field schema")}function h(e,t,i){if(c(t),i>64||t.active.has(e))throw new Error("invalid or oversized field schema");t.active.add(e)}function f(e){try{return p(e,{nodes:0,active:new WeakSet},0)}catch{return[]}}function p(e,t,i){if(!Array.isArray(e))return[];h(e,t,i);let n=[];for(let r of e){let e=g(r,t,i);e&&n.push(e)}return t.active.delete(e),n}function g(e,t,i){if(c(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=p(n.fields,t,i+1),l=function(e,t,i){if("object"==typeof e&&null!==e&&!Array.isArray(e)){h(e,t,i);let n=[];for(let r in e){if(!Object.hasOwn(e,r))continue;c(t);let s=Reflect.get(e,r);"object"!=typeof s||null===s||["__proto__","constructor","prototype"].includes(r)||n.push({...s,slug:r,fields:p(s.fields,t,i+1)})}return t.active.delete(e),n}if(!Array.isArray(e))return[];h(e,t,i);let n=[];for(let r of e){if(c(t),"object"!=typeof r||null===r)continue;let e=r,s=e.slug;if("string"!=typeof s||0===s.length)continue;let a=p(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},u=n.relationTo;if(Array.isArray(u)){let e=[];for(let i of u)c(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 m(e,t){return void 0===e||t(e)}function v(e,t){return null==e||t(e)}function y(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}function b(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 Pi)(n>=Li[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 w(e,t){return e.generation===t.generation&&e.revision===t.revision}function S(e){xi.has(e)||(xi.add(e),yi(`[live-preview] LP0104: this page carries the lean runtime, which leaves out ${e} (${Ei[e]}). The elements are left as the server rendered them. Remove \\`runtime: LEAN_RUNTIME\\` to get the full runtime.`))}function k(e){return function(e){return!1!==e.enableA11y&&S("screen-reader announcements"),null}(e)}function A(e){if(typ','eof window>"u")return;let t=[];window.parent!==window&&t.push(window.parent),window.opener instanceof Window&&t.push(window.opener),Ui.sendReady(t,e)}function T(e,t,i,n){for(let r of e){if(Ii.has(r.type)){let e=r.fields;e&&T(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&&T(r.fields,e,i,n);else if("array"===r.type&&r.fields)T(r.fields,`${e}.*`,i,n);else if("blocks"===r.type&&r.blocks)for(let t of r.blocks)T(t.fields,`${e}.*.${t.slug}`,i,n)}}function R(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 C(e){if("string"!=typeof e)return!1;let t=e.trim().replace(Di,"");if(0===t.length)return!1;if(t.startsWith("#")||t.startsWith("?")||Wi.test(t)||t.startsWith("/"))return!0;try{let e=new URL(t);return ji.has(e.protocol)}catch{return Bi.test(t)&&!function(e){let t=qi.exec(e.replace(zi,""))?.[1];return void 0!==t&&!ji.has(`${t.toLowerCase()}:`)}(t)}}function $(e){let t=e.trim().replace(Di,"");return/^https?:\\/\\//i.test(t)||Wi.test(t)}function F(e){return Gi.add(e),e}function N(){return!0}function M(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(Ki.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(!Ki.has(t)&&Object.prototype.hasOwnProperty.call(e,t))return e[t]}function L(e,t,i,n){return M(e,i,t.locale??n,void 0!==t.locale)}function P(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(L(i,e,t,r));if(void 0===s)return;l+=`|${t}=${s}`}return l}function U(e){return e.closest(`[${Qi}]`)}function E(e){let t=e.getAttribute(Xi);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 I(e,t){return void 0===t||""===t?`collection:${e}`:`collection:${e}:${t}`}function _(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 W(e){return"object"==typeof e&&null!==e}function D(e){return Array.isArray(e)?"array":W(e)?"object":"scalar"}function z(e,t){return W(e)?e[t]:void 0}function q(e,t){return("string"==typeof t||"number"==typeof t)&&W(e)&&!Array.isArray(e)&&e.id===t}function V(e,t){if(!W(e)||!W(t))return q(e,t)||q(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)&&V(z(e,i),z(t,i)))}function H(e,t){let i=n(t),r=n(e);return!!(void 0!==i&&i===r||q(e,t)||q(t,e))||void 0!==i&&void 0!==r&&V(e,t)}function G(e,t,i,n){let r=[],s=0,a=(e,t,i,l)=>{if(s+=1,n.covers(e)||H(t,i))return;if(!((void 0===t||D(t)===D(i))&&W(i)&&n.reachesBelow(e)&&l<Zi)){r.push({path:e,value:i});return}let o=function(e,t){let i=new Set(Object.keys(t));if(W(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>=Yi){r.push({path:e,value:i});return}a(`${e}.${n}`,z(t,n),z(i,n),l+1)}};return a(e,t,i,0),r}function J(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 K(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 Q(e,t,i,n=J(e,i)){let r,s=n.covers,a=n.reachesBelow;return n=>{let l=K(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 X(e,t,i,n,r){return ee(i)?!ee(t)||function(e,t,i){let n=void 0===i?void 0:R(i,e);return void 0!==n&&!tn.has(n.type)||!0===t.get(e)?.some(Z)||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 Z(e){return!tn.has(e.fieldType)}function Y(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(!nn.has(n)||"internal"===r?.linkType)return!0;if(Array.isArray(s))for(let e of s)t.push(e)}return!1}function ee(e){return null===e||"object"!=typeof e&&"function"!=typeof e}function te(e){return!0===e?.includes(".")}function ie(){if(typ','eof window>"u")return!1;try{return window.self!==window.top}catch{return!0}}function ne(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 re(e){return null!==e&&e.forceRender&&!e.completed}function se(e){try{return!0===e.matchMedia?.("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function ae(e,t){let i=t.element.ownerDocument.defaultView;return null===i?"no-element":e.reveal(`${t.owner??""} ${t.fieldName}`,t.element,i)}function le(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 oe(e){return!!le(e)&&e.root.children.every(e=>{let{type:t,children:i}=e??{};return"paragraph"===t&&(!Array.isArray(i)||0===i.length)})}function ue(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 de(...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 ce(e,t){let i={};for(let n of t)n!==e&&(i[n]=[e]);return i}function he(e){return"patch"===e.getAttribute(mn)}function fe(e){return function(e){return"astro-island"===e.tagName.toLowerCase()||e.hasAttribute(mn)}(e)&&!he(e)}function pe(e){return"astro-island"===e.tagName.toLowerCase()&&e.hasAttribute("ssr")}function ge(e){let t=e.closest(jn)?.getAttribute(Ln);return null==t||0===t.length?void 0:t}function me(e){return Dn.has(e)||Wn.test(e)}function ve(e,t){return e.fieldName===t.fieldName&&e.locale===t.locale&&e.owner===t.owner&&e.strategyKind===t.strategyKind&&e.fragmentBoundary===t.fragmentBoundary}function ye(e){let t=e.getAttribute(bn);if(null!==t&&me(t))return t;if(e.hasAttribute(Fn))return"richText";if(e.hasAttribute(Nn))return"html";if(e.hasAttribute(On))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 be(){return!0}function we(){throw new Error("invalid or oversized legacy population")}function Se(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 ke(e,t){if("string"!=typeof e||0===e.length||e.length>t||"."===e||".."===e||e.includes("/")||e.includes("\\\\")||Se(e))return!1;try{return encodeURIComponent(e),!0}catch{return!1}}function Ae(e){return ke(e,128)&&!/[?#%]/u.test(e)&&!Zn.has(e)}function Te(e){return Number.isFinite(e)?String(e):ke(e,512)?e:we()}function Re(e,t){return Object.hasOwn(e,t)?Reflect.get(e,t):void 0}function Ce(e,t,i){Object.defineProperty(e,t,{value:i,writable:!0,configurable:!0,enumerable:!0})}function $e(e){let t=e.length;for(;t>0&&47===e.charCodeAt(t-1);)t-=1;return e.slice(0,t)}function Fe(e){let t=new WeakSet,i=0,n=0;return function e(r,s){if(++i>Vn||s>qn)return we();if("string"==typeof r)return n+=r.length,n>Kn&&we(),r;if(null==r||"boolean"==typeof r)return r;if("number"==typeof r)return Number.isFinite(r)?r:we();if(!Array.isArray(r)&&!y(r))return we();if(Array.isArray(r)){r.length>Vn&&we();for(let e=0;e<r.length;e+=1)Object.hasOwn(r,e)||we()}if(t.has(r))return we();t.add(r);let a=Array.isArray(r)?[]:{};for(let t of Object.keys(r))Ce(a,t,e(Reflect.get(r,t),s+1));return t.delete(r),a}(e,0)}function Ne(e,t,i,n,r,s){function a(e,t,i,n){if(null==n||""===n)return;let s=y(n)?Re(n,"id"):n,a=Te(s);if(0===r){Ce(e,t,s);return}let l=JSON.stringify([i,a]);c.add(l),c.size>Hn&&we();let o=d.get(i)??[];o.push({owner:e,key:t,id:a}),d.set(i,o)}function l(e,t,i){void 0!==i.hasMany&&"boolean"!=typeof i.hasMany&&we();let n=i.relationTo,r=Re(e,t);if(Array.isArray(n)){0===n.length&&we();let e,t=y(r)?Re(r,"relationTo"):void 0;for(let i of n)p(0),Ae(i)||we(),i===t&&(e=i);if(null==r||""===r)return;(!y(r)||void 0===e)&&we(),a(r,"value",e,Re(r,"value"))}else Ae(n)||we(),a(e,t,n,r)}function o(e,t){if(p(t),Array.isArray(e)||y(e)){if(y(e)&&Object.hasOwn(e,"relationTo")&&Object.hasOwn(e,"value")){let t=Re(e,"relationTo");Ae(t)||we(),a(e,"value",t,Re(e,"value"));return}for(let i of Object.keys(e))o(Reflect.get(e,i),t+1)}}if(!Number.isSafeInteger(r)||r<0||r>qn)return we();void 0!==s&&("string"!=typeof s||s.length>128||Se(s))&&we();let u=Fe(e);if(!y(u))return we();let d=new Map,c=new Set,h=0,f=new WeakSet,p=e=>{(++h>Vn||e>qn)&&we()};(function e(t,i,n){p(n),f.has(t)&&we(),f.add(t);for(let r of t){p(n),(!y(r)||!ke(r.name,512)||Zn.has(r.name))&&we();let t=Re(i,r.name);if("relationship"===r.type||"upload"===r.type)if(r.hasMany)if(null!=t&&!Array.isArray(t)&&we(),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&&!y(t)&&we(),y(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?Ce(i,r.name,[]):null!=t&&!Array.isArray(t)&&we(),Array.isArray(t))for(let i of t)if(y(i)||we(),"array"===r.type&&r.fields)e(r.fields,i,n+1);else if("blocks"===r.type){let t=Re(i,"blockType"),s=r.blocks?.find(e=>(p(n),e.slug===t));void 0===s&&we(),e(s.fields,i,n+1)}}else"richText"===r.type&&o(t,n+1)}f.delete(t)})(t,u,0),d.size>25&&we();let g=[];if(0===d.size)return{doc:u,requests:g};let m=new URL(i);(!["http:","https:"].includes(m.protocol)||m.username||m.password||m.search||m.hash)&&we(),(!n.startsWith("/")||n.includes("\\\\")||/[%?#]/u.test(n)||Se(n))&&we(),n.split("/").some(e=>"."===e||".."===e)&&we();let v=`${$e(i)}${$e(n)}/`;for(let[e,t]of d){let i=[...new Set(t.map(e=>e.id))],n=0;for(;n<i.length;){let a=i[n];void 0===a&&we();let l=a.includes(","),o=[],u="";for(;n<i.length&&o.length<Xn;){let t=i[n];if(void 0===t||o.length>0&&(l||t.includes(",")))break;let a=[...o,t],d=new URLSearchParams({depth:String(r),limit:String(a.length)});void 0!==s&&d.set("locale",s),d.set(l?"where[id][equals]":"where[id][in]",l?t:a.join(","));let c=`${v}${encodeURIComponent(e)}?${d}`;if(c.length>Jn){0===o.length&&we();break}new URL(c).origin!==m.origin&&we(),o.push(t),n+=1,u=c}(0===o.length||g.length>=Gn)&&we();let d=new Set(o);g.push({url:u,ids:d,slots:t.filter(e=>d.has(e.id))})}}return{doc:u,requests:g}}async function Me(e,t,i){let n,r,s=!1,a=!1,l=Symbol(),o=new Promise(e=>{r=()=>{e(l)}}),u=()=>{(!i()||t.aborted)&&we()},d=()=>{if(void 0!==n&&!s){s=!0;try{Promise.resolve(n.cancel()).catch(()=>{})}catch{}}},c=()=>{r?.(),d()};t.addEventListener("abort",c,{once:!0});try{u();let t=e.body??null;if(u(),null===t){let t=e.json.bind(e);u();let i=await Promise.race([Promise.resolve().then(()=>(u(),t())),o]);return u(),i===l&&we(),i}let i=t.getReader.bind(t);u();let r=i();n=r,u();let s=[],d=0,c=0;for(;;){let e=Promise.resolve().then(()=>{u();let e=r.read.bind(r);return u(),e()}),t=await Promise.race([e,o]);if(u(),t===l&&we(),t.done)break;d+=t.value.byteLength,(++c>Qn||d>Kn)&&we(),s.push(t.value)}a=!0;let h=new Uint8Array(d),f=0;for(let e of s)h.set(e,f),f+=e.byteLength;try{return JSON.parse((new TextDecoder).decode(h))}catch{return we()}}finally{t.removeEventListener("abort",c),a||d();try{n?.releaseLock()}catch{}}}function Oe(e,t){let i=Fe(t);y(i)||we();let n=Re(i,"docs");(!Array.isArray(n)||n.length>Xn)&&we();let r=new Map;for(let t of n){y(t)||we();let i=Te(Re(t,"id"));(!e.ids.has(i)||r.has(i))&&we(),r.set(i,t)}r.size!==e.ids.size&&we();for(let t of e.slots)Ce(t.owner,t.key,r.get(t.id))}function Le(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 Pe(e){return Le(e,128)&&!e.includes("?")&&!e.includes("#")}function Ue(e){return"number"==typeof e?Number.isFinite(e):"string"==typeof e&&Le(e,512)}function Ee(e){return e.has("schema-json")?ir:e.has("document-events")||e.has("relationship-events")?nr:rr}function xe(e){if("attributes"!==e.type||e.attributeName!==sr||e.target.nodeType!==ar)return null;let t=e.target;return"astro-island"!==t.tagName.toLowerCase()||t.hasAttribute(sr)?null:t}function Ie(e){if(e.nodeType!==ar)return!1;let t=e;return t.matches(or)||null!==t.querySelector(or)}function _e(){if(typ','eof window>"u")return;let e=window;return e[mr]??(e[mr]={armed:!1,committed:!1,commits:[],onCommit:void 0,waiters:[]})}function je(){let e=_e();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 Be(e){e.committed=!0;let t=e.waiters;e.waiters=[];for(let e of t)e()}function We(e,t){let i=e.waiters.indexOf(t);i>=0&&e.waiters.splice(i,1)}function De(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,We(e,r),t("timed-out")},i),()=>{null!==n&&clearTimeout(n),n=null,We(e,r)}}function ze(){if(typ','eof window>"u")return;let e=window;return e[br]??(e[br]={armed:!1,committed:!1,waiters:[]})}function qe(e){return Object.prototype.hasOwnProperty.call(e,yr)?e[yr]:void 0}function Ve(){let e=ze();if(void 0===e||e.armed)return;e.armed=!0;let t=Element.prototype;void 0===Object.getOwnPropertyDescriptor(t,yr)&&Object.defineProperty(t,yr,{configurable:!0,get:()=>{},set(e){Object.defineProperty(this,yr,{value:e,writable:!0,configurable:!0,enumerable:!0});let t=ze();void 0===t||t.committed||null===this.querySelector(vr)||function(e,t){let i=t?.$nuxt;!0!==i?.isHydrating||"function"!=typeof i.hook?Be(e):i.hook(wr,()=>{e.committed||Be(e)})}(t,e)}})}function He(e){let t=e.hydration;if(void 0===t){e.startNow();return}let i=kr[t](e.root,i=>{e.later(()=>{Ge(e,t,i)})});null!==i?(e.defer(i),e.hydrated("waiting")):Ge(e,t,"committed")}function Ge(e,t,i){e.hydrated(i),"timed-out"===i&&e.warn(`[live-preview] LP0607: no ${Ar[t]} in ${String(5e3)} ms; started without waiting for hydration.`),e.startNow()}function Je(e){return 9===e.nodeType}function Ke(e){return e.body}function Qe(e,t,i,n){if(!e.scopeBindingsByOwner)return!1;let{message:r}=i,s=function(e){if(_(e.globalSlug))return[x(e.globalSlug)];if(!_(e.collectionSlug))return null;let t=I(e.collectionSlug);return _(e.documentId)?[t,I(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 Xe(e,t,i,n,r){!function(e,t,i){let n=0;for(let r of e)if(!i()||(r.dispatchEvent(new CustomEvent(gn,{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 Ze(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="${K(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 Ye(e){let t=typeof e;return"string"===t||"number"===t||"boolean"===t||"bigint"===t}function et(e){return Array.isArray(e.docs)&&"boolean"==typeof e.hasNextPage}function tt(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function it(e){let t=function(){let e=function(){let e=globalThis,t=e[Fr];if(void 0!==t)return t;let i={};return e[Fr]=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($r,{createHTML:e=>e})}catch{e.auto=null}return e.auto}();return null===t?e:t.createHTML(e)}function nt(e){Mr.has(e)||(Mr.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(Or)?"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 rt(e,t){return st(e,void 0,t)}function st(e,t,i){let n=i?.document??ot();if(!n)throw at();if(""===e)return"";let r=function(e,t){let i=e?.policy??t??Vr;if(!e){let e=new Map;for(let[t,i]of Object.entries(jr))e.set(t,i);return{allowedTags:Lr,attrByTag:e,allowFormControls:!1,templateMode:!1,mode:i,allowedData:new Set}}let n=new Set(Lr);if(e.additionalAllowedTags?.forEach(e=>n.add(e)),!0===e.allowFormControls)for(let e of Pr)n.add(e);let r=new Map;for(let[e,t]of Object.entries(jr))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<Wr;e+=1){let e=n.createElement("template");e.innerHTML=it(s);let t=e.content;ut(t,r);let i=lt(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[Nr]??(i[Nr]=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(Wr)} passes, so it returned an empty string (ADR 0016).`),""}function at(){return new Error("sanitizeHtml needs a DOM")}function lt(e){let t=e.ownerDocument?.createElement("div");if(void 0===t)throw at();let i=e.firstChild;if(t.append(e),t.firstChild!==i)throw at();return t.innerHTML}function ot(){if(!(typ','eof document>"u"))return document}function ut(e,t){for(let i of Array.from(e.childNodes))i.nodeType===Dr?dt(i,t):i.nodeType===zr&&i.remove()}function dt(e,t){let i=e.tagName.toLowerCase();!Ur.has(i)||t.allowFormControls&&Pr.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&&qr.has(r))continue;if("id"===r||"name"===r||r.startsWith(_r)){e.removeAttribute(t.name),("name"!==r||!0===n?.has(r))&&nt(r);continue}if(r.startsWith(Ir)){i.allowedData.has(r)||(e.removeAttribute(t.name),nt(r));continue}if(Er.has(r)||r.startsWith(xr))continue}else if(Er.has(r)||r.startsWith(xr)||r.startsWith(Ir))continue;n?.has(r)?(Br.has(r)&&!C(t.value)||"srcset"===r&&!ct(t.value)||"ping"===r&&!t.value.trim().split(/\\s+/u).every(C))&&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||!$(t)||(e.setAttribute("rel","noopener noreferrer"),e.hasAttribute("target")||e.setAttribute("target","_blank"))}(e),ut(e,t)):(ut(e,t),e.replaceWith(...e.childNodes)):e.remove()}function ct(e){for(let t of e.split(",")){let e=t.trim();if(0===e.length)continue;let[i=e]=e.split(/\\s/,1);if(!C(i)||!C(e))return!1}return!0}function ht(e){return e.replace(Gr,e=>Hr[e])}function ft(e){return e.replace(Kr,e=>Jr[e])}function pt(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 gt(e){return null==e||""===e}function mt(e,t){let i=e.get(t);return void 0!==i&&(e.delete(t),e.set(t,i)),i}function vt(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 yt(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 bt(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 wt(e){let t=e.trim();if(0!==t.length)try{let e=new URL(t);return"http:"!==e.protocol&&"https:"!==e.protocol||!ns.test(e.origin)?void 0:e.origin}catch{return}}function St(e){let t=e.format;return"string"==typeof t&&ds.has(t)?t:"number"==typeof t?us[t]:void 0}function kt(e){let t=e.indent;return"number"==typeof t&&t>0?t:0}function At(e){return"rtl"===e.direction?\' dir="rtl"\':"ltr"===e.direction?\' dir="ltr"\':""}function Tt(e){let t=St(e),i=kt(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 Rt(e){return"object"==typeof e&&null!==e?e:void 0}function Ct(e){return Rt(e)}function $t(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 Ft(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-").toLowerCase()}function Nt(e){return"string"==typeof e&&e.length>0?e:void 0}function Mt(e){let t=Nt(e.title)??Nt(e.name)??Nt(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 Lt(e){return`${"number"==typeof e.width?` width="${String(e.width)}"`:""}${"number"==typeof e.height?` height="${String(e.height)}"`:""}`}function Pt(e){return"string"==typeof e.mimeType?` type="${ft(e.mimeType)}"`:""}function Ut(e){return gs.get(e)}function Et(e,t,i,n){let r=Rt(e.fields)??{},s="string"==typeof r.blockType?r.blockType:"",a=Ft(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,r)}return`<${i} class="${l}"></${i}>`}function xt(e,t){return"number"==typeof t&&t>1?` ${e}="${String(t)}"`:""}function It(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 _t(e,t){let i=function(e){return ys.get(e)??vs[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:F((e,i)=>{let n=e.element,r=function(e){return null==e?"":It(e)?function(e){return It(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(ws))return function(e,t,i){e.has(t)||(e.add(t),yi(`[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=it(function(e){return ht(e).replace(/\\r\\n|\\r|\\n/g,"<br>")}(r));return}n.textContent=r}}else n.value=r})}}function Wt(e,t){let i=e.cloneNode(!1);i.innerHTML=it(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||!Ts.has(i.tagName)||i.hasAttribute(yn)||n?.tagName===i.tagName||!0===n?.matches(ms))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(ms);if(s.length>0&&null!==n.firstElementChild){let e=[];Dt(n,i,e);for(let[t,i]of e)t.replaceWith(i),i.matches(ms)||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 Dt(e,t,i){let n=(e,t)=>{e.matches(ms)?i.push([e,t]):Dt(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(ms)||a.add(e.tagName);let l=(e,t)=>e.matches(ms)?!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 u=Math.min(e.children.length,t.children.length);r=e.lastElementChild,s=t.lastElementChild;for(let e=o;e<u&&null!==r&&null!==s;e+=1){if(!l(s,r))return;n(s,r),r=r.previousElementSibling,s=s.previousElementSibling}}function zt(e,t,i,n){n&&t.reportUnfaithful?.(e,`lost the markup the server drew for block "${i}"`);let r=n?ks:Ss;r.has(i)||(r.add(i),yi(`[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 qt(e,t,i,n){if("string"!=typeof i||0===i.length)return{kind:"none"};let r=$t(i,n);return C(r)?{kind:"safe",url:r}:($s.has(e)||($s.add(e),yi(`[live-preview] LP0401: refused an unsafe URL for "${t}" on <${e.tagName.toLowerCase()}>; the attribute was cleared.`)),{kind:"unsafe"})}function Vt(e,t=e=>e){return{name:e,render(e,i,n){let r=e.element;if(gt(i)){!function(e){"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):e.value=""}(r);return}let s=pt(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):M(n.allFields,i,n.locale,void 0!==e.locale),l=qt(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 Ht(e){for(let t of Os)e.removeAttribute(t);Gt(e)}function Gt(e){if("PICTURE"===e.parentElement?.tagName)for(let t of e.parentElement.querySelectorAll("source"))t.remove()}function Jt(e,t,i,n){let r=function(e,t){let i=[];for(let[n,r]of Object.entries(e?.sizes??e?.variants??{})){if("string"!=typeof r.url||"number"!=typeof r.width)continue;let e=$t(r.url,t);C(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&&Kt(e,t.url,s))??r.find(t=>t.name===Ls.get(e));void 0===a?.name?Ls.delete(e):Ls.set(e,a.name),(null===s||!(Kt(e,t,s)||r.some(t=>Kt(e,t.url,s))))&&Gt(e),e.src=a?.url??t;let l=a??i,o=r.filter(e=>Qt(e,l)),u=o.length>0?o:r.filter(e=>Qt({...e,mimeType:void 0},l));if(0===u.length){e.removeAttribute("srcset"),e.removeAttribute("sizes");return}if("number"==typeof i?.width&&"string"==typeof i.url){let e=$t(i.url,n),t={...i,url:e,width:i.width};C(e)&&Qt(t,l)&&u.push(t)}let d=new Set,c=[];for(let e of u)d.has(e.width)||(d.add(e.width),c.push(`${Xt(e.url)} ${String(e.width)}w`));let h=c.join(", ");e.setAttribute("srcset",h)}function Kt(e,t,i){try{return new URL(t,e.baseURI).href===new URL(i,e.baseURI).href}catch{return t===i}}function Qt(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 Xt(e){return e.replace(/[\\s,]/g,encodeURIComponent)}function Zt(e){"IMG"===e.tagName?Ht(e):e.style.backgroundImage=""}function Yt(e){"IMG"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):Ht(e)}function ei(e){let t=Rt(e);return void 0===t?pt(e):Mt(t)??""}function ti(e,t){let i=e??"";if(null==t)return i;let n=ii(t);return"{}"===n?i:`${i}|${n}`}function ii(e){if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(e=>ii(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)}:${ii(i)}`)}return`{${n.join(",")}}`}function ni(e){return{kind:"date",options:e}}function ri(e){return{kind:"number",options:e}}function si(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?ni({dateStyle:"medium"}):Ds.has(n)?ni({dateStyle:n}):void 0;case"time":return void 0===n?ni({timeStyle:"short"}):zs.has(n)?ni({timeStyle:n}):void 0;case"datetime":return void 0===n?ni({dateStyle:"medium",timeStyle:"short"}):Ds.has(n)?ni({dateStyle:n,timeStyle:"short"===n?"short":"medium"}):void 0;case"number":return void 0===n?ri({}):Vs.test(n)?ri({minimumFractionDigits:Number(n),maximumFractionDigits:Number(n)}):void 0;case"currency":return void 0!==n&&qs.test(n)?ri({style:"currency",currency:n.toUpperCase()}):void 0;case"percent":return void 0===n?ri({style:"percent"}):void 0;default:return}}(t);if(void 0!==r)return r.kind===e?r.options:void 0;!function(e,t,i){Hs.has(e)||(Hs.add(e),yi(`[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 ai(e){return String(e).padStart(2,"0")}function li(e,t){return{name:e,render(){S(t)}}}function oi(){return typeof __LIVE_PREVIEW_CONFIG__>"u"?[]:__LIVE_PREVIEW_CONFIG__}var ui=Object.defineProperty,di=e=>{throw TypeError(e)},ci=(e,t,i)=>((e,t,i)=>t in e?ui(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i),hi=(e,t,i)=>t.has(e)||di("Cannot "+i),fi=(e,t,i)=>(hi(e,t,"read from private field"),i?i.call(e):t.get(e)),pi=(e,t,i)=>t.has(e)?di("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),gi=(e,t,i,n)=>(hi(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),mi=(e,t,i)=>(hi(e,t,"access private method"),i),vi=t((...e)=>console.error(...e)),yi=t((...e)=>console.warn(...e)),bi=t((...e)=>console.debug(...e)),wi=class{constructor(){pi(this,Ai);pi(this,Si,new Map);pi(this,ki,new Map)}on(e,t){return mi(this,Ai,Ri).call(this,fi(this,Si),e,t)}once(e,t){return mi(this,Ai,Ri).call(this,fi(this,ki),e,t)}off(e,t){mi(this,Ai,Ci).call(this,fi(this,Si),e,t),mi(this,Ai,Ci).call(this,fi(this,ki),e,t)}async emit(e,t){await mi(this,Ai,Ti).call(this,e,t)}async emitWhile(e,t,i){return mi(this,Ai,Ti).call(this,e,t,i)}listenerCount(e){return(fi(this,Si).get(e)?.size??0)+(fi(this,ki).get(e)?.size??0)}removeAllListeners(e){void 0!==e?(fi(this,Si).delete(e),fi(this,ki).delete(e)):(fi(this,Si).clear(),fi(this,ki).clear())}eventNames(){let e=new Set;for(let t of fi(this,Si).keys())e.add(t);for(let t of fi(this,ki).keys())e.add(t);return[...e]}},Si=new WeakMap,ki=new WeakMap,Ai=new WeakSet,Ti=async function(e,t,i){let n=()=>i?.()??!0;if(!n())return!1;let r=fi(this,Si).get(e);if(r)for(let i of[...r])if(!n()||(await mi(this,Ai,$i).call(this,i,t,e),!n()))return!1;if(!n())return!1;let s=fi(this,ki).get(e);if(s&&s.size>0){let i=[...s];fi(this,ki).delete(e);for(let r of i)if(!n()||(await mi(this,Ai,$i).call(this,r,t,e),!n()))return!1}return n()},Ri=function(e,t,i){let n=e.get(t);return n||(n=new Set,e.set(t,n)),n.add(i),()=>{mi(this,Ai,Ci).call(this,e,t,i)}},Ci=function(e,t,i){let n=e.get(t);void 0!==n&&(n.delete(i),0===n.size&&e.delete(t))},$i=async function(e,t,i){try{await e(t)}catch(e){let t="string"==typeof i||"number"==typeof i?String(i):"<event>";vi(`[live-preview] LP0601: handler for "${t}" threw:`,e)}},Fi=1e3,Ni=new Set(["date","number","checkbox","select","radio"]),Mi=40,Oi=["data","fieldSchemaJSON","globalSlug","collectionSlug","locale","ready","previewToken","protocolVersion"],Li={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"}},Pi=Object.keys(Li),Ui=class{constructor(e,t){ci(this,"matcher");ci(this,"handlers");ci(this,"boundListener");ci(this,"attachedTarget");ci(this,"generation",0);ci(this,"revision",0);ci(this,"queueHead");ci(this,"queueTail");ci(this,"lastAccepted");ci(this,"replayedGeneration",0);ci(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&&!y(t.data))&&v(t.fieldSchemaJSON,e=>Array.isArray(e))&&v(t.globalSlug,e=>"string"==typeof e)&&v(t.collectionSlug,e=>"string"==typeof e)&&v(t.locale,e=>"string"==typeof e)&&v(t.ready,e=>"boolean"==typeof e)&&v(t.previewToken,e=>"string"==typeof e)&&v(t.protocolVersion,e=>"number"==typeof e)}(r)){this.reportInvalid("shape",n,t);return}this.dispatchUpdate(function(e){let t={...e};for(let e of Oi)null===Reflect.get(t,e)&&Reflect.deleteProperty(t,e);return Array.isArray(t.fieldSchemaJSON)?{...t,fieldSchemaJSON:f(t.fieldSchemaJSON)}:t}(r),n,t);return;case"payload-document-event":if(!function(e){let t=e;return m(t.action,e=>"updated"===e||"created"===e||"deleted"===e)&&m(t.slug,e=>"string"==typeof e)&&m(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=y(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}},Ei={"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\'"},xi=new Set,Ii=new Set(["tabs","row","collapsible"]),_i={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"},ji=new Set(["http:","https:","mailto:","tel:"]),Bi=/^(?:\\.{1,2}\\/|[a-zA-Z0-9_-]+\\/?)/,Wi=/^[\\\\/]{2}/,Di=/[\\t\\n\\r]/g,zi=/[\\s\\u0000-\\u001f\\u180e\\u2000-\\u2029]/g,qi=/^([a-z][a-z0-9+.-]*):/i,Vi=new Set(["style","srcdoc","formaction","form","id","name","is","srcset","imagesrcset"]),Hi=new Set(["href","src","poster","cite","action","xlink:href","data"]),Gi=new WeakSet,Ji=class{constructor(){ci(this,"previous",null);ci(this,"lastFields");ci(this,"priorFields");ci(this,"keepValues",!1)}get previousFields(){return this.priorFields}get isBaseline(){return null===this.previous}diff(e,t,i=N){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 u=new Set,d=Object.entries(t);if(!i())return null;for(let[e,t]of d)if(l.has(e))for(let e of t)if(u.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:u,baseline:s}):null}reset(){this.previous=null,this.lastFields=void 0,this.priorFields=void 0}},Ki=new Set(["__proto__","prototype","constructor"]),Qi="data-payload-fragment",Xi="data-payload-strategy",Zi=8,Yi=1024,en=new Set(["id","_id","createdAt","updatedAt","createdBy","updatedBy","_status","globalType","collection","locale","localized"]),tn=new Set(["text","textarea","email","number","checkbox","date","select","radio","point","code","json","ui","html"]),nn=new Set(["root","paragraph","text","heading","quote","list","listitem","linebreak","tab","horizontalrule","code","code-highlight","table","tablerow","tablecell","link","autolink"]),rn={},sn=class{constructor(){ci(this,"rawChanges",new Ji);ci(this,"resolved",null);ci(this,"resolvedLocale",null);ci(this,"trailing",null);ci(this,"openUntil",0);ci(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(Z(e)||e.fieldName.includes(".")||te(e.hrefField)||te(e.srcField)||te(e.altField))return!0;return void 0!==e.strategies.fragment&&null!==e.root.querySelector(`[${Qi}]`)}(e)&&!function(e,t,i){for(let n of e.values()){if("text"!==n.fieldType||!0===n.explicitFieldType)continue;let e=L(t,n,n.fieldName,i);if(le(e)&&Y(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,rn),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(en.has(r)){a[r]=n;continue}let o=X(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))}},an=class{constructor(){ci(this,"negotiation",b(void 0));ci(this,"observed",new Set)}observe(e,t,i){let n=e.filter(e=>!this.observed.has(e));if(0!==n.length){for(let e of n)this.observed.add(e);this.negotiation=b(this.negotiation.theirs,this.observed),t("protocol",`observed=${n.join(",")}`)}}applyVersion(e,t){let i=this.negotiation;if(i.theirs===e)return;let n=b(e,this.observed);this.negotiation=n,n.negotiated!==i.negotiated&&t("protocol","ours=4",`theirs=${e}`,`negotiated=${n.negotiated}`)}},ln=class{constructor(){ci(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&&ne(t,e)?t:null}}commit(e){let t=e.identity!==this.lastIdentity;return this.lastIdentity=e.identity,t?e.edit:null}},on=class{constructor(){pi(this,un)}reveal(e,t,i){return e===fi(this,un)?"skipped-same":(gi(this,un,e),function(e,t){for(let t;t=e.closest?.("details:not([open])");)t.setAttribute("open","");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:se(t)?"auto":"smooth",block:"center"}),"revealed")}(t,i))}reset(){gi(this,un,void 0)}},un=new WeakMap,dn=class{constructor(){ci(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}},cn=()=>{},hn=class{constructor(){ci(this,"host",{outstanding:()=>!1,report:cn,failed:cn});ci(this,"entry",null);ci(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 cn;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}}},fn=class{constructor(){ci(this,"started",!1);ci(this,"suspended",!1);ci(this,"deferredStart",null);ci(this,"hydration","idle");ci(this,"activeUpdate",null);ci(this,"locale");ci(this,"schema");ci(this,"schemaIndex");ci(this,"updateCount",0);ci(this,"supersededCount",0);ci(this,"completedCount",0);ci(this,"skippedUnchangedCount",0);ci(this,"lastFlush",null);ci(this,"absentFields",new Set);ci(this,"warnedOrphanFields",new Set);ci(this,"warnedStrategy",new WeakSet);ci(this,"warnedUnattributableMessage",!1);ci(this,"warnedVisibilityGate",!1);ci(this,"warnedFragmentFallback",!1);ci(this,"warnedIslandStart",!1);ci(this,"warnedEscalationUnavailable",!1);ci(this,"warnedProtocolShape",!1);ci(this,"reportedUnfaithful",new WeakMap);ci(this,"checkedServerFormat",new WeakSet);ci(this,"rowsOfBinding",new WeakMap);ci(this,"unfaithfulPatches",[]);ci(this,"unfaithfulCount",0);ci(this,"escalatedCount",0);ci(this,"unfaithfulFields",new Set);ci(this,"autoBindSearchMs");ci(this,"autoBindGuesses",null);ci(this,"warnedForeignSource",!1);ci(this,"lastAppliedIdentity",new WeakMap);ci(this,"navigationReplayPending",!1);ci(this,"navigationBindingReplay",!1);ci(this,"revealLedger",new dn);ci(this,"display",new hn);ci(this,"fragmentStats",{rendered:0,failed:0,superseded:0});ci(this,"routeStats",{refreshes:0,partial:0,failed:0,refused:0,loopStopped:0});ci(this,"fragmentControllers",new Map);ci(this,"routeController",null);ci(this,"routeRetry",null);ci(this,"routeRefreshOwed",!1);ci(this,"routeAwaitsSave",!1);ci(this,"fragmentsOwed",new Set);ci(this,"readyTimers",[]);ci(this,"revealer",new on);ci(this,"changes",new Ji);ci(this,"merges",new sn);ci(this,"protocol",new an);ci(this,"relationships",new ln)}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()}},pn=class{constructor(e,t){ci(this,"deps",e);ci(this,"state",t);ci(this,"writing");ci(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,internalLinkPattern:e.internalLinkPattern,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||!w(n.revision,e.revision)||!i.isCurrent(n))return!1;let{target:r,value:a}=e,d=void 0!==n.schemaIndex?R(n.schemaIndex,r.fieldName):void 0,c=function(e,t){if(e.explicitFieldType)return e.fieldType;if(void 0!==t){let e=function(e){if(Object.prototype.hasOwnProperty.call(_i,e))return _i[e]}(t);if(void 0!==e)return e}return e.fieldType}(r,d?.type);"text"===c&&!0!==r.explicitFieldType&&le(a)&&(c="richText");let h;try{h=t.resolveRenderer(c,r)}catch(e){return this.fail(n,r.fieldName,e)}if(!i.isCurrent(n))return!1;let f=t.emitter.listenerCount("elementUpdate")>0,p=f?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 g={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||oe(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")&&!Vi.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 Hi.has(n)&&!C(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===h)return t.log("no renderer for",c),s(t,i,r,`has no renderer for "${c}"`,a),!1;{let e=function(e,t,i,n){if("ignore"===e.onUnfaithfulPatch||void 0!==i.format||!Ni.has(n)||l(n)&&i.element.matches("select,input")||t.checkedServerFormat.has(i.element))return;t.checkedServerFormat.add(i.element);let r=o(i.element);return r.trim().length>0?r:void 0}(t,i,r,c);if(this.writing=a,!1===function(e,t,i,n){return e.render(t,i,n)}(h,r,a,g)&&function(e){return Gi.has(e.render)}(h))return s(t,i,r,`is a value ${h.name} cannot render`,a),!1;void 0!==e&&function(e,t,i,n){let r=o(t.element);r!==i&&e.warn(`[live-preview] LP0412: "${t.fieldName}" showed ${u(i)}, the patch wrote ${u(r)} \\u2014 `+(l(n)?\'Payload sends the value of an option, not its label. Render the label in a data-payload-fragment boundary, or bind it with data-payload-strategy="route".\':"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,c)}}}catch(e){return this.fail(n,r.fieldName,e)}if(!i.isCurrent(n))return!1;f&&t.emitter.emitWhile("elementUpdate",{element:r.element,fieldName:r.fieldName,previousValue:p,nextValue:a,revision:n.revision.revision,receivedAt:n.receivedAt,source:"patch"},()=>i.isCurrent(n));let m=i.isCurrent(n);return m&&(void 0!==e.valueIdentity?i.lastAppliedIdentity.set(r.element,e.valueIdentity):i.lastAppliedIdentity.delete(r.element)),m}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}},gn="payload-live-preview:update",mn="data-payload-island",vn=`astro-island, [${mn}]`,yn="data-payload-field",bn="data-payload-type",wn="data-payload-attribute",Sn="data-payload-href",kn="data-payload-src",An="data-payload-alt",Tn="data-payload-array-template",Rn="data-payload-array-separator",Cn="data-payload-locale",$n="data-payload-format",Fn="data-payload-richtext",Nn="data-payload-html",Mn="data-payload-array",On="data-payload-structural",Ln="data-payload-owner",Pn="data-payload-depends",Un="data-payload-strategy",En="data-payload-boundary",xn="data-payload-covers",In=[yn,bn,wn,Sn,kn,An,Tn,Rn,Cn,$n,Fn,Nn,Mn,On,Ln,Pn,Un,En,"type"],_n=`[${yn}]`,jn=`[${Ln}]`,Bn=`[${Qi}], [${Un}="route"]`,Wn=/^[a-z][a-z0-9-]*:[a-z][a-z0-9-]*$/i,Dn=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"]),zn=class{constructor(e={}){ci(this,"entriesByField",new Map);ci(this,"entryByElement",new WeakMap);ci(this,"filter");ci(this,"count",0);ci(this,"dependencies",null);ci(this,"islandRoots",[]);ci(this,"ownersByIsland",new Map);ci(this,"navigationRoots",[]);ci(this,"coverDeclarations",[]);ci(this,"renderedDeclarations",[]);this.filter=e.filter??be}dependencyMap(){if(null!==this.dependencies)return this.dependencies;let e=[];for(let t of this.values())void 0!==t.dependsOn&&e.push(ce(t.fieldName,t.dependsOn));return this.dependencies=de(...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(_n))void 0!==this.add(t)&&(i+=1);return this.islandRoots=function(e){let t=[];for(let i of e.querySelectorAll(vn))he(i)||t.push(i);return t}(e),this.ownersByIsland=new Map(this.islandRoots.map(e=>[e,ge(e)])),this.navigationRoots=[...e.querySelectorAll(Bn)].filter(e=>this.filter(e)&&(e.hasAttribute(Qi)||0===(e.getAttribute(yn)??"").length)),this.coverDeclarations=[...e.querySelectorAll(`[${xn}]`)].filter(e=>this.filter(e)).map(e=>({paths:ue(e.getAttribute(xn)),owner:ge(e)})),this.renderedDeclarations=[...e.querySelectorAll(`[${Pn}]`)].filter(e=>this.filter(e)).flatMap(e=>{let t=function(e){if((e.getAttribute(Qi)??"").length>0)return"fragment";let t=e.getAttribute(Un);return null!==t?"route"===t?"route":void 0:e.hasAttribute(yn)&&null!==e.closest("head")?"route":void 0}(e);return void 0===t?[]:[{strategy:t,paths:ue(e.getAttribute(Pn)),owner:ge(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(yn);if(null===t||0===t.length)return;let i=e.getAttribute(bn),n=e.getAttribute(wn),r=e.getAttribute(Sn),s=e.getAttribute(kn),a=e.getAttribute(An),l=e.getAttribute(Tn),o=e.getAttribute(Rn),u=e.getAttribute(Cn),d=e.getAttribute($n),c=ge(e),h=ue(e.getAttribute(Pn)),f=e.getAttribute(Un),p=e.getAttribute("data-payload-guessed"),g=U(e);return{element:e,fieldName:t,fieldType:ye(e),explicitFieldType:null!==i&&me(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!==u&&u.length>0?{locale:u}:{},...null!==d&&d.length>0?{format:d}:{},...void 0!==c?{owner:c}:{},...h.length>0?{dependsOn:h}:{},...null!==f&&f.length>0?{strategy:f}:{},...e.hasAttribute(En)?{hidesWhenEmpty:!0}:{},...null!==p?{guessed:p}:{}}}},qn=64,Vn=1e4,Hn=1e3,Gn=64,Jn=8192,Kn=1048576,Qn=1e4,Xn=20,Zn=new Set(["__proto__","constructor","prototype"]),Yn=new Error,er=class{constructor(e){ci(this,"serverURL");ci(this,"apiRoute");ci(this,"depth");ci(this,"fetchFn");ci(this,"log");ci(this,"timeoutMs");ci(this,"inflight",null);ci(this,"attempt",0);ci(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);let r=e.timeoutMs??0;this.timeoutMs=r>0&&r<Number.POSITIVE_INFINITY?r:void 0}canMerge(e){try{let t=e.schema;return void 0!==t?(Ne(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 Pe(t)?{path:`globals/${encodeURIComponent(t)}`,field:"globalType",value:t}:null;let i=e.collectionSlug??"",n=e.data.id;return Pe(i)&&Ue(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,r,s=null,a=!1,l=()=>this.attempt!==t,o=this.timeoutMs,u=!1,d=(e,t)=>void 0===o?e:(void 0===r&&(r=new Promise((e,i)=>{n=setTimeout(()=>{u=!0,t.abort(),i(Yn)},o)}),r.catch(()=>{})),Promise.race([e,r]));try{if(i?.abort(),l())return{status:"superseded"};let t=e.schema;if(a=void 0!==t,void 0!==t){let i=Ne(e.data,t,this.serverURL,this.apiRoute,this.depth,e.locale);if(l())return{status:"superseded"};if(0===i.requests.length)return{status:"merged",doc:i.doc};let n=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(l())return{status:"superseded"};if(void 0===n)return{status:"unavailable"};s=new AbortController,this.inflight=s;for(let e of i.requests){let t=await d(n(e.url,{method:"GET",credentials:"include",redirect:"error",signal:s.signal}),s);if(l())return{status:"superseded"};let i=t.ok;if(l())return{status:"superseded"};if(!i){let e=t.status;return l()?{status:"superseded"}:(s.abort(),l()?{status:"superseded"}:(this.log("merge HTTP",e),l()?{status:"superseded"}:{status:"unavailable"}))}let r=await d(Me(t,s.signal,()=>!l()),s);if(l())return{status:"superseded"};if(Oe(e,r),l())return{status:"superseded"}}return{status:"merged",doc:i.doc}}let n=this.endpointOf(e);if(l())return{status:"superseded"};if(null===n)return{status:"unavailable"};let r=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(l())return{status:"superseded"};if(void 0===r)return{status:"unavailable"};let o=JSON.stringify({data:e.data,depth:this.depth,flattenLocales:!1,locale:e.locale});if(l())return{status:"superseded"};s=new AbortController,this.inflight=s;let u=`${this.serverURL}${this.apiRoute}/${n.path}`,c=await d(r(u,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","X-Payload-HTTP-Method-Override":"GET"},body:o,signal:s.signal}),s);if(l())return{status:"superseded"};let h=c.ok;if(l())return{status:"superseded"};if(!h){let e=c.status;return l()?{status:"superseded"}:(this.log("merge HTTP",e,u),l()?{status:"superseded"}:{status:"unavailable"})}let f=c.json.bind(c);if(l())return{status:"superseded"};let p=await d(f(),s);if(l())return{status:"superseded"};if(null===p||"object"!=typeof p||Array.isArray(p))return this.log("merge invalid",u),l()?{status:"superseded"}:{status:"unavailable"};let g=p,m=g[n.field],v=Object.hasOwn(g,n.field)&&("id"===n.field?!Ue(m)||String(m)!==n.value:m!==n.value);return l()?{status:"superseded"}:v?(this.log("merge invalid",u),l()?{status:"superseded"}:{status:"unavailable"}):{status:"merged",doc:g}}catch(e){return l()?{status:"superseded"}:u?(this.log("merge timeout",o),{status:"unavailable"}):a&&(s?.abort(),l())?{status:"superseded"}:(this.log("merge exception",a?new Error("legacy population could not be resolved"):e),l()?{status:"superseded"}:{status:"unavailable"})}finally{clearTimeout(n),this.inflight===s&&(this.inflight=null)}}destroy(){this.attempt+=1;let e=this.inflight;this.inflight=null,this.destroyDepth+=1;try{e?.abort()}finally{this.destroyDepth-=1}}},tr="2.3.2",ir={name:"payload-2",fieldTyping:"schema",populatesRelationships:"admin",documentEvents:!1},nr={name:"payload-3",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!0},rr={name:"unknown",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!1},sr="ssr",ar=1,lr=[yn,Ln,xn,Pn],or=`[${yn}], [${xn}], ${vn}, ${Bn}`,ur=class{constructor(e,t={}){ci(this,"callbacks");ci(this,"debounceMs");ci(this,"rootMargin");ci(this,"visible",new Set);ci(this,"mutation",null);ci(this,"intersection",null);ci(this,"debounceTimer",null);ci(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:[...In,xn,mn,sr]})}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=xe(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===mn||"attributes"===t.type&&null!==t.attributeName&&(lr.includes(t.attributeName)||In.includes(t.attributeName)&&t.target.nodeType===ar&&t.target.hasAttribute(yn)))return!0;for(let e of t.addedNodes)if(Ie(e))return!0;for(let e of t.removedNodes)if(Ie(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}},dr=class{constructor(e){pi(this,pr);pi(this,cr,[]);pi(this,hr);pi(this,fr,!1);gi(this,hr,e)}get closed(){return fi(this,fr)}own(e){fi(this,fr)?mi(this,pr,gr).call(this,e):fi(this,cr).push(e)}close(){if(fi(this,fr))return;gi(this,fr,!0);let e=fi(this,cr).splice(0).reverse();for(let t of e)mi(this,pr,gr).call(this,t)}},cr=new WeakMap,hr=new WeakMap,fr=new WeakMap,pr=new WeakSet,gr=function(e){try{e()}catch(e){fi(this,hr).call(this,"runtime cleanup failed:",e)}},mr="__livePreviewHydration",vr="[data-payload-field]",yr="__vue_app__",br="__livePreviewVueHydration",wr="app:suspense:resolve",Sr="__livePreviewHydrated",kr={react:(e,t)=>function(e,t=5e3){je();let i=_e();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?.(vr)}(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)&&Be(i)};i.onCommit=e;for(let t of i.commits.splice(0))e(t)}return De(i,e,t)}(t),vue:function(e,t,i=5e3){Ve();let n=ze();return void 0===n?null:(!n.committed&&function(e){for(let t=e.querySelector(vr);null!==t;t=t.parentElement)if(void 0!==qe(t))return!0;return!1}(e)&&Be(n),De(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()&&Be(s)});a.observe(n,{childList:!0,subtree:!0});let l=De(s,e=>{a.disconnect(),t(e)},i);return()=>{a.disconnect(),l?.()}},manual:function(e,t,i=5e3){let n=function(){if(typ','eof window>"u")return;let e=window;return e[Sr]??(e[Sr]={committed:!1,waiters:[]})}();return void 0===n?null:De(n,t,i)}},Ar={react:"React commit",vue:"Vue mount",sveltekit:"SvelteKit mount",manual:"markHydrated() call"},Tr=class{constructor(e){ci(this,"timeoutMs");ci(this,"onTimeout");ci(this,"handle",null);ci(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}},Rr=class{constructor(){ci(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)}},Cr=class{constructor(e,t,i){ci(this,"deps",e);ci(this,"state",t);ci(this,"host",i);ci(this,"awaitingHydration",new WeakSet);ci(this,"delivered",new WeakMap);ci(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=ge(a);if(!r())return;if(!1!==n&&!j(i,n)){this.awaitingHydration.delete(a);continue}let l=this.confirmation(a,e);if(pe(a))this.awaitingHydration.add(a);else{if(this.awaitingHydration.delete(a),s.has(a))continue;s.add(a),Xe(e,t,[a],r,l)}}}hasLateRouteBinding(e,t,i,n){for(let n of e){if((n.getAttribute(yn)??"").length>0||"route"!==n.getAttribute(Un)||!1!==t&&!j(ge(n),t))continue;let e=ue(n.getAttribute(Pn));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=L(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}},$r="payload-live-preview",Fr=Symbol.for("payload-live-preview.trusted-types"),Nr="__payloadLivePreviewDeprecationsWarned",Mr=new Set,Or="data-payload-",Lr=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"]),Pr=new Set(["input","button","textarea","select","option","label"]),Ur=new Set(["script","style","iframe","object","embed","link","meta","base","form","input","button","select","textarea","svg","math","template","frame","frameset","noframes","noscript"]),Er=new Set(["id","class","lang","dir","title","role","tabindex"]),xr="aria-",Ir="data-",_r="data-payload-",jr={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"])},Br=new Set(["href","src","cite","poster","action","formaction"]),Wr=6,Dr=1,zr=8,qr=(Error,new Set(["id","name","data-payload-key","data-payload-morph","data-payload-nested-key","data-payload-nested-template"])),Vr="strict",Hr=(Object.freeze({allowedTags:Lr,removeCompletely:Ur,globalAttributes:Er,attributesByTag:jr,urlAttributes:Br}),Object.freeze({"&":"&","<":"<",">":">",\'"\':""","\'":"'","/":"/","`":"`","=":"="})),Gr=/[&<>"\'/`=]/g,Jr=Object.freeze({"&":"&","<":"<",">":">",\'"\':""","\'":"'"}),Kr=/[&<>"\']/g,Qr=new Set,Xr={kind:"merge"},Zr=class{constructor(e,t,i){ci(this,"deps",e);ci(this,"state",t);ci(this,"strategies");ci(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=J(e,n,void 0),a=Q(e,i,n,s),l=[];for(let e of t){if(en.has(e))continue;let t=a(e);if("none"===t&&l.push(e),"below"!==t||void 0===r)continue;let n=K(e,i),{previous:o,next:u}=r;for(let{path:t}of G(n,o[e],u[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:()=>(S("route refreshes"),Promise.resolve()),refreshAfterSave:()=>{},warnFragmentFallback:i=>{S("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 Cr(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,n.warn);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,u=a.schema,d=a.schemaIndex;Array.isArray(e.fieldSchemaJSON)&&(u=e.fieldSchemaJSON,d=function(e,t=""){let i=new Map;return T(e,t,i,!1),T(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:u,schemaIndex:d,receivedAt:Date.now(),forceRender:null!==h||re(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=u,a.schemaIndex=d,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&&(S("auto-binding"),!r.isCurrent(e)))return;let s=de(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?Qr:a.invalidated,e.touched=i?Qr: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,Xr),r.fields):null}async applyMerged(e,t){let{state:i}=this,n=await t;"unavailable"===n.status&&i.display.shortfall(e,Xr),"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,u=n.strategies.route;if(s&&void 0!==u&&!e.routeRefreshed&&this.navigationReplay.hasLateRouteBinding(i,l,e,t)){a()&&this.strategies.refreshRoute(e,t,u);return}let d=!s&&this.strategies.hasUnboundChange(e,l),c=r.routeRefreshOwed;if(!s&&void 0!==u&&!e.routeRefreshed&&(d||c||this.strategies.plansRoute(u,e,l))&&a()){r.routeRefreshOwed=!1,this.strategies.refreshRoute(e,t,u);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,u]of n.cache.entries()){if(!a())return;for(let d of u){if(void 0!==i&&!i.has(d.element)||!1!==l&&!j(d.owner,l))continue;if(!0===f?.covers(d)){if(n.revealEditedField){let i=L(t.fields,d,o,e.locale);r.revealLedger.note(e,d,i)}continue}let u=d.strategyKind??E(d.element)??"unknown";if("unknown"===u){this.strategies.warnUnsupportedStrategy(d);continue}"fragment"===u&&null===f&&this.strategies.warnFragmentFallback(d);let c=L(t.fields,d,o,e.locale);if(void 0===c){r.absentFields.add(o);continue}if(t.fields,e.navigated,!s&&n.revealEditedField&&r.revealLedger.note(e,d,c),!a())return;let h=yt(n,d,c,t.fields,a);if(!a())return;let m=p?P(d,h,t.fields,e.locale):void 0,v=r.lastAppliedIdentity.get(d.element);if(!e.forceRender&&n.skipUnchanged&&void 0!==m&&v===m&&!e.invalidated.has(o)){r.skippedUnchangedCount+=1;continue}let y={target:d,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=Q(e,t,i,J(e,i,n));return e=>"none"!==r(e)}(s,n,r,a);for(let[e,t]of Object.entries(i)){if(en.has(e))continue;if(Ye(t)){Ze(l,o,e,n,t);continue}if(!tt(t)||o(e)||et(t))continue;let i=K(e,n);for(let[e,r]of Object.entries(t))!Ye(r)||en.has(e)||Ze(l,o,`${i}.${e}`,n,r)}if("declared"!==e.subfieldCoverage)return;let u=function(e,t,i,n,r){let s=J(e,n,r),a=Q(e,i,n,s),l=[];for(let[e,n]of Object.entries(t)){if(en.has(e)||"below"!==a(e))continue;let t=K(e,i);l.push(...G(t,void 0,n,s))}return l}(s,i,n,r,a);for(let{path:e,value:t}of u)if(Ye(t)&&Ze(l,o,e,n,t),tt(t)&&!et(t))for(let[i,r]of Object.entries(t))Ye(r)&&Ze(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)||!w(s.revision,n))return;i.display.deferred(s,e.deferred),0===s.pendingFragments&&i.complete(s);let a=()=>i.isCurrent(s)&&w(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{ae(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":ae(this.state.revealer,t)}documentSaved(){this.strategies.refreshAfterSave()}},Yr=class{constructor(e,t){ci(this,"apply");ci(this,"debounceMs");ci(this,"maxWaitMs");ci(this,"isVisible");ci(this,"gateThresholdValue");ci(this,"gateDisabled");ci(this,"getCacheSize");ci(this,"onFlush");ci(this,"scheduleFrame");ci(this,"cancelFrame");ci(this,"pending",new Map);ci(this,"replay",new Map);ci(this,"activeFlushes",new Set);ci(this,"debounceTimer",null);ci(this,"debounceToken",0);ci(this,"deadlineTimer",null);ci(this,"frameHandle",null);ci(this,"frameFallback",null);ci(this,"frameToken",0);ci(this,"windowUntil",0);ci(this,"activeRevision",null);ci(this,"activeRevisionCancelled",!1);ci(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||!w(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&&w(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||!w(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)||bt(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&&w(e.revision,this.activeRevision)}didApply(e){return!1!==this.apply(e)||!function(e){return Gi.has(e)}(this.apply)}retargetBuffer(e,t){let i=e.get(t.element);if(void 0!==i){if(!ve(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)}},es=[0,500,1e3,2e3],ts=class{constructor(e){ci(this,"deps");ci(this,"state",new fn);ci(this,"pipeline");ci(this,"writer");ci(this,"rootSentinel",null);ci(this,"scope",null);ci(this,"closingSession",!1);ci(this,"observedRoot",null);ci(this,"replayRetainedOnStart",!1);let{emitter:n,renderers:s}=e,a=void 0===e.log?i:t(e.log),l=void 0===e.warn?yi: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 u=new zn({filter:e=>!function(e){let t=e;for(;null!==t;){if(fe(t))return!0;t=t.parentElement}return!1}(e)}),d=new ur({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 Yr(F(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=>d.isVisible(e),getCacheSize:()=>u.elementCount,onFlush:e=>{this.pipeline.onFlush(e)}}),h=new Ui(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,l),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:u,observers:d,scheduler:c,bus:h,connection:new Rr,heartbeat:new Tr({...void 0!==e.heartbeatMs?{timeoutMs:e.heartbeatMs}:{},onTimeout:()=>{this.onHeartbeatTimeout()}}),renderers:s,resolveRenderer:e.resolveRenderer??(e=>s[e]),transformValue:e.transformValue,renderRichText:e.renderRichText,internalLinkPattern:e.internalLinkPattern,routeAfterSave:!0===e.routeAfterSave,sanitizerPolicy:e.sanitizerPolicy,root:o,readyTargets:"function"==typeof e.readyTargets?e.readyTargets:(e=>()=>e)(e.readyTargets),sendReady:e.sendReady??A,onHeartbeatTimeout:e.onHeartbeatTimeout,log:a,warn:l,a11y:k(e),serverURL:f?.serverURL,merger:void 0===f?null:new er({...f,log:a}),mergeWindowMs:e.debounceMs??50,scopeBindingsByOwner:!0===e.scopeBindingsByOwner,subfieldCoverage:e.subfieldCoverage??"descendant",coverageByDefault:void 0===e.subfieldCoverage,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 pn(this.deps,this.state),this.pipeline=new Zr(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?je():"vue"===e.hydration&&Ve();let{root:t}=e;if(!Je(t)||"loading"!==t.readyState){He(e);return}let i=()=>{e.isRunning()&&e.later(()=>{He(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=Je(t.root)?Ke(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 es){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 dr(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;!Je(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()||!Je(e))return!1;let t=Ke(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,u=[];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&&u.push({field:e,matched:i.guessed,attribute:i.targetAttribute??("IMG"===i.element.tagName?"src":void 0)})}return{version:tr,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:Ee(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:u.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&&ve(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}},is=/^https?:\\/\\/(localhost|127\\.0\\.0\\.1)(?::\\d+)?$/i,ns=/^https?:\\/\\/[^/?#\\s]+$/i,rs=[3e3,3001,3333,4e3,4321,5e3,5173,5174,8e3,8080,8888,9e3],ss=class{constructor(e={}){pi(this,as);let t=new Set;for(let i of e.additionalOrigins??[]){let e=wt(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}());gi(this,as,[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!==fi(this,as)[4]?e===fi(this,as)[4]:!!(fi(this,as)[0].has(e)||0===fi(this,as)[0].size&&void 0!==fi(this,as)[1]&&e===fi(this,as)[1]||fi(this,as)[2]&&is.test(e)))}lockOrigin(e){return!!this.matches(e)&&(fi(this,as)[4]=e,!0)}unlockOrigin(){let e=fi(this,as)[4];return fi(this,as)[4]=void 0,e}get lockedOrigin(){return fi(this,as)[4]}enumerate(){if(void 0!==fi(this,as)[4])return[fi(this,as)[4]];let e=new Set(fi(this,as)[0]);0===fi(this,as)[0].size&&void 0!==fi(this,as)[1]&&e.add(fi(this,as)[1]);let t=fi(this,as)[5];if(fi(this,as)[2]&&void 0!==t)is.test(t)&&e.add(t);else if(fi(this,as)[2])for(let t of rs)e.add(`http://localhost:${String(t)}`),e.add(`http://127.0.0.1:${String(t)}`);return[...e]}get referrerWasAvailable(){return fi(this,as)[3]}get isProductionUnconfigured(){return!(!ie()||fi(this,as)[0].size>0||fi(this,as)[2]||void 0!==fi(this,as)[1])}get isReferrerOnlyTrust(){return!(fi(this,as)[0].size>0||fi(this,as)[2])&&void 0!==fi(this,as)[1]}},as=new WeakMap,ls="astro:page-load",os="astro:after-swap",us={1:"left",2:"center",3:"right",4:"justify"},ds=new Set(["left","center","right","justify","start","end"]),cs=new Set(["h1","h2","h3","h4","h5","h6"]),hs=/\\{(slug|id|collection|locale)\\}/gu,fs=\' target="_blank" rel="noopener noreferrer"\',ps=(e,t)=>{let i=t.renderChildren(e.children??[]),n=Rt(e.fields),r=function(e,t,i){if("internal"===t?.linkType)return function(e,t){let i=Rt(e),n=Rt(i?.value),r=n?.url;if("string"==typeof r&&r.length>0)return r;let s=void 0===t.internalLinkPattern?void 0:function(e,t){let i=e=>{let i=t[e];return"string"==typeof i&&i.length>0||"number"==typeof i?encodeURIComponent(i):void 0};for(let[,t=""]of e.matchAll(hs))if(void 0===i(t))return;return e.replace(hs,(e,t)=>i(t)??"")}(t.internalLinkPattern,{slug:n?.slug,id:void 0===n?i?.value:n.id,collection:i?.relationTo,locale:t.locale});if(void 0!==s)return s;let a=n?.slug;return"string"==typeof a&&a.length>0?`/${a}`:void 0}(t.doc,i);let n=t?.url??e.url;return"string"==typeof n&&n.length>0?n:void 0}(e,n,t);if(void 0===r||!C(r))return i;let s="string"==typeof e.title?` title="${ht(e.title)}"`:"";return`<a href="${ft(r)}"${function(e,t,i){if(!0===t?.newTab||$(i))return fs;let n="string"==typeof e.target?e.target:"";return""===n?"":"_blank"===n?fs:` target="${ht(n)}"`}(e,n,r)}${s}>${i}</a>`},gs=new Map,ms=".lp-block:empty,.lp-inline-block:empty",vs={text:e=>{let t=ht("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${At(e)}${Tt(e)}>${i}</p>`},heading:(e,t)=>{let i="string"==typeof e.tag?e.tag.toLowerCase():"h2",n=cs.has(i)?i:"h2",r=t.renderChildren(e.children??[]);return`<${n}${At(e)}${Tt(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}${At(e)}${Tt(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"}"${Tt(e)}>${i}</li>`;let n="number"==typeof e.value?` value="${ht(String(e.value))}"`:"";return`<li${At(e)}${Tt(e)}${n}>${i}</li>`},link:ps,autolink:ps,quote:(e,t)=>{let i=t.renderChildren(e.children??[]);return`<blockquote${At(e)}${Tt(e)}>${i}</blockquote>`},code:e=>{let t=Ft("string"==typeof e.language?e.language:"");return`<pre><code${""===t?"":` class="language-${t}"`}>${ht(Ot(e))}</code></pre>`},"code-highlight":e=>{let t="string"==typeof e.text?e.text:"";return`<span${"string"==typeof e.highlightType?` class="token-${Ft(e.highlightType)}"`:""}>${ht(t)}</span>`},linebreak:()=>"<br>",horizontalrule:()=>"<hr>",tab:()=>"\\t",upload:e=>{let t=Ct(e.value);if(void 0===t)return"";let i=t.url;if("string"!=typeof i||!C(i))return"";let n="string"==typeof t.mimeType?t.mimeType:"";return n.startsWith("video/")?function(e,t){return`<video controls${Lt(e)}><source src="${ft(t)}"${Pt(e)}></video>`}(t,i):n.startsWith("audio/")?function(e,t){return`<audio controls><source src="${ft(t)}"${Pt(e)}></audio>`}(t,i):""===n||n.startsWith("image/")?function(e,t){let i="string"==typeof e.alt?ht(e.alt):"";return`<img src="${ft(t)}" alt="${i}"${Lt(e)} loading="lazy" decoding="async">`}(t,i):function(e,t){let i="string"==typeof e.filename?ht(e.filename):ht(t);return`<a href="${ft(t)}" target="_blank" rel="noopener noreferrer">${i}</a>`}(t,i)},relationship:e=>{let t="string"==typeof e.relationTo?e.relationTo:"",i=Rt(e.value),n=ht((i&&Mt(i))??`#${t}`),r=Ft(t),s=""===r?\' class="lp-relation"\':` class="lp-relation lp-relation--${r}"`,a=i?.url;return"string"==typeof a&&C(a)?`<a href="${ft(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${At(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}>`}},ys=new Map,bs=!1,ws="data-payload-text",Ss=new Set,ks=new Set,As=new WeakMap,Ts=new Set(["DIV","SECTION","ARTICLE"]),Rs={name:"richText",render:F((e,t,i)=>{let n=e.element;if(gt(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=it(st(s,r));return}if(It(t)){if(oe(t)){n.textContent="";return}let s=new Map,a=[],l=Wt(n,st(function(e,t={}){if(!It(e))return"";let i=function(e){let t={renderChildren:e=>{let i="";for(let n of e)i+=_t(n,t);return i},resolveAlignment:St,resolveIndent:kt,onUnrenderedBlock:e.onUnrenderedBlock,internalLinkPattern:e.internalLinkPattern,locale:e.locale};return t}(t).renderChildren(e.root.children);return!1===t.sanitize?i:void 0!==t.document?rt(i,{document:t.document}):!0===t.requireDocument||void 0!==ot()?rt(i):(function(){if(!bs){bs=!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,internalLinkPattern:i.internalLinkPattern,locale:i.locale,onUnrenderedBlock:(e,t,i)=>{s.set(t,e),a.push(i)}}),r));for(let[t,n]of l){let r=s.get(t);void 0!==r&&zt(e,i,r,n)}!function(e,t,i,n){let r=function(e){try{return JSON.stringify(e,(e,t)=>"object"==typeof t&&null!==t&&"id"in t&&"updatedAt"in t?t.id:t)}catch{return}}(i),s=As.get(e.element);void 0===r?As.delete(e.element):As.set(e.element,r),void 0!==r&&void 0!==s&&r!==s&&[...n.values()].includes(!1)&&t.reportUnfaithful?.(e,"changed a block no renderer draws")}(e,i,a,l);return}if("string"!=typeof t)return!1;n.innerHTML=it(st(t,r))})},Cs={name:"html",render(e,t,i){if(gt(t)){e.element.textContent="";return}let n="string"==typeof t?t:pt(t);e.element.innerHTML=it(st(n,i.sanitizerPolicy))}},$s=new WeakSet,Fs=Vt("url"),Ns=/^[a-zA-Z][a-zA-Z0-9+.-]*:/,Ms=Vt("email",function(e){let t=e.trim();return Ns.test(t)||!t.includes("@")?t:`mailto:${t}`}),Os=["src","srcset","sizes"],Ls=new WeakMap,Ps=/^(?:\\.{0,2}\\/|\\S*[/.:]\\S*$|.*\\.(?:avif|bmp|gif|ico|jpe?g|png|svg|tiff?|webp)$)/i,Us={name:"image",render:F((e,t,i)=>{let n=e.element;if("IMG"===n.tagName&&e.altField===e.fieldName&&void 0===e.srcField&&("string"==typeof t||gt(t))){n.alt=t??"";return}if(gt(t)){Zt(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?M(i.allFields,e.srcField,i.locale,n):t,s=Ct(r);return{media:s,candidate:void 0===s?r:s.url}}(e,t,i,r);if(void 0===s&&"string"==typeof a&&!Ps.test(a.trim()))return!1;let l=qt(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;Jt(t,l.url,s,i.serverURL);let a=function(e,t,i,n,r){if(void 0!==t&&t.length>0){let e=M(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 Zt(n)})},Es={name:"upload",render:F((e,t,i)=>{let n=e.element;if(gt(t)){Yt(n);return}let r=Ct(t);if(void 0===r)return!1;let s=qt(n,e.fieldName,r.url,i.serverURL);if("none"===s.kind)return!1;if("unsafe"===s.kind){Yt(n);return}let a=s.url;if("IMG"===n.tagName){let e=n;Jt(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=ht(r.filename??a);n.innerHTML=it(`<a href="${ft(a)}">${l}</a>`)})},xs={name:"relationship",render(e,t){let i=e.element;if(gt(t))i.removeAttribute("href"),i.textContent="";else{if("A"===i.tagName&&!Array.isArray(t)){let n=qt(i,e.fieldName,Rt(t)?.url);"safe"===n.kind?i.setAttribute("href",n.url):"unsafe"===n.kind&&i.removeAttribute("href")}i.textContent=Array.isArray(t)?t.map(ei).join(", "):ei(t)}}},Is={name:"select",render(e,t,i){let n=e.element,r=gt(t)?[]:function(e){return Array.isArray(e)?e.map(pt):[pt(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=Rt(t);if(void 0!==i&&pt(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)}},_s=new Set(["","false","0","off","no"]),js={name:"checkbox",render(e,t){let i=e.element,n=function(e){return"boolean"==typeof e?e:"string"==typeof e?!_s.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}},Bs=new Map,Ws=new Map,Ds=new Set(["short","medium","long","full"]),zs=new Set(["short","medium","long","full"]),qs=/^[A-Za-z]{3}$/u,Vs=/^[0-4]$/u,Hs=new WeakSet,Gs={name:"date",render(e,t,i){let n=e.element;if(gt(t)){"INPUT"===n.tagName?n.value="":(n.removeAttribute("datetime"),n.textContent="");return}let r="number"==typeof t?t:pt(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=si("date",t.format,t.element,t.fieldName)??Js;try{return function(e,t){let i=ti(e,t);return mt(Ws,i)??vt(Ws,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")}-${ai(t.getMonth()+1)}-${ai(t.getDate())}`,n=`${ai(t.getHours())}:${ai(t.getMinutes())}`;return"date"===e?i:"datetime-local"===e?`${i}T${n}`:"time"===e?n:t.toISOString()}(n.type,s):l}},Js={dateStyle:"medium",timeStyle:"short"},Ks={name:"number",render(e,t,i){let n=e.element;if(gt(t)){"INPUT"===n.tagName?n.value="":n.textContent="";return}let r="number"==typeof t?t:Number(pt(t));Number.isNaN(r)?n.textContent=pt(t):"INPUT"!==n.tagName?n.textContent=function(e,t,i){let n=t.locale??i.locale??d(),r=si("number",t.format,t.element,t.fieldName);try{return function(e,t){let i=ti(e,t);return mt(Bs,i)??vt(Bs,i,new Intl.NumberFormat(e,t),64)}(n,r).format(e)}catch{return String(e)}}(r,e,i):n.value=String(r)}},Qs=new Map;!function(){if(typ','eof window>"u"||!ie()&&(typ','eof window>"u"||null==window.opener))return;let e=window.__livePreview,t=JSON.stringify(oi());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,u=!0,d=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,M,O]=oi(),L=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),P=new ss({additionalOrigins:i,enableReferrerDetection:!p,enableLocalhostMatching:!g});P.isProductionUnconfigured?yi("[live-preview] LP0101: No trusted origin. Pass allowedOrigins to generateInlineScript() (or to the adapter) \\u2014 the runtime reads no environment variable in the browser."):P.isReferrerOnlyTrust&&yi("[live-preview] LP0102: document.referrer fallback trusts any framing site. Set allowedOrigins and a frame-ancestors CSP in production.");let U=new wi,E=function(){let e=[Rs,Cs,Fs,Ms,Us,Es,xs,Is,{...Is,name:"radio"},js,Gs,Ks,li("array","structural arrays"),li("blocks","structural arrays")];return function(e=[]){let t={};for(let i of e)t[i.name]=i;for(let[e,i]of Qs)t[e]=i;return Object.freeze(t)}([Bt("text"),Bt("textarea"),...e])}(),x=new ts({renderers:E,originMatcher:e=>P.matches(e),lockedOrigin:()=>P.lockedOrigin,readyTargets:()=>P.enumerate(),emitter:U,eventSourcePolicy:y,...""!==n?{dataMerge:{serverURL:n,apiRoute:s,depth:a,...void 0===M?{}:{timeoutMs:M}}}:{},...void 0===O?{}:{internalLinkPattern:O},..."after-save"===k?{routeAfterSave:!0}:{},debounceMs:o,heartbeatMs:d,intersectionRootMargin:f,disableVisibilityGate:c,visibilityGateThreshold:h,enableA11y:u,scopeBindingsByOwner:m,...void 0===N?{}:{subfieldCoverage:N},skipUnchanged:v,revealEditedField:S,onUnfaithfulPatch:r({onUnfaithfulPatch:T,onUnboundChange:A}),autoBind:R,...void 0!==C?{hydration:C}:{},sanitizerPolicy:b,...void 0!==L?{strategies:L}:{},onHeartbeatTimeout:()=>{P.unlockOrigin()},...l?{log:(...e)=>{bi("[live-preview]",...e)}}:{}});U.on("connect",e=>{P.lockOrigin(e.origin)}),x.start(),e?.destroy();let I=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},u=t=>{if(t.type===ls){if(!l)return;l=!1}void 0===e.refreshAfterNavigation?e.refreshCache():e.refreshAfterNavigation()},d=!1;i?.addEventListener("pagehide",s),i?.addEventListener("pageshow",a);for(let e of r)n?.addEventListener(e,u);let c=r.includes(ls);return c&&n?.addEventListener(os,o),()=>{if(!d){d=!0,i?.removeEventListener("pagehide",s),i?.removeEventListener("pageshow",a);for(let e of r)n?.removeEventListener(e,u);c&&n?.removeEventListener(os,o)}}}({suspend:()=>x.suspend(),resume:()=>x.start(),refreshCache:()=>{x.refreshCache()},refreshAfterNavigation:()=>{x.navigationCommit()}},{softNavigationEvents:F}),_=Object.freeze({version:tr,configSignature:t,destroy:()=>{I(),x.destroy();let e=window;e.__livePreview===_&&delete e.__livePreview},refresh:()=>{x.refreshCache()},refreshAfterNavigation:()=>{x.navigationCommit()},enumerateOrigins:()=>P.enumerate(),inspect:()=>x.inspect()});try{Object.defineProperty(window,"__livePreview",{value:_,writable:!1,configurable:!0})}catch(e){throw I(),x.destroy(),e}}()})();'].join(""),t=Object.freeze({profile:"lean",source:e,contentHash:"6b33713fd3d8af18",integrity:"sha384-NtDU66nuh2ZMLAn+690yuxeVoS/XBrJgEi9eFE5F0+Ew3/j6MtoXU7dgwXfuomkB"});export{t as LEAN_RUNTIME};
|
|
2
2
|
//# sourceMappingURL=lean.js.map
|