payload-live-preview 2.0.2 → 2.0.4
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 +13 -8
- 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/sveltekit/index.js +1 -1
- package/dist/adapters/sveltekit/index.js.map +1 -1
- package/dist/client.cjs +1 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +10 -3
- package/dist/client.d.ts +10 -3
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/codegen-astro.js.map +1 -1
- package/dist/codegen-cli.js.map +1 -1
- package/dist/codegen.cjs +1 -1
- package/dist/codegen.cjs.map +1 -1
- package/dist/codegen.d.cts +1 -16
- package/dist/codegen.d.ts +1 -16
- package/dist/codegen.js +1 -1
- package/dist/codegen.js.map +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +13 -5
- package/dist/core.d.ts +13 -5
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/dist/doctor-cli.d.ts +1 -1
- package/dist/doctor-cli.js +1 -1
- package/dist/doctor-cli.js.map +1 -1
- package/dist/doctor.d.ts +2 -2
- package/dist/doctor.js +1 -1
- package/dist/doctor.js.map +1 -1
- package/dist/fragment.cjs +1 -1
- package/dist/fragment.cjs.map +1 -1
- package/dist/fragment.d.cts +5 -1
- package/dist/fragment.d.ts +5 -1
- package/dist/fragment.js +1 -1
- package/dist/fragment.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -5
- package/dist/index.d.ts +13 -5
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lean.cjs +1 -1
- package/dist/lean.cjs.map +1 -1
- package/dist/lean.js +1 -1
- package/dist/lean.js.map +1 -1
- package/dist/lexical.cjs +1 -1
- package/dist/lexical.cjs.map +1 -1
- package/dist/lexical.js +1 -1
- package/dist/lexical.js.map +1 -1
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.cjs.map +1 -1
- package/dist/plugins.d.cts +5 -1
- package/dist/plugins.d.ts +5 -1
- package/dist/plugins.js +1 -1
- package/dist/plugins.js.map +1 -1
- package/dist/{probe-DqaItcwX.d.ts → probe-Bzm4fYFL.d.ts} +11 -1
- package/dist/server.cjs +1 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/structural.cjs +2 -2
- package/dist/structural.cjs.map +1 -1
- package/dist/structural.js +2 -2
- package/dist/structural.js.map +1 -1
- package/package.json +1 -1
package/dist/lean.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=/* @__PURE__ */['(()=>{function e(e){return("object"==typeof e&&null!==e||"function"==typeof e)&&"function"==typeof e.then&&(Promise.resolve(e).catch(()=>{}),!0)}function t(t){return(...i)=>{try{e(t(...i))}catch{}}}function i(){}function n(e){return e.onUnfaithfulPatch??("ignore"===e.onUnboundChange?"ignore":"escalate")}function r(e,t,i,n){if(t.reportedUnfaithful.has(i.element))return;t.reportedUnfaithful.add(i.element),t.unfaithfulCount+=1,t.unfaithfulFields.add(i.fieldName);let r=e.onUnfaithfulPatch;if("ignore"!==r){if("warn"===r){e.warn(`[live-preview] LP0411: "${i.fieldName}" ${n}`);return}e.log("LP0411",i.fieldName,n),t.unfaithfulPatches.push(i)}}function o(e,t){return!e.unfaithfulFields.has(t)&&(e.unfaithfulFields.add(t),e.unfaithfulCount+=1,!0)}function l(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value:e.textContent}function a(e){let t=e.trim();return JSON.stringify(t.length>Bt?`${t.slice(0,Bt)}\\u2026`:t)}function s(){return function(){if(typ','eof document>"u")return;let e=document.documentElement.getAttribute("lang");return null===e||0===e.length?void 0:e}()??function(){if(typeof navigator>"u")return;let e=navigator.language;return"string"==typeof e&&e.length>0?e:void 0}()??"en"}function u(e){if(!Array.isArray(e))return[];let t=[];for(let i of e){let e=d(i);e&&t.push(e)}return t}function d(e){if("object"!=typeof e||null===e)return;let t=e,i=t.name,n=t.type;if("string"!=typeof i||0===i.length||"string"!=typeof n||0===n.length)return;let r=u(t.fields),o=function(e){if(!Array.isArray(e))return[];let t=[];for(let i of e){if("object"!=typeof i||null===i)continue;let e=i,n=e.slug;if("string"!=typeof n||0===n.length)continue;let r=u(e.fields);t.push({...e,slug:n,fields:r})}return t}(t.blocks),l={...t,name:i,type:n};return r.length>0?l.fields=r:delete l.fields,o.length>0?l.blocks=o:delete l.blocks,l}function c(e,t){return void 0===e||t(e)}function h(e,t){return null==e||t(e)}function f(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}function p(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),o=new Set;for(let e of zt)(n>=Vt[e].since||r.has(e))&&o.add(e);return{ours:4,...void 0!==i?{theirs:i}:{theirs:void 0},negotiated:n,capabilities:o,observed:r}}function m(e,t){return e.generation===t.generation&&e.revision===t.revision}function g(e){qt.has(e)||(qt.add(e),Nt(`[live-preview] LP0104: this page carries the lean runtime, which leaves out ${e} (${Ht[e]}). The elements are left as the server rendered them. Remove \\`runtime: LEAN_RUNTIME\\` to get the full runtime.`))}function v(e){return function(e){return!1!==e.enableA11y&&g("screen-reader announcements"),null}(e)}function y(e){if(typ','eof window>"u")return;let t=[];window.parent!==window&&t.push(window.parent),window.opener instanceof Window&&t.push(window.opener),Dt.sendReady(t,e)}function b(e,t=""){let i=new Map;return w(e,t,i),i}function w(e,t,i){for(let n of e){if(Gt.has(n.type)){n.fields&&w(n.fields,t,i);continue}let e=""===t?n.name:`${t}.${n.name}`;if(i.set(e,n),"group"===n.type)n.fields&&w(n.fields,e,i);else if("array"===n.type&&n.fields)w(n.fields,`${e}.*`,i);else if("blocks"===n.type&&n.blocks)for(let t of n.blocks)w(t.fields,`${e}.*.${t.slug}`,i)}}function S(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 T(e){if("string"!=typeof e)return!1;let t=e.trim().replace(Yt,"");if(0===t.length||Qt.test(t))return!1;if(t.startsWith("#")||t.startsWith("?")||Zt.test(t)||t.startsWith("/"))return!0;try{let e=new URL(t);return Kt.has(e.protocol)}catch{return Xt.test(t)}}function k(e){let t=e.trim().replace(Yt,"");return/^https?:\\/\\//i.test(t)||Zt.test(t)}function C(e){return ii.add(e),e}function $(e){switch(typeof e){case"string":return e.length>65536?void 0:`s:${e}`;case"number":return`n:${Object.is(e,-0)?"-0":String(e)}`;case"boolean":return"b:"+(e?"1":"0");case"bigint":return`i:${String(e)}`;case"undefined":return"u";case"object":{if(null===e)return"z";let t;try{t=JSON.stringify(e)}catch{return}return t.length>65536?void 0:`o:${t}`}case"symbol":case"function":return}}function F(e){return e.closest(`[${ri}]`)}function A(e){let t=e.getAttribute(oi);return null!==t&&t.length>0?"patch"===t||"fragment"===t||"route"===t?t:void 0:null!==F(e)?"fragment":null!==e.closest("head")?"route":"patch"}function R(e){return`global:${e}`}function N(e,t){return void 0===t||""===t?`collection:${e}`:`collection:${e}:${t}`}function M(e){return"string"==typeof e&&e.length>0}function x(e,t){return null!==t&&void 0!==e&&t.includes(e)}function E(e){let t=e.id;return"string"==typeof t&&t.length>0?t:"number"==typeof t&&Number.isFinite(t)?String(t):void 0}function O(e,t,i){let n=e.get(t);return void 0!==n&&(!1===i||n.some(e=>x(e.owner,i)))}function U(e,t,i){let n=`${t}.`;for(let[t,r]of e.entries())if(t.startsWith(n)&&(!1===i||r.some(e=>x(e.owner,i))))return!0;return!1}function P(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 L(e,t,i){let n;return r=>{if(O(e,r,i))return!0;let o=P(r,t);return!!(o!==r&&O(e,o,i)||U(e,r,i)||o!==r&&U(e,o,i))||(n??(n=function(e,t){let i=new Set;for(let[n,r]of e.entries())for(let e of r)!1!==t&&!x(e.owner,t)||void 0!==e.locale&&i.add(`${n}_${e.locale}`);return i}(e,i)),n.has(r))}}function I(e,t,i,n,r){return j(i)?!j(t)||function(e,t,i){let n=void 0===i?void 0:S(i,e);return void 0!==n&&!ai.has(n.type)||!0===t.get(e)?.some(_)||U(t,e,!1)}(e,n,r)?"keep":null==t?"ask":"own":"ask"}function _(e){return!ai.has(e.fieldType)}function j(e){return null===e||"object"!=typeof e&&"function"!=typeof e}function B(e){return!0===e?.includes(".")}function W(e){return null!==e&&e.forceRender&&!e.completed}function V(e){try{return!0===e.matchMedia?.("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function z(...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 D(e,t){let i={};for(let n of t)n!==e&&(i[n]=[e]);return i}function H(e){return"patch"===e.getAttribute(vi)}function q(e){return function(e){return"astro-island"===e.tagName.toLowerCase()||e.hasAttribute(vi)}(e)&&!H(e)}function G(e){return Bi.has(e)||ji.test(e)}function J(e){let t=e.getAttribute(wi);if(null!==t&&G(t))return t;if(e.hasAttribute(Ri))return"richText";if(e.hasAttribute(Ni))return"html";if(e.hasAttribute(xi))return"structural-array";if(e.hasAttribute(Mi))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 K(){return!0}function Q(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 X(e){return Q(e,128)&&!e.includes("?")&&!e.includes("#")}function Z(e){return e.has("schema-json")?Di:e.has("document-events")||e.has("relationship-events")?Hi:qi}function Y(e){if(e.nodeType!==Gi)return!1;let t=e;return t.hasAttribute(bi)||null!==t.querySelector(`[${bi}]`)}function ee(){if(typ','eof window>"u")return;let e=window;return e[Ki]??(e[Ki]={armed:!1,committed:!1,commits:[],onCommit:void 0,waiters:[]})}function te(){let e=ee();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{}let o=i?.containerInfo;void 0===e.onCommit?e.commits.push(o):e.onCommit(o)}}function ie(e){e.committed=!0;let t=e.waiters;e.waiters=[];for(let e of t)e()}function ne(e,t){let i=e.waiters.indexOf(t);i>=0&&e.waiters.splice(i,1)}function re(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,ne(e,r),t("timed-out")},i),()=>{null!==n&&clearTimeout(n),n=null,ne(e,r)}}function oe(){if(typ','eof window>"u")return;let e=window;return e[Zi]??(e[Zi]={armed:!1,committed:!1,waiters:[]})}function le(e){return Object.prototype.hasOwnProperty.call(e,Xi)?e[Xi]:void 0}function ae(){let e=oe();if(void 0===e||e.armed)return;e.armed=!0;let t=Element.prototype;void 0===Object.getOwnPropertyDescriptor(t,Xi)&&Object.defineProperty(t,Xi,{configurable:!0,get:()=>{},set(e){Object.defineProperty(this,Xi,{value:e,writable:!0,configurable:!0,enumerable:!0});let t=oe();void 0===t||t.committed||null===this.querySelector(Qi)||function(e,t){let i=t?.$nuxt;!0!==i?.isHydrating||"function"!=typeof i.hook?ie(e):i.hook(Yi,()=>{e.committed||ie(e)})}(t,e)}})}function se(e){if(void 0===e.hydration){e.startNow();return}let t=t=>{e.later(()=>{ue(e,t)})},i="react"===e.hydration?function(e,t=5e3){te();let i=ee();if(void 0===i)return null;if(void 0===i.onCommit){let e=e=>{!i.committed&&function(e){let t=e;return 9===t?.nodeType||null!=t?.querySelector?.(Qi)}(e)&&ie(i)};i.onCommit=e;for(let t of i.commits.splice(0))e(t)}return re(i,e,t)}(t):function(e,t,i=5e3){ae();let n=oe();return void 0===n?null:(!n.committed&&function(e){for(let t=e.querySelector(Qi);null!==t;t=t.parentElement)if(void 0!==le(t))return!0;return!1}(e)&&ie(n),re(n,t,i))}(e.root,t);null!==i?(e.defer(i),e.hydrated("waiting")):ue(e,"committed")}function ue(e,t){e.hydrated(t),"timed-out"===t&&e.warn(`[live-preview] LP0607: no ${"react"===e.hydration?"React commit":"Vue mount"} in ${String(5e3)} ms; started without waiting for hydration.`),e.startNow()}function de(e,t,i,n=!1){if(n&&void 0!==i){let n=ce(e,`${t}_${i}`);if(void 0!==n)return n}let r=ce(e,t);if(void 0!==r)return r;if(t.includes(".")){let i=e,n=!0;for(let e of t.split(".")){if(nn.has(e)||null===i||"object"!=typeof i){n=!1;break}if(i=ce(i,e),void 0===i){n=!1;break}}if(n)return i}return void 0===i?void 0:ce(e,`${t}_${i}`)}function ce(e,t){if(!nn.has(t)&&Object.prototype.hasOwnProperty.call(e,t))return e[t]}function he(e,t,i,n){return de(e,i,t.locale??n,void 0!==t.locale)}function fe(e,t,i,n){let r=$(t);if(void 0===r)return;let o=[e.hrefField,e.srcField,e.altField],l=r;for(let t of o){if(void 0===t||0===t.length)continue;let r=$(he(i,e,t,n));if(void 0===r)return;l+=`|${t}=${r}`}return l}function pe(e,t,i,n){let{warned:r,warn:o}=e;r.has(i)||t(i)||(r.add(i),o(`[live-preview] LP0201: no <\\u2026 data-payload-field="${P(i,n)}"> for field "${i}"; render the anchor unconditionally so edits to an empty field have somewhere to land.`))}function me(e){let t=typeof e;return"string"===t||"number"===t||"boolean"===t||"bigint"===t}function ge(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function ve(e){let t=function(){if(void 0!==bt)return bt;let e=function(){let e=globalThis.trustedTypes;return"object"!=typeof e||null===e?void 0:"function"==typeof e.createPolicy?e:void 0}();try{bt=void 0===e?null:e.createPolicy(rn,{createHTML:e=>e})}catch{bt=null}return bt}();return null===t?e:t.createHTML(e)}function ye(e){on.has(e)||(on.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(ln)?"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)":"List it in `allowedDataAttributes` if the page needs it, or set `sanitizerPolicy: \'compat\'` to keep every `data-*` as 1.x did"}(e)}.`))}function be(e,t,i){let n=we();if(!n)throw new Error("sanitizeHtml needs a DOM");if(""===e)return"";let r=function(e,t){let i=e?.policy??t??bn;if(!e){let e=new Map;for(let[t,i]of Object.entries(pn))e.set(t,i);return{allowedTags:an,attrByTag:e,allowFormControls:!1,templateMode:!1,mode:i,allowedData:new Set}}let n=new Set(an);if(e.additionalAllowedTags?.forEach(e=>n.add(e)),!0===e.allowFormControls)for(let e of sn)n.add(e);let r=new Map;for(let[e,t]of Object.entries(pn))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),o=n.createElement("template");return o.innerHTML=ve(e),Se(o.content,r),o.innerHTML}function we(){if(!(typ','eof document>"u"))return document}function Se(e,t){for(let i of Array.from(e.childNodes))i.nodeType===gn?Te(i,t):i.nodeType===vn&&i.remove()}function Te(e,t){let i=e.tagName.toLowerCase();!un.has(i)||t.allowFormControls&&sn.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("strict"===i.mode){if(i.templateMode&&yn.has(r))continue;if("id"===r||"name"===r||r.startsWith(fn)){e.removeAttribute(t.name),("name"!==r||!0===n?.has(r))&&ye(r);continue}if(r.startsWith(hn)){i.allowedData.has(r)||(e.removeAttribute(t.name),ye(r));continue}if(dn.has(r)||r.startsWith(cn))continue}else if(dn.has(r)||r.startsWith(cn)||r.startsWith(hn))continue;n?.has(r)?(mn.has(r)&&!T(t.value)||"srcset"===r&&!ke(t.value))&&e.removeAttribute(t.name):e.removeAttribute(t.name)}}}(e,i,t),"a"===i&&function(e){let t=e.getAttribute("href");null===t||!k(t)||(e.setAttribute("rel","noopener noreferrer"),e.hasAttribute("target")||e.setAttribute("target","_blank"))}(e),Se(e,t)):(Se(e,t),e.replaceWith(...e.childNodes)):e.remove()}function ke(e){for(let t of e.split(",")){let e=t.trim();if(0===e.length)continue;let[i=e]=e.split(/\\s/,1);if(!T(i))return!1}return!0}function Ce(e){return e.replace(Sn,e=>wn[e])}function $e(e){return e.replace(kn,e=>Tn[e])}function Fe(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 Ae(e){return null==e||""===e}function Re(e,t){let i=e.get(t);return void 0!==i&&(e.delete(t),e.set(t,i)),i}function Ne(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 Me(t,i,n,r,o){let l=t.transformValue;if(void 0===l)return n;try{let t=l(i.fieldName,n,{element:i.element,allFields:r},o),a=e(t);if(!o())return n;if(a)throw new TypeError(`Transform for "${i.fieldName}" returned a thenable; transforms must be synchronous`);return t}catch(e){if(!o())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 xe(e){return 9===e.nodeType}function Ee(e){return e.body}function Oe(){if(typ','eof window>"u")return!1;try{return window.self!==window.top}catch{return!0}}function Ue(e){let t=e.trim();if(0!==t.length)try{let e=new URL(t);return"http:"!==e.protocol&&"https:"!==e.protocol||!Mn.test(e.origin)?void 0:e.origin}catch{return}}function Pe(e){let t=e.format;return"string"==typeof t&&Pn.has(t)?t:"number"==typeof t?Un[t]:void 0}function Le(e){let t=e.indent;return"number"==typeof t&&t>0?t:0}function Ie(e){return"rtl"===e.direction?\' dir="rtl"\':"ltr"===e.direction?\' dir="ltr"\':""}function _e(e){let t=Pe(e),i=Le(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 je(e){return"object"==typeof e&&null!==e?e:void 0}function Be(e){return je(e)}function We(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-").toLowerCase()}function Ve(e){return"string"==typeof e&&e.length>0?e:void 0}function ze(e){let t=Ve(e.title)??Ve(e.name)??Ve(e.slug);return void 0!==t?t:void 0===e.id?void 0:String(e.id)}function De(e){if("string"==typeof e.text)return e.text;if(!e.children)return"";let t="";for(let i of e.children)t+=De(i);return t}function He(e){return`${"number"==typeof e.width?` width="${String(e.width)}"`:""}${"number"==typeof e.height?` height="${String(e.height)}"`:""}`}function qe(e){return"string"==typeof e.mimeType?` type="${$e(e.mimeType)}"`:""}function Ge(e){return jn.get(e)}function Je(e,t,i,n){let r=je(e.fields)??{},o="string"==typeof r.blockType?r.blockType:"",l=We(o),a=""===l?n:`${n} ${n}--${l}`;if(""!==o){let e=Ge(o)??Ge(l);if(e)return e(r,{renderChildren:t.renderChildren});t.onUnrenderedBlock?.(o,a)}return`<${i} class="${a}"></${i}>`}function Ke(e,t){return"number"==typeof t&&t>1?` ${e}="${String(t)}"`:""}function Qe(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 Xe(e,t){let i=function(e){return Vn.get(e)??Wn[e]}(e.type);return i?i(e,t):void 0!==e.children?t.renderChildren(e.children):""}function Ze(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+=Ze(i);return t}function Ye(e="text"){let t=new WeakSet;return{name:e,render:C((e,i)=>{let n=e.element,r=function(e){return null==e?"":Qe(e)?function(e){return Qe(e)?e.root.children.map(Ze).join("\\n").trim():""}(e):"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):JSON.stringify(e)}(i);if("INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName){if(function(e){return null!==e.querySelector(":scope > :not(br)")}(n)&&!n.hasAttribute(Dn))return function(e,t,i){e.has(t)||(e.add(t),Nt(`[live-preview] LP0402: Skipping text update for "${i}": <${t.tagName.toLowerCase()}> has structured children. Move data-payload-field to the value element, or add data-payload-text to replace them.`))}(t,n,e.fieldName),!1;r.includes("\\n")||r.includes("\\r")?n.innerHTML=ve(function(e){return Ce(e).replace(/\\r\\n|\\r|\\n/g,"<br>")}(r)):n.textContent=r}else n.value=r})}}function et(e,t){let i=e.cloneNode(!1);i.innerHTML=ve(t);let n=function(e,t){let i=e.firstElementChild;if(null!==i?.nextElementSibling||t.children.length<2||!Gn.has(i.tagName)||i.hasAttribute(bi))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,o=i.querySelectorAll(Bn);if(o.length>0&&null!==n.firstElementChild){let e=[];tt(n,i,e);for(let[t,i]of e)t.replaceWith(i),i.matches(Bn)||r.set(t.className,!1);for(let e of o)null!==e.parentNode&&r.set(e.className,!0)}return n.replaceChildren(...i.childNodes),r}function tt(e,t,i){if(e.children.length!==t.children.length)return;let n=e.firstElementChild,r=t.firstElementChild;for(;null!==n&&null!==r;)r.matches(Bn)?i.push([r,n]):tt(n,r,i),n=n.nextElementSibling,r=r.nextElementSibling}function it(e,t,i,n){n&&t.reportUnfaithful?.(e,`lost the markup the server drew for block "${i}"`);let r=n?qn:Hn;r.has(i)||(r.add(i),Nt(`[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 nt(e,t,i){return"string"!=typeof i||0===i.length?{kind:"none"}:T(i)?{kind:"safe",url:i}:(Qn.has(e)||(Qn.add(e),Nt(`[live-preview] LP0401: refused an unsafe URL for "${t}" on <${e.tagName.toLowerCase()}>; the attribute was cleared.`)),{kind:"unsafe"})}function rt(e,t=e=>e){return{name:e,render(e,i,n){let r=e.element;if(Ae(i)){!function(e){"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):e.value=""}(r);return}let o=Fe(i);if("INPUT"!==r.tagName&&"TEXTAREA"!==r.tagName){if("A"===r.tagName){let i=e.hrefField,l=void 0===i||0===i.length?t(o):de(n.allFields,i,n.locale,void 0!==e.locale),a=nt(r,e.fieldName,l);"safe"===a.kind?r.setAttribute("href",a.url):"unsafe"===a.kind&&r.removeAttribute("href")}r.textContent=o}else r.value=o}}}function ot(e){for(let t of er)e.removeAttribute(t)}function lt(e,t,i){e.src=t;let n=function(e){if(void 0===e?.sizes)return;let t=[];for(let i of Object.values(e.sizes))"string"!=typeof i.url||"number"!=typeof i.width||!T(i.url)||t.push(`${at(i.url)} ${String(i.width)}w`);return 0!==t.length?("number"==typeof e.width&&"string"==typeof e.url&&T(e.url)&&t.push(`${at(e.url)} ${String(e.width)}w`),t.join(", ")):void 0}(i);void 0!==n?e.setAttribute("srcset",n):(e.removeAttribute("srcset"),e.removeAttribute("sizes"))}function at(e){return e.replace(/[\\s,]/g,encodeURIComponent)}function st(e){"IMG"===e.tagName?ot(e):e.style.backgroundImage=""}function ut(e){"IMG"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):ot(e)}function dt(e){let t=je(e);return void 0===t?Fe(e):ze(t)??""}function ct(e,t){let i=e??"";if(null==t)return i;let n=ht(t);return"{}"===n?i:`${i}|${n}`}function ht(e){if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(e=>ht(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)}:${ht(i)}`)}return`{${n.join(",")}}`}function ft(e){return{kind:"date",options:e}}function pt(e){return{kind:"number",options:e}}function mt(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?ft({dateStyle:"medium"}):ur.has(n)?ft({dateStyle:n}):void 0;case"time":return void 0===n?ft({timeStyle:"short"}):dr.has(n)?ft({timeStyle:n}):void 0;case"datetime":return void 0===n?ft({dateStyle:"medium",timeStyle:"short"}):ur.has(n)?ft({dateStyle:n,timeStyle:"short"===n?"short":"medium"}):void 0;case"number":return void 0===n?pt({}):hr.test(n)?pt({minimumFractionDigits:Number(n),maximumFractionDigits:Number(n)}):void 0;case"currency":return void 0!==n&&cr.test(n)?pt({style:"currency",currency:n.toUpperCase()}):void 0;case"percent":return void 0===n?pt({style:"percent"}):void 0;default:return}}(t);if(void 0!==r)return r.kind===e?r.options:void 0;!function(e,t,i){fr.has(e)||(fr.add(e),Nt(`[live-preview] LP0408: data-payload-format="${i}" on "${t}" is not a known format; the default formatting was used. Known: date, date:short|medium|long|full, time, datetime, number, number:0-4, currency:XXX, percent.`))}(i,n,t)}function gt(e){return String(e).padStart(2,"0")}function vt(e,t){return{name:e,render(){g(t)}}}function yt(){return typeof __LIVE_PREVIEW_CONFIG__>"u"?[]:__LIVE_PREVIEW_CONFIG__}var bt,wt=Object.defineProperty,St=e=>{throw TypeError(e)},Tt=(e,t,i)=>((e,t,i)=>t in e?wt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i),kt=(e,t,i)=>t.has(e)||St("Cannot "+i),Ct=(e,t,i)=>(kt(e,t,"read from private field"),i?i.call(e):t.get(e)),$t=(e,t,i)=>t.has(e)?St("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),Ft=(e,t,i,n)=>(kt(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),At=(e,t,i)=>(kt(e,t,"access private method"),i),Rt=t((...e)=>console.error(...e)),Nt=t((...e)=>console.warn(...e)),Mt=t((...e)=>console.debug(...e)),xt=class{constructor(){$t(this,Ut);$t(this,Et,new Map);$t(this,Ot,new Map)}on(e,t){return At(this,Ut,Lt).call(this,Ct(this,Et),e,t)}once(e,t){return At(this,Ut,Lt).call(this,Ct(this,Ot),e,t)}off(e,t){At(this,Ut,It).call(this,Ct(this,Et),e,t),At(this,Ut,It).call(this,Ct(this,Ot),e,t)}async emit(e,t){await At(this,Ut,Pt).call(this,e,t)}async emitWhile(e,t,i){return At(this,Ut,Pt).call(this,e,t,i)}listenerCount(e){return(Ct(this,Et).get(e)?.size??0)+(Ct(this,Ot).get(e)?.size??0)}removeAllListeners(e){void 0!==e?(Ct(this,Et).delete(e),Ct(this,Ot).delete(e)):(Ct(this,Et).clear(),Ct(this,Ot).clear())}eventNames(){let e=new Set;for(let t of Ct(this,Et).keys())e.add(t);for(let t of Ct(this,Ot).keys())e.add(t);return[...e]}},Et=new WeakMap,Ot=new WeakMap,Ut=new WeakSet,Pt=async function(e,t,i){let n=()=>i?.()??!0;if(!n())return!1;let r=Ct(this,Et).get(e);if(r)for(let i of[...r])if(!n()||(await At(this,Ut,_t).call(this,i,t,e),!n()))return!1;if(!n())return!1;let o=Ct(this,Ot).get(e);if(o&&o.size>0){let i=[...o];Ct(this,Ot).delete(e);for(let r of i)if(!n()||(await At(this,Ut,_t).call(this,r,t,e),!n()))return!1}return n()},Lt=function(e,t,i){let n=e.get(t);return n||(n=new Set,e.set(t,n)),n.add(i),()=>{At(this,Ut,It).call(this,e,t,i)}},It=function(e,t,i){let n=e.get(t);void 0!==n&&(n.delete(i),0===n.size&&e.delete(t))},_t=async function(e,t,i){try{await e(t)}catch(e){let t="string"==typeof i||"number"==typeof i?String(i):"<event>";Rt(`[live-preview] LP0601: handler for "${t}" threw:`,e)}},jt=new Set(["date","number","checkbox"]),Bt=40,Wt=["data","fieldSchemaJSON","globalSlug","collectionSlug","locale","ready","previewToken","protocolVersion"],Vt={basic:{since:1},"schema-json":{since:2,observed:"schema"},locale:{since:2,observed:"locale"},"preview-token":{since:3,observed:"preview-token"},"nested-arrays":{since:4},"recursive-diffs":{since:4},"document-events":{since:4,observed:"document-event"},"relationship-events":{since:4,observed:"relationship-event"}},zt=Object.keys(Vt),Dt=class{constructor(e,t){Tt(this,"matcher");Tt(this,"handlers");Tt(this,"boundListener");Tt(this,"attachedTarget");Tt(this,"generation",0);Tt(this,"revision",0);Tt(this,"queueHead");Tt(this,"queueTail");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)}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&&!f(t.data))&&h(t.fieldSchemaJSON,e=>Array.isArray(e))&&h(t.globalSlug,e=>"string"==typeof e)&&h(t.collectionSlug,e=>"string"==typeof e)&&h(t.locale,e=>"string"==typeof e)&&h(t.ready,e=>"boolean"==typeof e)&&h(t.previewToken,e=>"string"==typeof e)&&h(t.protocolVersion,e=>"number"==typeof e)}(r)){this.reportInvalid("shape",n,t);return}this.dispatchUpdate(function(e){let t={...e};for(let e of Wt)null===Reflect.get(t,e)&&Reflect.deleteProperty(t,e);if(!Array.isArray(t.fieldSchemaJSON))return t;let i;try{i=u(t.fieldSchemaJSON)}catch{i=[]}return{...t,fieldSchemaJSON:i}}(r),n,t);return;case"payload-document-event":if(!function(e){let t=e;return c(t.action,e=>"updated"===e||"created"===e||"deleted"===e)&&c(t.slug,e=>"string"==typeof e)&&c(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=f(e.data);if(!this.isCurrentGeneration(i))return;let r=n?{generation:i,revision:this.revision+=1}:void 0,o=this.handlers.validateToken;if(!this.isCurrentGeneration(i))return;if(void 0===o){this.commitUpdate(e,t,i,r);return}if(!0===e.ready&&void 0===e.data){this.commitUpdate(e,t,i,void 0);return}let l={generation:i,message:e,origin:t,messageRevision:r,verdict:void 0,next:void 0};this.enqueue(l);let a;try{a=o(e.previewToken,t)}catch{this.settleValidation(l,!1);return}"boolean"!=typeof a?Promise.resolve(a).then(e=>{this.settleValidation(l,!0===e)},()=>{this.settleValidation(l,!1)}):this.settleValidation(l,a)}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){void 0===n?this.invokeHandler(i,this.handlers.onUpdate,e,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}},Ht={"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\'"},qt=new Set,Gt=new Set(["tabs","row","collapsible"]),Jt={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"},Kt=new Set(["http:","https:","mailto:","tel:"]),Qt=/^\\s*(?:javascript|data|vbscript|file|blob|about)\\s*:/i,Xt=/^(?:\\.{1,2}\\/|[a-zA-Z0-9_-]+\\/?)/,Zt=/^[\\\\/]{2}/,Yt=/[\\t\\n\\r]/g,ei=new Set(["style","srcdoc","formaction","form","id","name","is","srcset","imagesrcset"]),ti=new Set(["href","src","poster","cite","action","xlink:href","data"]),ii=new WeakSet,ni=class{constructor(){Tt(this,"previous",null)}diff(e,t){let i=this.previous,n=null===i,r=new Map,o=new Set;for(let[t,n]of Object.entries(e)){let e=$(n);r.set(t,e),(null===i||void 0===e||i.get(t)!==e)&&o.add(t)}if(null!==i)for(let e of i.keys())r.has(e)||o.add(e);this.previous=r;let l=new Set;for(let[e,i]of Object.entries(t))if(o.has(e))for(let e of i)l.add(e);return{changed:o,invalidated:l,baseline:n}}reset(){this.previous=null}},ri="data-payload-fragment",oi="data-payload-strategy",li=new Set(["id","_id","createdAt","updatedAt","createdBy","updatedBy","_status","globalType","collection","locale","localized"]),ai=new Set(["text","textarea","email","number","checkbox","date","select","radio","point","code","json","ui","html"]),si={},ui=class{constructor(){Tt(this,"rawChanges",new ni);Tt(this,"resolved",null);Tt(this,"queued",null);Tt(this,"pending",null);Tt(this,"timer",null);Tt(this,"openUntil",0)}decide(e,t){let i=t.message.data??{},{changed:n}=this.rawChanges.diff(i,si);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(_(e)||e.fieldName.includes(".")||B(e.hrefField)||B(e.srcField)||B(e.altField))return!0;return void 0!==e.strategies.fragment&&null!==e.root.querySelector(`[${ri}]`)}(e))return{merge:!1,fields:i};let r=this.resolved;if(null===r)return this.resolved=i,{merge:!0,fields:i};let o={...r},l=t.forceRender;for(let a of n){let n=i[a];if(li.has(a)){o[a]=n;continue}let s=I(a,r[a],n,e.cache,t.schemaIndex);"own"!==s&&(l=!0),"keep"!==s&&(o[a]=n)}return this.resolved=o,{merge:l,fields:o}}request(e,t,i){let n=Date.now();return n>=this.openUntil?(this.dropQueued(),this.openUntil=n+t,{leading:!0,result:e.merge(i)}):(this.queued=i,this.openUntil=n+t,this.pending??(this.pending=function(){let e;return{promise:new Promise(t=>{e=t}),settle:e}}()),null!==this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.flush(e)},t),{leading:!1,result:this.pending.promise})}recordMerged(e){this.resolved=e}destroy(){this.dropQueued(),this.openUntil=0}dropQueued(){null!==this.timer&&clearTimeout(this.timer),this.timer=null,this.queued=null,this.pending?.settle({status:"superseded"}),this.pending=null}flush(e){let t=this.pending,i=this.queued;this.timer=null,this.pending=null,this.queued=null,null!==t&&null!==i&&e.merge(i).then(t.settle,()=>{t.settle({status:"unavailable"})})}},di=class{constructor(){Tt(this,"negotiation",p(void 0));Tt(this,"observed",new Set)}observe(e,t){let i=e.filter(e=>!this.observed.has(e));if(0!==i.length){for(let e of i)this.observed.add(e);this.negotiation=p(this.negotiation.theirs,this.observed),t("protocol",`observed=${i.join(",")}`)}}applyVersion(e,t){let i=this.negotiation;if(i.theirs===e)return;let n=p(e,this.observed);this.negotiation=n,n.negotiated!==i.negotiated&&t("protocol","ours=4",`theirs=${e}`,`negotiated=${n.negotiated}`)}},ci=class{constructor(){Tt(this,"lastIdentity")}edit(e){let t=e.externallyUpdatedRelationship;if("object"!=typeof t||null===t)return null;let i=JSON.stringify([t.entitySlug,E(t),t.updatedAt]),n=i!==this.lastIdentity;return this.lastIdentity=i,n&&function(e,t){let i=t.globalSlug??t.collectionSlug;if("string"!=typeof i||e.entitySlug!==i)return!0;let n=E(e),r=E(t.data??{});return void 0!==n&&void 0!==r&&n!==r}(t,e)?t:null}},hi=class{constructor(){$t(this,fi)}reveal(e,t,i){return e===Ct(this,fi)?"skipped-same":(Ft(this,fi,e),function(e,t){return function(e,t){let i=e.getBoundingClientRect(),n=i.bottom>0&&i.top<t.innerHeight,r=i.right>0&&i.left<t.innerWidth;return n&&r}(e,t)?"already-visible":(e.scrollIntoView({behavior:V(t)?"auto":"smooth",block:"center"}),"revealed")}(t,i))}reset(){Ft(this,fi,void 0)}},fi=new WeakMap,pi=class{constructor(){Tt(this,"seen",new Map)}note(e,t,i){let n=$(i);if(void 0===n)return;let r=`${t.owner??""}\\0${t.locale??""}\\0${t.fieldName}`,o=this.seen.get(r);void 0!==o?o!==n&&(e.revealIdentities.push([r,n]),e.revealTarget??(e.revealTarget=t)):this.seen.set(r,n)}commit(e){for(let[t,i]of e.revealIdentities)this.seen.set(t,i);e.revealIdentities=[];let t=e.revealTarget;return e.revealTarget=void 0,t}},mi=class{constructor(){Tt(this,"started",!1);Tt(this,"suspended",!1);Tt(this,"deferredStart",null);Tt(this,"hydration","idle");Tt(this,"activeUpdate",null);Tt(this,"locale");Tt(this,"schema");Tt(this,"schemaIndex");Tt(this,"updateCount",0);Tt(this,"supersededCount",0);Tt(this,"completedCount",0);Tt(this,"skippedUnchangedCount",0);Tt(this,"lastFlush",null);Tt(this,"absentFields",new Set);Tt(this,"warnedOrphanFields",new Set);Tt(this,"warnedStrategy",new WeakSet);Tt(this,"warnedUnattributableMessage",!1);Tt(this,"warnedVisibilityGate",!1);Tt(this,"warnedFragmentFallback",!1);Tt(this,"warnedProtocolShape",!1);Tt(this,"reportedUnfaithful",new WeakSet);Tt(this,"checkedServerFormat",new WeakSet);Tt(this,"unfaithfulPatches",[]);Tt(this,"unfaithfulCount",0);Tt(this,"escalatedCount",0);Tt(this,"unfaithfulFields",new Set);Tt(this,"autoBindSearchMs");Tt(this,"autoBindGuesses",null);Tt(this,"warnedForeignSource",!1);Tt(this,"lastAppliedIdentity",new WeakMap);Tt(this,"revealLedger",new pi);Tt(this,"fragmentStats",{rendered:0,failed:0,superseded:0});Tt(this,"routeStats",{refreshes:0,failed:0,refused:0,loopStopped:0});Tt(this,"fragmentController",null);Tt(this,"routeController",null);Tt(this,"routeRetry",null);Tt(this,"readyTimers",[]);Tt(this,"revealer",new hi);Tt(this,"changes",new ni);Tt(this,"merges",new ui);Tt(this,"protocol",new di);Tt(this,"relationships",new ci)}isRunning(){return this.started}isCurrent(e){return this.started&&this.activeUpdate===e}complete(e){e.completed||(e.completed=!0,this.completedCount+=1)}abortStrategies(){null!==this.routeRetry&&(clearTimeout(this.routeRetry),this.routeRetry=null);for(let e of["fragmentController","routeController"]){let t=this[e];null!==t&&(this[e]=null,t.abort())}}},gi=class{constructor(e,t){Tt(this,"deps",e);Tt(this,"state",t);Tt(this,"instanceContext");this.instanceContext=function(e){let t={};for(let[i,n]of Object.entries(e))void 0!==n&&(t[i]=n);return t}({renderRichText:e.renderRichText,sanitizerPolicy:e.sanitizerPolicy,reportUnfaithful:(i,n)=>{r(e,t,i,n)}})}apply(e){let{deps:t,state:i}=this,n=i.activeUpdate;if(null===n||void 0===e.revision||!m(n.revision,e.revision)||!i.isCurrent(n))return!1;let{target:o,value:s}=e,u=void 0!==n.schemaIndex?S(n.schemaIndex,o.fieldName):void 0,d=function(e,t){if(e.explicitFieldType)return e.fieldType;if(void 0!==t){let e=function(e){if(Object.prototype.hasOwnProperty.call(Jt,e))return Jt[e]}(t);if(void 0!==e)return e}return e.fieldType}(o,u?.type);"text"===d&&!0!==o.explicitFieldType&&function(e){if("object"!=typeof e||null===e||!("root"in e))return!1;let t=e.root;return"object"==typeof t&&null!==t&&Array.isArray(t.children)}(s)&&(d="richText");let c;try{c=t.resolveRenderer(d,o)}catch(e){return this.fail(n,e)}if(!i.isCurrent(n))return!1;let h=t.emitter.listenerCount("elementUpdate")>0,f=h?function(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value:"IMG"===e.tagName?e.src:e.textContent}(o.element):void 0;if(!i.isCurrent(n))return!1;let p={allFields:e.allFields,locale:o.locale??n.locale,schema:u,...this.instanceContext};!0===o.hidesWhenEmpty&&o.element.toggleAttribute("hidden",function(e){return null==e||("string"==typeof e?0===e.trim().length:Array.isArray(e)&&0===e.length)}(s));try{if(void 0!==o.targetAttribute){if("blocked"===function(e,t,i){let n=t.toLowerCase().trim();if(0===n.length||!function(e){return!e.startsWith("on")&&!ei.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 ti.has(n)&&!T(r)?"blocked":(e.setAttribute(n,r),"applied")}(o.element,o.targetAttribute,s))return t.warn(`[live-preview] LP0401: refused to write "${o.fieldName}" into attribute "${o.targetAttribute}"`),!1}else{if(void 0===c)return t.log("no renderer for",d),r(t,i,o,`has no renderer for "${d}"`),!1;{let e=function(e,t,i,n){if("ignore"===e.onUnfaithfulPatch||void 0!==i.format||!jt.has(n)||t.checkedServerFormat.has(i.element))return;t.checkedServerFormat.add(i.element);let r=l(i.element);return r.trim().length>0?r:void 0}(t,i,o,d);if(!1===function(e,t,i,n){return e.render(t,i,n)}(c,o,s,p)&&function(e){return ii.has(e.render)}(c))return r(t,i,o,`is a value ${c.name} cannot render`),!1;void 0!==e&&function(e,t,i){let n=l(t.element);n!==i&&e.warn(`[live-preview] LP0412: "${t.fieldName}" showed ${a(i)}, the patch wrote ${a(n)} \\u2014 either an edit that arrived before the preview connected, or a template that formats this value differently. Set data-payload-format to match it.`)}(t,o,e)}}}catch(e){return this.fail(n,e)}if(!i.isCurrent(n))return!1;h&&t.emitter.emitWhile("elementUpdate",{element:o.element,fieldName:o.fieldName,previousValue:f,nextValue:s,revision:n.revision.revision,receivedAt:n.receivedAt,source:"patch"},()=>i.isCurrent(n));let g=i.isCurrent(n);return g&&(void 0!==e.valueIdentity?i.lastAppliedIdentity.set(o.element,e.valueIdentity):i.lastAppliedIdentity.delete(o.element)),g}fail(e,t){if(!this.state.isCurrent(e))return!1;let i=t instanceof Error?t:new Error(String(t));return this.deps.emitter.emitWhile("error",{error:i,context:"renderer",code:"LP0603"},()=>this.state.isCurrent(e)),!1}},vi="data-payload-island",yi=`astro-island, [${vi}]`,bi="data-payload-field",wi="data-payload-type",Si="data-payload-attribute",Ti="data-payload-href",ki="data-payload-src",Ci="data-payload-alt",$i="data-payload-array-template",Fi="data-payload-array-separator",Ai="data-payload-locale",Ri="data-payload-richtext",Ni="data-payload-html",Mi="data-payload-array",xi="data-payload-structural",Ei="data-payload-owner",Oi="data-payload-depends",Ui="data-payload-strategy",Pi="data-payload-boundary",Li=[bi,wi,Si,Ti,ki,Ci,$i,Fi,Ai,Ri,Ni,Mi,xi,Ei,Oi,Ui,Pi,"type"],Ii=`[${bi}]`,_i=`[${Ei}]`,ji=/^[a-z][a-z0-9-]*:[a-z][a-z0-9-]*$/i,Bi=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"]),Wi=class{constructor(e={}){Tt(this,"entriesByField",new Map);Tt(this,"entryByElement",new WeakMap);Tt(this,"filter");Tt(this,"count",0);Tt(this,"dependencies",null);Tt(this,"islandRoots",[]);this.filter=e.filter??K}dependencyMap(){if(null!==this.dependencies)return this.dependencies;let e=[];for(let t of this.values())void 0!==t.dependsOn&&e.push(D(t.fieldName,t.dependsOn));return this.dependencies=z(...e),this.dependencies}get islands(){return this.islandRoots}buildFromRoot(e){let t=performance.now();this.clear();let i=0;for(let t of e.querySelectorAll(Ii))void 0!==this.add(t)&&(i+=1);return this.islandRoots=function(e){let t=[];for(let i of e.querySelectorAll(yi))H(i)||t.push(i);return t}(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=[]}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(bi);if(null===t||0===t.length)return;let i=e.getAttribute(wi),n=e.getAttribute(Si),r=e.getAttribute(Ti),o=e.getAttribute(ki),l=e.getAttribute(Ci),a=e.getAttribute($i),s=e.getAttribute(Fi),u=e.getAttribute(Ai),d=e.getAttribute("data-payload-format"),c=function(e){let t=e.closest(_i)?.getAttribute(Ei);return null==t||0===t.length?void 0:t}(e),h=function(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}(e.getAttribute(Oi)),f=e.getAttribute(Ui),p=e.getAttribute("data-payload-guessed"),m=F(e);return{element:e,fieldName:t,fieldType:J(e),explicitFieldType:null!==i&&G(i),strategyKind:A(e)??"unknown",...null!==m?{fragmentBoundary:m}:{},...null!==n&&n.length>0?{targetAttribute:n}:{},...null!==r&&r.length>0?{hrefField:r}:{},...null!==o&&o.length>0?{srcField:o}:{},...null!==l&&l.length>0?{altField:l}:{},...null!==a?{arrayTemplate:a}:{},...null!==s?{arraySeparator:s}:{},...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(Pi)?{hidesWhenEmpty:!0}:{},...null!==p?{guessed:p}:{}}}},Vi=class{constructor(e){Tt(this,"serverURL");Tt(this,"apiRoute");Tt(this,"depth");Tt(this,"fetchFn");Tt(this,"log");Tt(this,"inflight",null);Tt(this,"attempt",0);Tt(this,"destroyDepth",0);this.serverURL=function(e){let t=e.length;for(;e.endsWith("/",t);)t-=1;return e.slice(0,t)}(e.serverURL);let n=e.apiRoute??"/api";this.apiRoute=n.startsWith("/")?n:`/${n}`,this.depth=e.depth??1,this.fetchFn=e.fetchFn,this.log=t(e.log??i)}canMerge(e){return null!==this.endpointOf(e)}endpointOf(e){try{let t=e.globalSlug;if(t)return X(t)?`globals/${encodeURIComponent(t)}`:null;let i=e.collectionSlug??"",n=e.data.id;return X(i)&&function(e){return"number"==typeof e?Number.isFinite(e):"string"==typeof e&&Q(e,512)}(n)?`${encodeURIComponent(i)}/${encodeURIComponent(String(n))}`:null}catch{return null}}async merge(e){if(this.destroyDepth>0)return{status:"superseded"};let t=this.attempt+=1,i=this.inflight;this.inflight=null;let n=null,r=()=>this.attempt!==t;try{if(i?.abort(),r())return{status:"superseded"};let t=this.endpointOf(e);if(null===t)return r()?{status:"superseded"}:{status:"unavailable"};let o=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(void 0===o)return{status:"unavailable"};n=new AbortController,this.inflight=n;let l=`${this.serverURL}${this.apiRoute}/${t}`,a=await o(l,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","X-Payload-HTTP-Method-Override":"GET"},body:JSON.stringify({data:e.data,depth:this.depth,flattenLocales:!1,locale:e.locale}),signal:n.signal});if(r())return{status:"superseded"};if(!a.ok)return this.log("merge HTTP",a.status,l),{status:"unavailable"};let s=await a.json();return r()?{status:"superseded"}:null===s||"object"!=typeof s||Array.isArray(s)?(this.log("merge invalid",l),{status:"unavailable"}):{status:"merged",doc:s}}catch(e){return r()?{status:"superseded"}:(this.log("merge exception",e),{status:"unavailable"})}finally{this.inflight===n&&(this.inflight=null)}}destroy(){this.attempt+=1;let e=this.inflight;this.inflight=null,this.destroyDepth+=1;try{e?.abort()}finally{this.destroyDepth-=1}}},zi="2.0.2",Di={name:"payload-2",fieldTyping:"schema",populatesRelationships:"admin",documentEvents:!1},Hi={name:"payload-3",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!0},qi={name:"unknown",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!1},Gi=1,Ji=class{constructor(e,t={}){Tt(this,"callbacks");Tt(this,"debounceMs");Tt(this,"rootMargin");Tt(this,"visible",new Set);Tt(this,"mutation",null);Tt(this,"intersection",null);Tt(this,"debounceTimer",null);Tt(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:[...Li]})}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)||!function(e){for(let t of e){if("attributes"===t.type&&null!==t.attributeName&&Li.includes(t.attributeName)&&(t.attributeName===bi||t.attributeName===Ei||t.target.nodeType===Gi&&t.target.hasAttribute(bi)))return!0;for(let e of t.addedNodes)if(Y(e))return!0;for(let e of t.removedNodes)if(Y(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}},Ki="__livePreviewHydration",Qi="[data-payload-field]",Xi="__vue_app__",Zi="__livePreviewVueHydration",Yi="app:suspense:resolve",en=class{constructor(e){Tt(this,"timeoutMs");Tt(this,"onTimeout");Tt(this,"handle",null);Tt(this,"lastKick",0);this.timeoutMs=e.timeoutMs??0,this.onTimeout=e.onTimeout}kick(){if(this.lastKick=Date.now(),this.timeoutMs<=0)return;null!==this.handle&&clearTimeout(this.handle);let e=setTimeout(()=>{this.handle===e&&(this.handle=null,this.onTimeout())},this.timeoutMs);this.handle=e}stop(){null!==this.handle&&(clearTimeout(this.handle),this.handle=null)}get lastKickAt(){return this.lastKick}get pending(){return null!==this.handle}},tn=class{constructor(){Tt(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)}},nn=new Set(["__proto__","prototype","constructor"]),rn="payload-live-preview",on=new Set,ln="data-payload-",an=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"]),sn=new Set(["input","button","textarea","select","option","label"]),un=new Set(["script","style","iframe","object","embed","link","meta","base","form","input","button","select","textarea","svg","math","template","frame","frameset","noframes","noscript"]),dn=new Set(["id","class","lang","dir","title","role","tabindex"]),cn="aria-",hn="data-",fn="data-payload-",pn={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"])},mn=new Set(["href","src","cite","poster"]),gn=1,vn=8,yn=(Error,new Set(["id","name","data-payload-key","data-payload-nested-key","data-payload-nested-template"])),bn="strict",wn=(Object.freeze({allowedTags:an,removeCompletely:un,globalAttributes:dn,attributesByTag:pn,urlAttributes:mn}),Object.freeze({"&":"&","<":"<",">":">",\'"\':""","\'":"'","/":"/","`":"`","=":"="})),Sn=/[&<>"\'/`=]/g,Tn=Object.freeze({"&":"&","<":"<",">":">",\'"\':""","\'":"'"}),kn=/[&<>"\']/g,Cn=new Set,$n=class{constructor(e,t,i){Tt(this,"deps",e);Tt(this,"state",t);Tt(this,"strategies");this.strategies=function(e,t){return{planFragments:()=>null,escalateUnfaithful:()=>{},hasUnboundChange:(i,n)=>{if(i.baseline)return!1;let r=function(e,t,i,n){let r=L(e,i,n),o=[];for(let e of t)!li.has(e)&&!r(e)&&o.push(e);return o}(e.cache,i.touched,i.locale,n);for(let e of r)o(t,e);return!1},hasRouteBinding:()=>!1,runFragments:()=>Promise.resolve(),refreshRoute:()=>(g("route refreshes"),Promise.resolve()),warnFragmentFallback:i=>{g("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)}handleUpdate(e,t,i){let{deps:n,state:r}=this;if(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),void 0===e.data){void 0!==e.protocolVersion&&r.protocol.applyVersion(e.protocolVersion,n.log);return}if(void 0===i)return;let o=r.relationships.edit(e);null!==o&&n.emitter.emit("relationshipUpdate",{detail:o,timestamp:Date.now()}),"string"==typeof e.locale&&(r.locale=e.locale),Array.isArray(e.fieldSchemaJSON)&&(r.schema=e.fieldSchemaJSON,r.schemaIndex=b(e.fieldSchemaJSON));let l={revision:i,message:e,locale:r.locale,schema:r.schema,schemaIndex:r.schemaIndex,receivedAt:Date.now(),forceRender:null!==o||W(r.activeUpdate),touched:new Set,baseline:!1,invalidated:new Set,revealTarget:void 0,revealIdentities:[],pendingFragments:0,routeRefreshed:!1,cancelled:!1,completed:!1},a=r.activeUpdate;r.abortStrategies(),null!==a&&!a.completed&&(r.supersededCount+=1),r.activeUpdate=l,n.scheduler.acceptRevision(i),r.updateCount+=1,(void 0===e.protocolVersion||(r.protocol.applyVersion(e.protocolVersion,n.log),r.isCurrent(l)))&&(n.connection.markConnected()&&(n.a11y?.announceConnected(),n.emitter.emit("connect",{origin:t,timestamp:Date.now()}),!r.isCurrent(l)||(n.log("connection","disconnected","\\u2192","connected"),!r.isCurrent(l)))||this.processUpdate(l).catch(e=>{n.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,o=z(n.dependencies,n.cache.dependencyMap()),l=r.changes.diff(t.fields,o);l.baseline&&!i&&"off"!==n.autoBind&&g("auto-binding"),e.baseline=l.baseline,e.invalidated=i?Cn:l.invalidated,e.touched=i?Cn:new Set([...l.changed,...l.invalidated]),this.scheduleAllFields(e,t)}async resolveIncomingFields(e){let{deps:t,state:i}=this,n=e.message.data??{};if(null===t.merger||"admin"===Z(i.protocol.observed).populatesRelationships)return n;let r=i.merges.decide(t,e);if(!r.merge)return r.fields;let{message:o}=e,l=i.merges.request(t.merger,t.mergeWindowMs,{collectionSlug:o.collectionSlug,globalSlug:o.globalSlug,data:n,locale:e.locale});if(!l.leading)return this.applyMerged(e,l.result).catch(e=>{t.log("update failed:",e)}),r.fields;let a=await l.result;return i.isCurrent(e)?"merged"===a.status?(i.merges.recordMerged(a.doc),a.doc):"superseded"===a.status?null:r.fields:null}async applyMerged(e,t){let{state:i}=this,n=await t;"merged"!==n.status||!i.isCurrent(e)||(i.merges.recordMerged(n.doc),this.applyFields(e,this.dataFor(e,n.doc),!0))}scheduleAllFields(e,t){let{deps:i,state:n}=this;if(!n.isCurrent(e))return;let r=()=>n.isCurrent(e),o=this.ownerKeysForUpdate(e,t.fields),{touched:l}=e,a=i.strategies.route,s=this.strategies.hasUnboundChange(e,o);if(void 0!==a&&!e.routeRefreshed&&(s||a.plan(i.root,l)||this.strategies.hasRouteBinding(l))){this.strategies.refreshRoute(e,t,a);return}let u=this.strategies.planFragments(l),d=i.skipUnchanged,c=0;for(let[l,a]of i.cache.entries()){if(!r())return;for(let s of a){if(!1!==o&&!x(s.owner,o))continue;if(!0===u?.covers(s)){if(i.revealEditedField){let i=he(t.fields,s,l,e.locale);n.revealLedger.note(e,s,i)}continue}let a=s.strategyKind??A(s.element)??"unknown";if("unknown"===a){this.strategies.warnUnsupportedStrategy(s);continue}"fragment"===a&&null===u&&this.strategies.warnFragmentFallback(s);let h=he(t.fields,s,l,e.locale);if(void 0===h){n.absentFields.add(l);continue}if(i.revealEditedField&&n.revealLedger.note(e,s,h),!r())return;let f=Me(i,s,h,t.fields,r);if(!r())return;let p=d?fe(s,f,t.fields,e.locale):void 0,m=n.lastAppliedIdentity.get(s.element);if(!e.forceRender&&i.skipUnchanged&&void 0!==p&&m===p&&!e.invalidated.has(l)){n.skippedUnchangedCount+=1;continue}let g={target:s,value:f,allFields:t.fields,revision:e.revision,data:t,valueIdentity:p};i.scheduler.schedule(g),c+=1}}(function(e,t,i,n){let{cache:r}=e;if(0===r.fieldCount||!1!==n&&!function(e,t){for(let i of e.values())if(x(i.owner,t))return!0;return!1}(r,n))return;let o=L(r,i,n);for(let[n,r]of Object.entries(t)){if(li.has(n))continue;if(me(r)){pe(e,o,n,i);continue}if(!ge(r)||o(n))continue;let t=P(n,i);for(let[n,l]of Object.entries(r))!me(l)||li.has(n)||pe(e,o,`${t}.${n}`,i)}})({cache:i.cache,warned:n.warnedOrphanFields,warn:i.warn},t.fields,e.locale,o),null!==u&&u.boundaries.length>0&&(e.pendingFragments=u.boundaries.length,this.strategies.runFragments(e,t,u)),0===c&&0===e.pendingFragments&&(n.complete(e),this.revealPending(e))}restoreGuesses(e,t){let{deps:i,state:n}=this;"off"===i.autoBind||n.autoBindGuesses}ownerKeysForUpdate(e,t){let{deps:i,state:n}=this;if(!i.scopeBindingsByOwner)return!1;let{message:r}=e,o=function(e){if(M(e.globalSlug))return[R(e.globalSlug)];if(!M(e.collectionSlug))return null;let t=N(e.collectionSlug);return M(e.documentId)?[t,N(e.collectionSlug,e.documentId)]:[t]}({globalSlug:"string"==typeof r.globalSlug?r.globalSlug:void 0,collectionSlug:"string"==typeof r.collectionSlug?r.collectionSlug:void 0,documentId:E(t)});return null===o&&!n.warnedUnattributableMessage&&(n.warnedUnattributableMessage=!0,i.warn("[live-preview] LP0202: scopeBindingsByOwner: update names no document; nothing applied")),o}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 o=i.activeUpdate;if(null===o||!i.isCurrent(o)||!m(o.revision,n))return;0===o.pendingFragments&&i.complete(o);let l=()=>i.isCurrent(o)&&m(o.revision,n);if(this.revealPending(o),!l())return;let a=i.unfaithfulPatches;a.length>0&&(i.unfaithfulPatches=[],void 0!==r&&this.strategies.escalateUnfaithful(o,r,a),!l())||0===e.applied||void 0===r||(t.a11y?.announceUpdate(e.applied),l()&&(function(e,t){for(let i of e)i.dispatchEvent(new CustomEvent("payload-live-preview:update",{detail:t,bubbles:!1}));e.length}(t.cache.islands,{fields:r.fields,revision:n.revision,receivedAt:o.receivedAt,locale:o.locale}),l()&&0!==t.emitter.listenerCount("afterUpdate")&&t.emitter.emitWhile("afterUpdate",{data:r,updatedCount:e.applied,durationMs:e.durationMs,revision:n.revision,receivedAt:o.receivedAt,source:"patch"},l)))}revealPending(e){let t=this.state.revealLedger.commit(e);if(void 0!==t)try{this.revealBinding(t)}catch(e){this.deps.log("reveal",e)}}revealField(e){let t=this.deps.cache.get(e)?.[0];return void 0===t?"no-element":this.revealBinding(t)}revealBinding(e){let{element:t}=e,i=t.ownerDocument.defaultView;if(null===i)return"no-element";let n=`${e.owner??""} ${e.fieldName}`;return this.state.revealer.reveal(n,t,i)}},Fn=class{constructor(e,t){Tt(this,"apply");Tt(this,"debounceMs");Tt(this,"maxWaitMs");Tt(this,"isVisible");Tt(this,"gateThresholdValue");Tt(this,"gateDisabled");Tt(this,"getCacheSize");Tt(this,"onFlush");Tt(this,"scheduleFrame");Tt(this,"cancelFrame");Tt(this,"pending",new Map);Tt(this,"replay",new Map);Tt(this,"activeFlushes",new Set);Tt(this,"debounceTimer",null);Tt(this,"debounceToken",0);Tt(this,"deadlineTimer",null);Tt(this,"frameHandle",null);Tt(this,"frameToken",0);Tt(this,"windowUntil",0);Tt(this,"activeRevision",null);Tt(this,"activeRevisionCancelled",!1);this.apply=e,this.debounceMs=t.debounceMs??50,this.maxWaitMs=t.maxWaitMs??4*this.debounceMs,this.isVisible=t.isVisible,this.gateThresholdValue=t.visibilityGateThreshold??50,this.gateDisabled=t.disableVisibilityGate??!1,this.getCacheSize=t.getCacheSize,this.onFlush=t.onFlush,this.scheduleFrame=t.scheduleFrame??("function"==typeof requestAnimationFrame?requestAnimationFrame.bind(globalThis):e=>setTimeout(()=>{e(performance.now())},0)),this.cancelFrame=t.cancelFrame??("function"==typeof cancelAnimationFrame?cancelAnimationFrame.bind(globalThis):e=>{clearTimeout(e)})}schedule(e){if(void 0!==e.revision&&(this.activeRevisionCancelled||null===this.activeRevision||!m(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){null!==this.activeRevision&&m(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.cancelScheduledWork(),this.clearWork(),this.activeRevision=e,this.activeRevisionCancelled=!1)}cancelRevision(e){null===this.activeRevision||!m(e,this.activeRevision)||(this.cancelScheduledWork(),this.clearWork(),this.activeRevisionCancelled=!0)}flushNow(){return this.cancelScheduledWork(),this.flush()}notifyVisible(e){let t=this.replay.get(e);if(!t||(this.replay.delete(e),!this.isCurrent(t)))return;let 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(){this.cancelScheduledWork(),this.clearWork(),this.activeRevision=null,this.activeRevisionCancelled=!1,this.windowUntil=0}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,null!==t&&this.cancelFrame(t),this.frameToken!==e)return;let i=!1,n=this.scheduleFrame(()=>{this.frameToken===e&&(i=!0,this.frameHandle=null,this.flush())});!i&&this.frameToken===e&&(this.frameHandle=n)}flush(){let e=performance.now();this.clearDeadline();let t=this.gateActive,i=this.pending;this.pending=new Map;let n,r=0,o=[],l=0;this.activeFlushes.add(i);try{for(let e of i.values()){if(!this.isCurrent(e))continue;let i=!t||this.isVisible(e.target.element);if(this.isCurrent(e)){if(n??(n=e),!i){this.replay.set(e.target.element,e),l+=1;continue}this.replay.delete(e.target.element),this.didApply(e)&&(r+=1,o.push(e.target.fieldName))}}}finally{this.activeFlushes.delete(i)}let a=this.statsFor(n,r,l,performance.now()-e,o);return this.onFlush?.(a),a}isCurrent(e){return void 0===e.revision||!this.activeRevisionCancelled&&null!==this.activeRevision&&m(e.revision,this.activeRevision)}didApply(e){return!1!==this.apply(e)||!function(e){return ii.has(e)}(this.apply)}retargetBuffer(e,t){let i=e.get(t.element);if(void 0!==i){if(i.target.fieldName!==t.fieldName||i.target.locale!==t.locale){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(),null!==e&&clearTimeout(e),null!==t&&this.cancelFrame(t)}},An=[0,500,1e3,2e3],Rn=class{constructor(e){Tt(this,"deps");Tt(this,"state",new mi);Tt(this,"pipeline");Tt(this,"writer");Tt(this,"rootSentinel",null);Tt(this,"observedRoot",null);let{emitter:r,renderers:o}=e,l=void 0===e.log?i:t(e.log),a=void 0===e.warn?Nt:t(e.warn),s=e.root??(typ','eof document<"u"?document:void 0);if(void 0===s)throw new Error("LivePreviewRuntime: no document; pass options.root");let u=new Wi({filter:e=>!function(e){let t=e;for(;null!==t;){if(q(t))return!0;t=t.parentElement}return!1}(e)}),d=new Ji({onStructuralChange:()=>{this.rebuildCache()},onVisibilityChange:(e,t)=>{t&&c.notifyVisible(e)}},void 0!==e.intersectionRootMargin?{intersectionRootMargin:e.intersectionRootMargin}:{}),c=new Fn(C(e=>this.writer.apply(e)),{...void 0!==e.debounceMs?{debounceMs:e.debounceMs}:{},...void 0!==e.disableVisibilityGate?{disableVisibilityGate:e.disableVisibilityGate}:{},...void 0!==e.visibilityGateThreshold?{visibilityGateThreshold:e.visibilityGateThreshold}:{},isVisible:e=>d.isVisible(e),getCacheSize:()=>u.elementCount,onFlush:e=>{this.pipeline.onFlush(e)}}),h=new Dt(e.originMatcher,{onUpdate:(e,t,i)=>{this.pipeline.handleUpdate(e,t,i)},onDocumentEvent:()=>{this.state.protocol.observe(["document-events"],l),r.emit("documentSave",{timestamp:Date.now()})},onFocusField:e=>{this.deps.revealEditedField&&this.pipeline.revealField(e)},onInvalid:(e,t)=>{if("token"===e){let e=new Error(`Preview token rejected (origin: ${t})`);r.emit("error",{error:e,context:"token",code:"LP0502"})}("shape"===e||"type"===e)&&!this.state.warnedProtocolShape&&(this.state.warnedProtocolShape=!0,a(`[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,a(`[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.`)),l("LP0501 message rejected:",e,t)},...void 0!==e.validateToken?{validateToken:e.validateToken}:{},...void 0!==e.eventSourcePolicy?{sourcePolicy:e.eventSourcePolicy}:{}}),f=e.dataMerge;this.deps={emitter:r,cache:u,observers:d,scheduler:c,bus:h,connection:new tn,heartbeat:new en({...void 0!==e.heartbeatMs?{timeoutMs:e.heartbeatMs}:{},onTimeout:()=>{this.onHeartbeatTimeout()}}),renderers:o,resolveRenderer:e.resolveRenderer??(e=>o[e]),transformValue:e.transformValue,renderRichText:e.renderRichText,sanitizerPolicy:e.sanitizerPolicy,root:s,readyTargets:"function"==typeof e.readyTargets?e.readyTargets:(e=>()=>e)(e.readyTargets),sendReady:e.sendReady??y,onHeartbeatTimeout:e.onHeartbeatTimeout,log:l,warn:a,a11y:v(e),merger:void 0===f?null:new Vi({serverURL:f.serverURL,...void 0!==f.apiRoute?{apiRoute:f.apiRoute}:{},...void 0!==f.depth?{depth:f.depth}:{},...void 0!==f.fetchFn?{fetchFn:f.fetchFn}:{},log:l}),mergeWindowMs:e.debounceMs??50,scopeBindingsByOwner:!0===e.scopeBindingsByOwner,lockedOrigin:e.lockedOrigin??(()=>{}),skipUnchanged:!0===e.skipUnchanged,dependencies:e.dependencies??{},strategies:e.strategies??{},revealEditedField:!0===e.revealEditedField,onUnfaithfulPatch:n(e),autoBind:e.autoBind??"off",hydration:e.hydration},this.writer=new gi(this.deps,this.state),this.pipeline=new $n(this.deps,this.state,()=>{this.rebuildCache()})}start(){let{state:e}=this;if(e.isRunning())return!1;e.started=!0,e.suspended=!1;try{return function(e){"react"===e.hydration?te():"vue"===e.hydration&&ae();let{root:t}=e;if(!function(e){return 9===e.nodeType}(t)||"loading"!==t.readyState){se(e);return}let i=()=>{e.isRunning()&&e.later(()=>{se(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},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=xe(t.root)?Ee(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()))for(let i of An){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,i&&t.emitter.emit("disconnect",{reason:"destroy",timestamp:Date.now()}),t.a11y?.detach(),t.emitter.emit("destroy",{timestamp:Date.now()})}release(){let{state:e,deps:t}=this;e.activeUpdate=null,e.started=!1;let i=e.deferredStart;e.deferredStart=null,null!==i&&this.runCleanup(i);for(let t of e.readyTimers)this.runCleanup(()=>{clearTimeout(t)});return e.readyTimers.length=0,this.runCleanup(()=>{t.heartbeat.stop()}),this.runCleanup(()=>{t.bus.detach()}),e.abortStrategies(),this.runCleanup(()=>{this.rootSentinel?.disconnect(),this.rootSentinel=null,this.observedRoot=null}),this.runCleanup(()=>{t.observers.stop()}),this.runCleanup(()=>{t.scheduler.destroy()}),this.runCleanup(()=>{t.merger?.destroy(),e.merges.destroy()}),t.cache.clear(),t.connection.markDisconnected()}rollbackFailedStart(){this.release(),this.runCleanup(()=>{this.deps.a11y?.detach()})}runCleanup(e){try{e()}catch(e){this.deps.log("cleanup failed:",e)}}refreshCache(){this.state.isRunning()&&(this.state.revealer.reset(),this.followReplacedRoot()||this.rebuildCache())}watchRootReplacement(){let{root:e}=this.deps;!xe(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()||!xe(e))return!1;let t=Ee(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,o=t.activeUpdate,l=t.lastFlush,a=[],s=new Set,u=[];for(let[e,t]of i.entries()){a.push(e);for(let i of t)void 0!==i.owner&&s.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:zi,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:Z(r.observed).name},revisions:{accepted:t.updateCount,superseded:t.supersededCount,completed:t.completedCount,skippedUnchanged:t.skippedUnchangedCount,active:null===o?void 0:o.revision.revision},bindings:{elements:i.elementCount,fields:i.fieldCount,fieldNames:a.sort(),absentFields:[...t.absentFields].sort(),orphanFields:[...t.warnedOrphanFields].sort(),ownerScoped:e.scopeBindingsByOwner,owners:[...s].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,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:o?.pendingFragments??0,...t.fragmentStats},scheduler:{pending:n.pendingCount,deferred:n.replayCount,visibilityGateThreshold:n.gateThreshold,visibilityGateActive:n.gateActive,lastFlush:null===l?void 0:{applied:l.applied,appliedFields:l.appliedFields,deferred:l.deferred,durationMs:l.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;for(let e of t.cache.values())i.set(e.element,e),t.observers.unobserveElement(e.element);if(this.buildCacheAndObserve(),e.isRunning()){for(let e of t.cache.values())i.get(e.element)?.fieldName===e.fieldName?t.scheduler.retarget(e):t.scheduler.forget(e.element),i.delete(e.element);for(let e of i.values())t.scheduler.forget(e.element)}}onHeartbeatTimeout(){let{state:e,deps:t}=this;if(!e.isRunning())return;t.bus.advanceGeneration();let i=e.activeUpdate;e.activeUpdate=null,null!==i&&t.scheduler.cancelRevision(i.revision),t.merger?.destroy(),e.merges.destroy();let n=t.connection.markDisconnected();try{t.onHeartbeatTimeout?.()}catch(e){t.log("heartbeat:",e)}e.isRunning()&&(n&&this.isIdleDisconnected()&&(t.a11y?.announceDisconnected(),t.emitter.emitWhile("disconnect",{reason:"timeout",timestamp:Date.now()},()=>this.isIdleDisconnected()),!e.isRunning()||(this.isIdleDisconnected()&&t.log("connection","connected","\\u2192","disconnected"),!e.isRunning()))||this.sendReadyAfterStart())}sendReadyAfterStart(){try{this.deps.sendReady(this.deps.readyTargets())}catch(e){this.reportError(e,"ready","LP0606")}}reportError(e,t,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}},Nn=/^https?:\\/\\/(localhost|127\\.0\\.0\\.1)(?::\\d+)?$/i,Mn=/^https?:\\/\\/[^/?#\\s]+$/i,xn=[3e3,3001,3333,4e3,4321,5e3,5173,5174,8e3,8080,8888,9e3],En=class{constructor(e={}){$t(this,On);let t=new Set;for(let i of e.additionalOrigins??[]){let e=Ue(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}());Ft(this,On,[t,i,n,void 0!==i,void 0])}matches(e){return 0!==e.length&&"null"!==e&&(void 0!==Ct(this,On)[4]?e===Ct(this,On)[4]:!!(Ct(this,On)[0].has(e)||0===Ct(this,On)[0].size&&void 0!==Ct(this,On)[1]&&e===Ct(this,On)[1]||Ct(this,On)[2]&&Nn.test(e)))}lockOrigin(e){return!!this.matches(e)&&(Ct(this,On)[4]=e,!0)}unlockOrigin(){let e=Ct(this,On)[4];return Ct(this,On)[4]=void 0,e}get lockedOrigin(){return Ct(this,On)[4]}enumerate(){if(void 0!==Ct(this,On)[4])return[Ct(this,On)[4]];let e=new Set(Ct(this,On)[0]);if(0===Ct(this,On)[0].size&&void 0!==Ct(this,On)[1]&&e.add(Ct(this,On)[1]),Ct(this,On)[2])for(let t of xn)e.add(`http://localhost:${String(t)}`),e.add(`http://127.0.0.1:${String(t)}`);return[...e]}get referrerWasAvailable(){return Ct(this,On)[3]}get isProductionUnconfigured(){return!(!Oe()||Ct(this,On)[0].size>0||Ct(this,On)[2]||void 0!==Ct(this,On)[1])}get isReferrerOnlyTrust(){return!(Ct(this,On)[0].size>0||Ct(this,On)[2])&&void 0!==Ct(this,On)[1]}},On=new WeakMap,Un={1:"left",2:"center",3:"right",4:"justify"},Pn=new Set(["left","center","right","justify","start","end"]),Ln=new Set(["h1","h2","h3","h4","h5","h6"]),In=\' target="_blank" rel="noopener noreferrer"\',_n=(e,t)=>{let i=t.renderChildren(e.children??[]),n=je(e.fields),r=function(e,t){if("internal"===t?.linkType)return function(e){let t=je(je(e)?.value),i=t?.url;if("string"==typeof i&&i.length>0)return i;let n=t?.slug;return"string"==typeof n&&n.length>0?`/${n}`:void 0}(t.doc);let i=t?.url??e.url;return"string"==typeof i&&i.length>0?i:void 0}(e,n);if(void 0===r||!T(r))return i;let o="string"==typeof e.title?` title="${Ce(e.title)}"`:"";return`<a href="${$e(r)}"${function(e,t,i){if(!0===t?.newTab||k(i))return In;let n="string"==typeof e.target?e.target:"";return""===n?"":"_blank"===n?In:` target="${Ce(n)}"`}(e,n,r)}${o}>${i}</a>`},jn=new Map,Bn=".lp-block:empty,.lp-inline-block:empty",Wn={text:e=>{let t=Ce("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${Ie(e)}${_e(e)}>${i}</p>`},heading:(e,t)=>{let i="string"==typeof e.tag?e.tag.toLowerCase():"h2",n=Ln.has(i)?i:"h2",r=t.renderChildren(e.children??[]);return`<${n}${Ie(e)}${_e(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)}"`:"",o="check"===i?\' role="list"\':"",l=t.renderChildren(e.children??[]);return`<${n}${Ie(e)}${_e(e)}${r}${o}>${l}</${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"}"${_e(e)}>${i}</li>`;let n="number"==typeof e.value?` value="${Ce(String(e.value))}"`:"";return`<li${Ie(e)}${_e(e)}${n}>${i}</li>`},link:_n,autolink:_n,quote:(e,t)=>{let i=t.renderChildren(e.children??[]);return`<blockquote${Ie(e)}${_e(e)}>${i}</blockquote>`},code:e=>{let t=We("string"==typeof e.language?e.language:"");return`<pre><code${""===t?"":` class="language-${t}"`}>${Ce(De(e))}</code></pre>`},"code-highlight":e=>{let t="string"==typeof e.text?e.text:"";return`<span${"string"==typeof e.highlightType?` class="token-${We(e.highlightType)}"`:""}>${Ce(t)}</span>`},linebreak:()=>"<br>",horizontalrule:()=>"<hr>",tab:()=>"\\t",upload:e=>{let t=Be(e.value);if(void 0===t)return"";let i=t.url;if("string"!=typeof i||!T(i))return"";let n="string"==typeof t.mimeType?t.mimeType:"";return n.startsWith("video/")?function(e,t){return`<video controls${He(e)}><source src="${$e(t)}"${qe(e)}></video>`}(t,i):n.startsWith("audio/")?function(e,t){return`<audio controls><source src="${$e(t)}"${qe(e)}></audio>`}(t,i):""===n||n.startsWith("image/")?function(e,t){let i="string"==typeof e.alt?Ce(e.alt):"";return`<img src="${$e(t)}" alt="${i}"${He(e)} loading="lazy" decoding="async">`}(t,i):function(e,t){let i="string"==typeof e.filename?Ce(e.filename):Ce(t);return`<a href="${$e(t)}" target="_blank" rel="noopener noreferrer">${i}</a>`}(t,i)},relationship:e=>{let t="string"==typeof e.relationTo?e.relationTo:"",i=je(e.value),n=Ce((i&&ze(i))??`#${t}`),r=We(t),o=""===r?\' class="lp-relation"\':` class="lp-relation lp-relation--${r}"`,l=i?.url;return"string"==typeof l&&T(l)?`<a href="${$e(l)}"${o}>${n}</a>`:`<span${o}>${n}</span>`},block:(e,t)=>Je(e,t,"div","lp-block"),inlineBlock:(e,t)=>Je(e,t,"span","lp-inline-block"),table:(e,t)=>`<table${Ie(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"\':""}${Ke("colspan",e.colSpan)}${Ke("rowspan",e.rowSpan)}>${t.renderChildren(e.children??[])}</${n}>`}},Vn=new Map,zn=!1,Dn="data-payload-text",Hn=new Set,qn=new Set,Gn=new Set(["DIV","SECTION","ARTICLE"]),Jn={name:"richText",render:C((e,t,i)=>{let n=e.element;if(Ae(t)){n.textContent="";return}let r=i.sanitizerPolicy;if(void 0!==i.renderRichText){let o=i.renderRichText(t,{fieldName:e.fieldName,element:n,locale:i.locale});n.innerHTML=ve(be(o,r));return}if(Qe(t)){let o=new Map,l=et(n,be(function(e,t={}){if(!Qe(e))return"";let i=function(e){let t={renderChildren:e=>{let i="";for(let n of e)i+=Xe(n,t);return i},resolveAlignment:Pe,resolveIndent:Le,onUnrenderedBlock:e};return t}(t.onUnrenderedBlock).renderChildren(e.root.children);return!1===t.sanitize?i:void 0!==we()?function(e){return be(e,void 0,void 0)}(i):(function(){if(!zn){zn=!0;try{console.warn(\'[live-preview] lexicalToHtml() has no sanitizer document and returned unsanitised HTML; call setSanitizerDocument() (linkedom/jsdom) for server rendering, see "HTML sanitization" in docs/security.md.\')}catch{}}}(),i)}(t,{sanitize:!1,onUnrenderedBlock:(e,t)=>{o.set(t,e)}}),r));for(let[t,n]of l){let r=o.get(t);void 0!==r&&it(e,i,r,n)}return}if("string"!=typeof t)return!1;n.innerHTML=ve(be(t,r))})},Kn={name:"html",render(e,t,i){if(Ae(t)){e.element.textContent="";return}let n="string"==typeof t?t:Fe(t);e.element.innerHTML=ve(be(n,i.sanitizerPolicy))}},Qn=new WeakSet,Xn=rt("url"),Zn=/^[a-zA-Z][a-zA-Z0-9+.-]*:/,Yn=rt("email",function(e){let t=e.trim();return Zn.test(t)||!t.includes("@")?t:`mailto:${t}`}),er=["src","srcset","sizes"],tr={name:"image",render:C((e,t,i)=>{let n=e.element;if(Ae(t)){st(n);return}let r=void 0!==e.locale,{media:o,candidate:l}=function(e,t,i,n){let r=void 0!==e.srcField&&e.srcField.length>0?de(i.allFields,e.srcField,i.locale,n):t,o=Be(r);return{media:o,candidate:void 0===o?r:o.url}}(e,t,i,r),a=nt(n,e.fieldName,l);if("none"===a.kind)return!1;if("unsafe"!==a.kind){if("IMG"===n.tagName){let t=n;lt(t,a.url,o);let l=function(e,t,i,n,r){if(void 0!==t&&t.length>0){let e=de(i,t,n,r);return"string"==typeof e?e:void 0}return e?.alt}(o,e.altField,i.allFields,i.locale,r);void 0!==l&&(t.alt=l);return}n.style.backgroundImage=`url(\'${function(e){return e.replace(/[\'"()\\\\]/g,"\\\\$&")}(a.url)}\')`}else st(n)})},ir={name:"upload",render:C((e,t)=>{let i=e.element;if(Ae(t)){ut(i);return}let n=Be(t);if(void 0===n)return!1;let r=nt(i,e.fieldName,n.url);if("none"===r.kind)return!1;if("unsafe"===r.kind){ut(i);return}let o=r.url;if("IMG"===i.tagName){let e=i;lt(e,o,n),void 0!==n.alt&&(e.alt=n.alt);return}if("A"===i.tagName){i.setAttribute("href",o),i.textContent=n.filename??o;return}let l=Ce(n.filename??o);i.innerHTML=ve(`<a href="${$e(o)}">${l}</a>`)})},nr={name:"relationship",render(e,t){let i=e.element;if(Ae(t))i.removeAttribute("href"),i.textContent="";else{if("A"===i.tagName&&!Array.isArray(t)){let n=nt(i,e.fieldName,je(t)?.url);"safe"===n.kind?i.setAttribute("href",n.url):"unsafe"===n.kind&&i.removeAttribute("href")}i.textContent=Array.isArray(t)?t.map(dt).join(", "):dt(t)}}},rr={name:"select",render(e,t,i){let n=e.element,r=Ae(t)?[]:function(e){return Array.isArray(e)?e.map(Fe):[Fe(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=je(t);if(void 0!==i&&Fe(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)}},or=new Set(["","false","0","off","no"]),lr={name:"checkbox",render(e,t){let i=e.element,n=function(e){return"boolean"==typeof e?e:"string"==typeof e?!or.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}},ar=new Map,sr=new Map,ur=new Set(["short","medium","long","full"]),dr=new Set(["short","medium","long","full"]),cr=/^[A-Za-z]{3}$/u,hr=/^[0-4]$/u,fr=new WeakSet,pr={name:"date",render(e,t,i){let n=e.element;if(Ae(t)){"INPUT"===n.tagName?n.value="":(n.removeAttribute("datetime"),n.textContent="");return}let r="number"==typeof t?t:Fe(t),o=new Date(r),l=!Number.isNaN(o.getTime()),a=String(r);"INPUT"!==n.tagName?("TIME"===n.tagName&&n.setAttribute("datetime",l?o.toISOString():a),n.textContent=l?function(e,t,i){let n=t.locale??i.locale??s(),r=mt("date",t.format,t.element,t.fieldName)??mr;try{return function(e,t){let i=ct(e,t);return Re(sr,i)??Ne(sr,i,new Intl.DateTimeFormat(e,t),64)}(n,r).format(e)}catch{return e.toISOString()}}(o,e,i):a):n.value=l?function(e,t){let i=`${String(t.getFullYear()).padStart(4,"0")}-${gt(t.getMonth()+1)}-${gt(t.getDate())}`,n=`${gt(t.getHours())}:${gt(t.getMinutes())}`;return"date"===e?i:"datetime-local"===e?`${i}T${n}`:"time"===e?n:t.toISOString()}(n.type,o):a}},mr={dateStyle:"medium",timeStyle:"short"},gr={name:"number",render(e,t,i){let n=e.element;if(Ae(t)){"INPUT"===n.tagName?n.value="":n.textContent="";return}let r="number"==typeof t?t:Number(Fe(t));Number.isNaN(r)?n.textContent=Fe(t):"INPUT"!==n.tagName?n.textContent=function(e,t,i){let n=t.locale??i.locale??s(),r=mt("number",t.format,t.element,t.fieldName);try{return function(e,t){let i=ct(e,t);return Re(ar,i)??Ne(ar,i,new Intl.NumberFormat(e,t),64)}(n,r).format(e)}catch{return String(e)}}(r,e,i):n.value=String(r)}},vr=new Map;!function(){if(typ','eof window>"u"||!Oe()&&(typ','eof window>"u"||null==window.opener))return;let e=window.__livePreview,t=JSON.stringify(yt());if(void 0!==e&&(void 0===e.configSignature||e.configSignature===t))return e.refresh(),e;let[i=[],r="",o="/api",l=1,a=!1,s=50,u=!0,d=0,c=!1,h=50,f="200px",p=!0,m=!1,g=!1,v=!0,y="parent-or-opener",b="strict",w,S=!1,T=!1,k,C,$="off",F]=yt(),A=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),R=new En({additionalOrigins:i,enableReferrerDetection:!p,enableLocalhostMatching:!m});R.isProductionUnconfigured?Nt("[live-preview] LP0101: No trusted origin. Pass allowedOrigins to generateInlineScript() (or to the adapter) \\u2014 the runtime reads no environment variable in the browser."):R.isReferrerOnlyTrust&&Nt("[live-preview] LP0102: document.referrer fallback trusts any framing site. Set allowedOrigins and a frame-ancestors CSP in production.");let N=new xt,M=function(){let e=[Jn,Kn,Xn,Yn,tr,ir,nr,rr,{...rr,name:"radio"},lr,pr,gr,vt("array","structural arrays"),vt("blocks","structural arrays")];return function(e=[]){let t={};for(let i of e)t[i.name]=i;for(let[e,i]of vr)t[e]=i;return Object.freeze(t)}([Ye("text"),Ye("textarea"),...e])}(),x=new Rn({renderers:M,originMatcher:e=>R.matches(e),lockedOrigin:()=>R.lockedOrigin,readyTargets:()=>R.enumerate(),emitter:N,eventSourcePolicy:y,...""!==r?{dataMerge:{serverURL:r,apiRoute:o,depth:l}}:{},debounceMs:s,heartbeatMs:d,intersectionRootMargin:f,disableVisibilityGate:c,visibilityGateThreshold:h,enableA11y:u,scopeBindingsByOwner:g,skipUnchanged:v,revealEditedField:S,onUnfaithfulPatch:n({onUnfaithfulPatch:C,onUnboundChange:k}),autoBind:$,...void 0!==F?{hydration:F}:{},sanitizerPolicy:b,...void 0!==A?{strategies:A}:{},onHeartbeatTimeout:()=>{R.unlockOrigin()},...a?{log:(...e)=>{Mt("[live-preview]",...e)}}:{}});N.on("connect",e=>{R.lockOrigin(e.origin)}),x.start(),e?.destroy();let E=function(e,t={}){let i=t.windowTarget??globalThis.window,n=t.documentTarget??globalThis.document,r=t.softNavigationEvents??[],o=()=>{e.suspend()},l=t=>{!0===t.persisted&&e.resume()},a=()=>{e.refreshCache()};i?.addEventListener("pagehide",o),i?.addEventListener("pageshow",l);for(let e of r)n?.addEventListener(e,a);let s=!1;return()=>{if(!s){s=!0,i?.removeEventListener("pagehide",o),i?.removeEventListener("pageshow",l);for(let e of r)n?.removeEventListener(e,a)}}}({suspend:()=>x.suspend(),resume:()=>x.start(),refreshCache:()=>{x.refreshCache()}}),O=Object.freeze({version:zi,configSignature:t,destroy:()=>{E(),x.destroy();let e=window;e.__livePreview===O&&delete e.__livePreview},refresh:()=>{x.refreshCache()},enumerateOrigins:()=>R.enumerate(),inspect:()=>x.inspect()});try{Object.defineProperty(window,"__livePreview",{value:O,writable:!1,configurable:!0})}catch(e){throw E(),x.destroy(),e}}()})();'].join(""),t=Object.freeze({profile:"lean",source:e,contentHash:"62412f7d08ae00f7",integrity:"sha384-IAJDn/7KMDRuVn1jPL3oNr4Rc6MJk4RjvJWTkzBLLTXKdLVQlWVgeUDCtOzRUV1Y"});exports.LEAN_RUNTIME=t;
|
|
1
|
+
"use strict";var e=/* @__PURE__ */['(()=>{function e(e){return("object"==typeof e&&null!==e||"function"==typeof e)&&"function"==typeof e.then&&(Promise.resolve(e).catch(()=>{}),!0)}function t(t){return(...i)=>{try{e(t(...i))}catch{}}}function i(){}function n(e){return e.onUnfaithfulPatch??("ignore"===e.onUnboundChange?"ignore":"escalate")}function r(e,t,i,n){if(t.reportedUnfaithful.has(i.element))return;t.reportedUnfaithful.add(i.element),t.unfaithfulCount+=1,t.unfaithfulFields.add(i.fieldName);let r=e.onUnfaithfulPatch;if("ignore"!==r){if("warn"===r){e.warn(`[live-preview] LP0411: "${i.fieldName}" ${n}`);return}e.log("LP0411",i.fieldName,n),t.unfaithfulPatches.push(i)}}function o(e,t){return!e.unfaithfulFields.has(t)&&(e.unfaithfulFields.add(t),e.unfaithfulCount+=1,!0)}function l(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value:e.textContent}function s(e){let t=e.trim();return JSON.stringify(t.length>jt?`${t.slice(0,jt)}\\u2026`:t)}function a(){return function(){if(typ','eof document>"u")return;let e=document.documentElement.getAttribute("lang");return null===e||0===e.length?void 0:e}()??function(){if(typeof navigator>"u")return;let e=navigator.language;return"string"==typeof e&&e.length>0?e:void 0}()??"en"}function u(e){if(!Array.isArray(e))return[];let t=[];for(let i of e){let e=d(i);e&&t.push(e)}return t}function d(e){if("object"!=typeof e||null===e)return;let t=e,i=t.name,n=t.type;if("string"!=typeof i||0===i.length||"string"!=typeof n||0===n.length)return;let r=u(t.fields),o=function(e){if(!Array.isArray(e))return[];let t=[];for(let i of e){if("object"!=typeof i||null===i)continue;let e=i,n=e.slug;if("string"!=typeof n||0===n.length)continue;let r=u(e.fields);t.push({...e,slug:n,fields:r})}return t}(t.blocks),l={...t,name:i,type:n};return r.length>0?l.fields=r:delete l.fields,o.length>0?l.blocks=o:delete l.blocks,l}function c(e,t){return void 0===e||t(e)}function h(e,t){return null==e||t(e)}function f(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}function p(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),o=new Set;for(let e of Vt)(n>=Wt[e].since||r.has(e))&&o.add(e);return{ours:4,...void 0!==i?{theirs:i}:{theirs:void 0},negotiated:n,capabilities:o,observed:r}}function m(e,t){return e.generation===t.generation&&e.revision===t.revision}function g(e){Ht.has(e)||(Ht.add(e),At(`[live-preview] LP0104: this page carries the lean runtime, which leaves out ${e} (${Dt[e]}). The elements are left as the server rendered them. Remove \\`runtime: LEAN_RUNTIME\\` to get the full runtime.`))}function v(e){return function(e){return!1!==e.enableA11y&&g("screen-reader announcements"),null}(e)}function y(e){if(typ','eof window>"u")return;let t=[];window.parent!==window&&t.push(window.parent),window.opener instanceof Window&&t.push(window.opener),zt.sendReady(t,e)}function b(e,t=""){let i=new Map;return w(e,t,i),i}function w(e,t,i){for(let n of e){if(qt.has(n.type)){n.fields&&w(n.fields,t,i);continue}let e=""===t?n.name:`${t}.${n.name}`;if(i.set(e,n),"group"===n.type)n.fields&&w(n.fields,e,i);else if("array"===n.type&&n.fields)w(n.fields,`${e}.*`,i);else if("blocks"===n.type&&n.blocks)for(let t of n.blocks)w(t.fields,`${e}.*.${t.slug}`,i)}}function S(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 T(e){if("string"!=typeof e)return!1;let t=e.trim().replace(Zt,"");if(0===t.length||Kt.test(t))return!1;if(t.startsWith("#")||t.startsWith("?")||Xt.test(t)||t.startsWith("/"))return!0;try{let e=new URL(t);return Jt.has(e.protocol)}catch{return Qt.test(t)}}function k(e){let t=e.trim().replace(Zt,"");return/^https?:\\/\\//i.test(t)||Xt.test(t)}function C(e){return ti.add(e),e}function $(e){switch(typeof e){case"string":return e.length>65536?void 0:`s:${e}`;case"number":return`n:${Object.is(e,-0)?"-0":String(e)}`;case"boolean":return"b:"+(e?"1":"0");case"bigint":return`i:${String(e)}`;case"undefined":return"u";case"object":{if(null===e)return"z";let t;try{t=JSON.stringify(e)}catch{return}return t.length>65536?void 0:`o:${t}`}case"symbol":case"function":return}}function R(e){return e.closest(`[${ni}]`)}function F(e){let t=e.getAttribute(ri);return null!==t&&t.length>0?"patch"===t||"fragment"===t||"route"===t?t:void 0:null!==R(e)?"fragment":null!==e.closest("head")?"route":"patch"}function A(e){return`global:${e}`}function N(e,t){return void 0===t||""===t?`collection:${e}`:`collection:${e}:${t}`}function M(e){return"string"==typeof e&&e.length>0}function x(e,t){return null!==t&&void 0!==e&&t.includes(e)}function O(e){let t=e.id;return"string"==typeof t&&t.length>0?t:"number"==typeof t&&Number.isFinite(t)?String(t):void 0}function E(e,t,i){let n=e.get(t);return void 0!==n&&(!1===i||n.some(e=>x(e.owner,i)))}function U(e,t,i){let n=`${t}.`;for(let[t,r]of e.entries())if(t.startsWith(n)&&(!1===i||r.some(e=>x(e.owner,i))))return!0;return!1}function P(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 L(e,t,i){let n;return r=>{if(E(e,r,i))return!0;let o=P(r,t);return!!(o!==r&&E(e,o,i)||U(e,r,i)||o!==r&&U(e,o,i))||(n??(n=function(e,t){let i=new Set;for(let[n,r]of e.entries())for(let e of r)!1!==t&&!x(e.owner,t)||void 0!==e.locale&&i.add(`${n}_${e.locale}`);return i}(e,i)),n.has(r))}}function I(e,t,i,n,r){return j(i)?!j(t)||function(e,t,i){let n=void 0===i?void 0:S(i,e);return void 0!==n&&!li.has(n.type)||!0===t.get(e)?.some(_)||U(t,e,!1)}(e,n,r)?"keep":null==t?"ask":"own":"ask"}function _(e){return!li.has(e.fieldType)}function j(e){return null===e||"object"!=typeof e&&"function"!=typeof e}function B(e){return!0===e?.includes(".")}function W(e){return null!==e&&e.forceRender&&!e.completed}function V(e){try{return!0===e.matchMedia?.("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function z(...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 D(e,t){let i={};for(let n of t)n!==e&&(i[n]=[e]);return i}function H(e){return"patch"===e.getAttribute(gi)}function q(e){return function(e){return"astro-island"===e.tagName.toLowerCase()||e.hasAttribute(gi)}(e)&&!H(e)}function G(e){return ji.has(e)||_i.test(e)}function J(e){let t=e.getAttribute(bi);if(null!==t&&G(t))return t;if(e.hasAttribute(Fi))return"richText";if(e.hasAttribute(Ai))return"html";if(e.hasAttribute(Mi))return"structural-array";if(e.hasAttribute(Ni))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 K(){return!0}function Q(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 X(e){return Q(e,128)&&!e.includes("?")&&!e.includes("#")}function Z(e){return e.has("schema-json")?zi:e.has("document-events")||e.has("relationship-events")?Di:Hi}function Y(e){if(e.nodeType!==qi)return!1;let t=e;return t.hasAttribute(yi)||null!==t.querySelector(`[${yi}]`)}function ee(){if(typ','eof window>"u")return;let e=window;return e[Ji]??(e[Ji]={armed:!1,committed:!1,commits:[],onCommit:void 0,waiters:[]})}function te(){let e=ee();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{}let o=i?.containerInfo;void 0===e.onCommit?e.commits.push(o):e.onCommit(o)}}function ie(e){e.committed=!0;let t=e.waiters;e.waiters=[];for(let e of t)e()}function ne(e,t){let i=e.waiters.indexOf(t);i>=0&&e.waiters.splice(i,1)}function re(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,ne(e,r),t("timed-out")},i),()=>{null!==n&&clearTimeout(n),n=null,ne(e,r)}}function oe(){if(typ','eof window>"u")return;let e=window;return e[Xi]??(e[Xi]={armed:!1,committed:!1,waiters:[]})}function le(e){return Object.prototype.hasOwnProperty.call(e,Qi)?e[Qi]:void 0}function se(){let e=oe();if(void 0===e||e.armed)return;e.armed=!0;let t=Element.prototype;void 0===Object.getOwnPropertyDescriptor(t,Qi)&&Object.defineProperty(t,Qi,{configurable:!0,get:()=>{},set(e){Object.defineProperty(this,Qi,{value:e,writable:!0,configurable:!0,enumerable:!0});let t=oe();void 0===t||t.committed||null===this.querySelector(Ki)||function(e,t){let i=t?.$nuxt;!0!==i?.isHydrating||"function"!=typeof i.hook?ie(e):i.hook(Zi,()=>{e.committed||ie(e)})}(t,e)}})}function ae(e){if(void 0===e.hydration){e.startNow();return}let t=t=>{e.later(()=>{ue(e,t)})},i="react"===e.hydration?function(e,t=5e3){te();let i=ee();if(void 0===i)return null;if(void 0===i.onCommit){let e=e=>{!i.committed&&function(e){let t=e;return 9===t?.nodeType||null!=t?.querySelector?.(Ki)}(e)&&ie(i)};i.onCommit=e;for(let t of i.commits.splice(0))e(t)}return re(i,e,t)}(t):function(e,t,i=5e3){se();let n=oe();return void 0===n?null:(!n.committed&&function(e){for(let t=e.querySelector(Ki);null!==t;t=t.parentElement)if(void 0!==le(t))return!0;return!1}(e)&&ie(n),re(n,t,i))}(e.root,t);null!==i?(e.defer(i),e.hydrated("waiting")):ue(e,"committed")}function ue(e,t){e.hydrated(t),"timed-out"===t&&e.warn(`[live-preview] LP0607: no ${"react"===e.hydration?"React commit":"Vue mount"} in ${String(5e3)} ms; started without waiting for hydration.`),e.startNow()}function de(e,t,i,n=!1){if(n&&void 0!==i){let n=ce(e,`${t}_${i}`);if(void 0!==n)return n}let r=ce(e,t);if(void 0!==r)return r;if(t.includes(".")){let i=e,n=!0;for(let e of t.split(".")){if(tn.has(e)||null===i||"object"!=typeof i){n=!1;break}if(i=ce(i,e),void 0===i){n=!1;break}}if(n)return i}return void 0===i?void 0:ce(e,`${t}_${i}`)}function ce(e,t){if(!tn.has(t)&&Object.prototype.hasOwnProperty.call(e,t))return e[t]}function he(e,t,i,n){return de(e,i,t.locale??n,void 0!==t.locale)}function fe(e,t,i,n){let r=$(t);if(void 0===r)return;let o=[e.hrefField,e.srcField,e.altField],l=r;for(let t of o){if(void 0===t||0===t.length)continue;let r=$(he(i,e,t,n));if(void 0===r)return;l+=`|${t}=${r}`}return l}function pe(e,t,i,n,r){let{warned:o,warn:l}=e;if(o.has(i)||t(i))return;o.add(i);let s=`data-payload-field="${P(i,n)}"`;l(""!==r?`[live-preview] LP0203: field "${i}" has a value and no <\\u2026 ${s}> 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 ${s}> for the empty field "${i}"; render the anchor unconditionally so edits to an empty field have somewhere to land.`)}function me(e){let t=typeof e;return"string"===t||"number"===t||"boolean"===t||"bigint"===t}function ge(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function ve(e){let t=function(){let e=function(){let e=globalThis,t=e[rn];if(void 0!==t)return t;let i={};return e[rn]=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(nn,{createHTML:e=>e})}catch{e.auto=null}return e.auto}();return null===t?e:t.createHTML(e)}function ye(e){on.has(e)||(on.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(ln)?"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)":"List it in `allowedDataAttributes` if the page needs it, or set `sanitizerPolicy: \'compat\'` to keep every `data-*` as 1.x did"}(e)}.`))}function be(e,t,i){let n=we();if(!n)throw new Error("sanitizeHtml needs a DOM");if(""===e)return"";let r=function(e,t){let i=e?.policy??t??bn;if(!e){let e=new Map;for(let[t,i]of Object.entries(pn))e.set(t,i);return{allowedTags:sn,attrByTag:e,allowFormControls:!1,templateMode:!1,mode:i,allowedData:new Set}}let n=new Set(sn);if(e.additionalAllowedTags?.forEach(e=>n.add(e)),!0===e.allowFormControls)for(let e of an)n.add(e);let r=new Map;for(let[e,t]of Object.entries(pn))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),o=n.createElement("template");return o.innerHTML=ve(e),Se(o.content,r),o.innerHTML}function we(){if(!(typ','eof document>"u"))return document}function Se(e,t){for(let i of Array.from(e.childNodes))i.nodeType===gn?Te(i,t):i.nodeType===vn&&i.remove()}function Te(e,t){let i=e.tagName.toLowerCase();!un.has(i)||t.allowFormControls&&an.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("strict"===i.mode){if(i.templateMode&&yn.has(r))continue;if("id"===r||"name"===r||r.startsWith(fn)){e.removeAttribute(t.name),("name"!==r||!0===n?.has(r))&&ye(r);continue}if(r.startsWith(hn)){i.allowedData.has(r)||(e.removeAttribute(t.name),ye(r));continue}if(dn.has(r)||r.startsWith(cn))continue}else if(dn.has(r)||r.startsWith(cn)||r.startsWith(hn))continue;n?.has(r)?(mn.has(r)&&!T(t.value)||"srcset"===r&&!ke(t.value))&&e.removeAttribute(t.name):e.removeAttribute(t.name)}}}(e,i,t),"a"===i&&function(e){let t=e.getAttribute("href");null===t||!k(t)||(e.setAttribute("rel","noopener noreferrer"),e.hasAttribute("target")||e.setAttribute("target","_blank"))}(e),Se(e,t)):(Se(e,t),e.replaceWith(...e.childNodes)):e.remove()}function ke(e){for(let t of e.split(",")){let e=t.trim();if(0===e.length)continue;let[i=e]=e.split(/\\s/,1);if(!T(i))return!1}return!0}function Ce(e){return e.replace(Sn,e=>wn[e])}function $e(e){return e.replace(kn,e=>Tn[e])}function Re(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 Fe(e){return null==e||""===e}function Ae(e,t){let i=e.get(t);return void 0!==i&&(e.delete(t),e.set(t,i)),i}function Ne(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 Me(t,i,n,r,o){let l=t.transformValue;if(void 0===l)return n;try{let t=l(i.fieldName,n,{element:i.element,allFields:r},o),s=e(t);if(!o())return n;if(s)throw new TypeError(`Transform for "${i.fieldName}" returned a thenable; transforms must be synchronous`);return t}catch(e){if(!o())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 xe(e){return 9===e.nodeType}function Oe(e){return e.body}function Ee(){if(typ','eof window>"u")return!1;try{return window.self!==window.top}catch{return!0}}function Ue(e){let t=e.trim();if(0!==t.length)try{let e=new URL(t);return"http:"!==e.protocol&&"https:"!==e.protocol||!Mn.test(e.origin)?void 0:e.origin}catch{return}}function Pe(e){let t=e.format;return"string"==typeof t&&Pn.has(t)?t:"number"==typeof t?Un[t]:void 0}function Le(e){let t=e.indent;return"number"==typeof t&&t>0?t:0}function Ie(e){return"rtl"===e.direction?\' dir="rtl"\':"ltr"===e.direction?\' dir="ltr"\':""}function _e(e){let t=Pe(e),i=Le(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 je(e){return"object"==typeof e&&null!==e?e:void 0}function Be(e){return je(e)}function We(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-").toLowerCase()}function Ve(e){return"string"==typeof e&&e.length>0?e:void 0}function ze(e){let t=Ve(e.title)??Ve(e.name)??Ve(e.slug);return void 0!==t?t:void 0===e.id?void 0:String(e.id)}function De(e){if("string"==typeof e.text)return e.text;if(!e.children)return"";let t="";for(let i of e.children)t+=De(i);return t}function He(e){return`${"number"==typeof e.width?` width="${String(e.width)}"`:""}${"number"==typeof e.height?` height="${String(e.height)}"`:""}`}function qe(e){return"string"==typeof e.mimeType?` type="${$e(e.mimeType)}"`:""}function Ge(e){return jn.get(e)}function Je(e,t,i,n){let r=je(e.fields)??{},o="string"==typeof r.blockType?r.blockType:"",l=We(o),s=""===l?n:`${n} ${n}--${l}`;if(""!==o){let e=Ge(o)??Ge(l);if(e)return e(r,{renderChildren:t.renderChildren});t.onUnrenderedBlock?.(o,s)}return`<${i} class="${s}"></${i}>`}function Ke(e,t){return"number"==typeof t&&t>1?` ${e}="${String(t)}"`:""}function Qe(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 Xe(e,t){let i=function(e){return Vn.get(e)??Wn[e]}(e.type);return i?i(e,t):void 0!==e.children?t.renderChildren(e.children):""}function Ze(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+=Ze(i);return t}function Ye(e="text"){let t=new WeakSet;return{name:e,render:C((e,i)=>{let n=e.element,r=function(e){return null==e?"":Qe(e)?function(e){return Qe(e)?e.root.children.map(Ze).join("\\n").trim():""}(e):"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):JSON.stringify(e)}(i);if("INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName){if(function(e){return null!==e.querySelector(":scope > :not(br)")}(n)&&!n.hasAttribute(Dn))return function(e,t,i){e.has(t)||(e.add(t),At(`[live-preview] LP0402: Skipping text update for "${i}": <${t.tagName.toLowerCase()}> has structured children. Move data-payload-field to the value element, or add data-payload-text to replace them.`))}(t,n,e.fieldName),!1;r.includes("\\n")||r.includes("\\r")?n.innerHTML=ve(function(e){return Ce(e).replace(/\\r\\n|\\r|\\n/g,"<br>")}(r)):n.textContent=r}else n.value=r})}}function et(e,t){let i=e.cloneNode(!1);i.innerHTML=ve(t);let n=function(e,t){let i=e.firstElementChild;if(null!==i?.nextElementSibling||t.children.length<2||!Gn.has(i.tagName)||i.hasAttribute(yi))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,o=i.querySelectorAll(Bn);if(o.length>0&&null!==n.firstElementChild){let e=[];tt(n,i,e);for(let[t,i]of e)t.replaceWith(i),i.matches(Bn)||r.set(t.className,!1);for(let e of o)null!==e.parentNode&&r.set(e.className,!0)}return n.replaceChildren(...i.childNodes),r}function tt(e,t,i){if(e.children.length!==t.children.length)return;let n=e.firstElementChild,r=t.firstElementChild;for(;null!==n&&null!==r;)r.matches(Bn)?i.push([r,n]):tt(n,r,i),n=n.nextElementSibling,r=r.nextElementSibling}function it(e,t,i,n){n&&t.reportUnfaithful?.(e,`lost the markup the server drew for block "${i}"`);let r=n?qn:Hn;r.has(i)||(r.add(i),At(`[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 nt(e,t,i){return"string"!=typeof i||0===i.length?{kind:"none"}:T(i)?{kind:"safe",url:i}:(Qn.has(e)||(Qn.add(e),At(`[live-preview] LP0401: refused an unsafe URL for "${t}" on <${e.tagName.toLowerCase()}>; the attribute was cleared.`)),{kind:"unsafe"})}function rt(e,t=e=>e){return{name:e,render(e,i,n){let r=e.element;if(Fe(i)){!function(e){"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):e.value=""}(r);return}let o=Re(i);if("INPUT"!==r.tagName&&"TEXTAREA"!==r.tagName){if("A"===r.tagName){let i=e.hrefField,l=void 0===i||0===i.length?t(o):de(n.allFields,i,n.locale,void 0!==e.locale),s=nt(r,e.fieldName,l);"safe"===s.kind?r.setAttribute("href",s.url):"unsafe"===s.kind&&r.removeAttribute("href")}r.textContent=o}else r.value=o}}}function ot(e){for(let t of er)e.removeAttribute(t)}function lt(e,t,i){e.src=t;let n=function(e){if(void 0===e?.sizes)return;let t=[];for(let i of Object.values(e.sizes))"string"!=typeof i.url||"number"!=typeof i.width||!T(i.url)||t.push(`${st(i.url)} ${String(i.width)}w`);return 0!==t.length?("number"==typeof e.width&&"string"==typeof e.url&&T(e.url)&&t.push(`${st(e.url)} ${String(e.width)}w`),t.join(", ")):void 0}(i);void 0!==n?e.setAttribute("srcset",n):(e.removeAttribute("srcset"),e.removeAttribute("sizes"))}function st(e){return e.replace(/[\\s,]/g,encodeURIComponent)}function at(e){"IMG"===e.tagName?ot(e):e.style.backgroundImage=""}function ut(e){"IMG"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):ot(e)}function dt(e){let t=je(e);return void 0===t?Re(e):ze(t)??""}function ct(e,t){let i=e??"";if(null==t)return i;let n=ht(t);return"{}"===n?i:`${i}|${n}`}function ht(e){if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(e=>ht(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)}:${ht(i)}`)}return`{${n.join(",")}}`}function ft(e){return{kind:"date",options:e}}function pt(e){return{kind:"number",options:e}}function mt(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?ft({dateStyle:"medium"}):ur.has(n)?ft({dateStyle:n}):void 0;case"time":return void 0===n?ft({timeStyle:"short"}):dr.has(n)?ft({timeStyle:n}):void 0;case"datetime":return void 0===n?ft({dateStyle:"medium",timeStyle:"short"}):ur.has(n)?ft({dateStyle:n,timeStyle:"short"===n?"short":"medium"}):void 0;case"number":return void 0===n?pt({}):hr.test(n)?pt({minimumFractionDigits:Number(n),maximumFractionDigits:Number(n)}):void 0;case"currency":return void 0!==n&&cr.test(n)?pt({style:"currency",currency:n.toUpperCase()}):void 0;case"percent":return void 0===n?pt({style:"percent"}):void 0;default:return}}(t);if(void 0!==r)return r.kind===e?r.options:void 0;!function(e,t,i){fr.has(e)||(fr.add(e),At(`[live-preview] LP0408: data-payload-format="${i}" on "${t}" is not a known format; the default formatting was used. Known: date, date:short|medium|long|full, time, datetime, number, number:0-4, currency:XXX, percent.`))}(i,n,t)}function gt(e){return String(e).padStart(2,"0")}function vt(e,t){return{name:e,render(){g(t)}}}function yt(){return typeof __LIVE_PREVIEW_CONFIG__>"u"?[]:__LIVE_PREVIEW_CONFIG__}var bt=Object.defineProperty,wt=e=>{throw TypeError(e)},St=(e,t,i)=>((e,t,i)=>t in e?bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i),Tt=(e,t,i)=>t.has(e)||wt("Cannot "+i),kt=(e,t,i)=>(Tt(e,t,"read from private field"),i?i.call(e):t.get(e)),Ct=(e,t,i)=>t.has(e)?wt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),$t=(e,t,i,n)=>(Tt(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),Rt=(e,t,i)=>(Tt(e,t,"access private method"),i),Ft=t((...e)=>console.error(...e)),At=t((...e)=>console.warn(...e)),Nt=t((...e)=>console.debug(...e)),Mt=class{constructor(){Ct(this,Et);Ct(this,xt,new Map);Ct(this,Ot,new Map)}on(e,t){return Rt(this,Et,Pt).call(this,kt(this,xt),e,t)}once(e,t){return Rt(this,Et,Pt).call(this,kt(this,Ot),e,t)}off(e,t){Rt(this,Et,Lt).call(this,kt(this,xt),e,t),Rt(this,Et,Lt).call(this,kt(this,Ot),e,t)}async emit(e,t){await Rt(this,Et,Ut).call(this,e,t)}async emitWhile(e,t,i){return Rt(this,Et,Ut).call(this,e,t,i)}listenerCount(e){return(kt(this,xt).get(e)?.size??0)+(kt(this,Ot).get(e)?.size??0)}removeAllListeners(e){void 0!==e?(kt(this,xt).delete(e),kt(this,Ot).delete(e)):(kt(this,xt).clear(),kt(this,Ot).clear())}eventNames(){let e=new Set;for(let t of kt(this,xt).keys())e.add(t);for(let t of kt(this,Ot).keys())e.add(t);return[...e]}},xt=new WeakMap,Ot=new WeakMap,Et=new WeakSet,Ut=async function(e,t,i){let n=()=>i?.()??!0;if(!n())return!1;let r=kt(this,xt).get(e);if(r)for(let i of[...r])if(!n()||(await Rt(this,Et,It).call(this,i,t,e),!n()))return!1;if(!n())return!1;let o=kt(this,Ot).get(e);if(o&&o.size>0){let i=[...o];kt(this,Ot).delete(e);for(let r of i)if(!n()||(await Rt(this,Et,It).call(this,r,t,e),!n()))return!1}return n()},Pt=function(e,t,i){let n=e.get(t);return n||(n=new Set,e.set(t,n)),n.add(i),()=>{Rt(this,Et,Lt).call(this,e,t,i)}},Lt=function(e,t,i){let n=e.get(t);void 0!==n&&(n.delete(i),0===n.size&&e.delete(t))},It=async function(e,t,i){try{await e(t)}catch(e){let t="string"==typeof i||"number"==typeof i?String(i):"<event>";Ft(`[live-preview] LP0601: handler for "${t}" threw:`,e)}},_t=new Set(["date","number","checkbox"]),jt=40,Bt=["data","fieldSchemaJSON","globalSlug","collectionSlug","locale","ready","previewToken","protocolVersion"],Wt={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"}},Vt=Object.keys(Wt),zt=class{constructor(e,t){St(this,"matcher");St(this,"handlers");St(this,"boundListener");St(this,"attachedTarget");St(this,"generation",0);St(this,"revision",0);St(this,"queueHead");St(this,"queueTail");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)}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&&!f(t.data))&&h(t.fieldSchemaJSON,e=>Array.isArray(e))&&h(t.globalSlug,e=>"string"==typeof e)&&h(t.collectionSlug,e=>"string"==typeof e)&&h(t.locale,e=>"string"==typeof e)&&h(t.ready,e=>"boolean"==typeof e)&&h(t.previewToken,e=>"string"==typeof e)&&h(t.protocolVersion,e=>"number"==typeof e)}(r)){this.reportInvalid("shape",n,t);return}this.dispatchUpdate(function(e){let t={...e};for(let e of Bt)null===Reflect.get(t,e)&&Reflect.deleteProperty(t,e);if(!Array.isArray(t.fieldSchemaJSON))return t;let i;try{i=u(t.fieldSchemaJSON)}catch{i=[]}return{...t,fieldSchemaJSON:i}}(r),n,t);return;case"payload-document-event":if(!function(e){let t=e;return c(t.action,e=>"updated"===e||"created"===e||"deleted"===e)&&c(t.slug,e=>"string"==typeof e)&&c(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=f(e.data);if(!this.isCurrentGeneration(i))return;let r=n?{generation:i,revision:this.revision+=1}:void 0,o=this.handlers.validateToken;if(!this.isCurrentGeneration(i))return;if(void 0===o){this.commitUpdate(e,t,i,r);return}if(!0===e.ready&&void 0===e.data){this.commitUpdate(e,t,i,void 0);return}let l={generation:i,message:e,origin:t,messageRevision:r,verdict:void 0,next:void 0};this.enqueue(l);let s;try{s=o(e.previewToken,t)}catch{this.settleValidation(l,!1);return}"boolean"!=typeof s?Promise.resolve(s).then(e=>{this.settleValidation(l,!0===e)},()=>{this.settleValidation(l,!1)}):this.settleValidation(l,s)}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){void 0===n?this.invokeHandler(i,this.handlers.onUpdate,e,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}},Dt={"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\'"},Ht=new Set,qt=new Set(["tabs","row","collapsible"]),Gt={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"},Jt=new Set(["http:","https:","mailto:","tel:"]),Kt=/^\\s*(?:javascript|data|vbscript|file|blob|about)\\s*:/i,Qt=/^(?:\\.{1,2}\\/|[a-zA-Z0-9_-]+\\/?)/,Xt=/^[\\\\/]{2}/,Zt=/[\\t\\n\\r]/g,Yt=new Set(["style","srcdoc","formaction","form","id","name","is","srcset","imagesrcset"]),ei=new Set(["href","src","poster","cite","action","xlink:href","data"]),ti=new WeakSet,ii=class{constructor(){St(this,"previous",null)}diff(e,t){let i=this.previous,n=null===i,r=new Map,o=new Set;for(let[t,n]of Object.entries(e)){let e=$(n);r.set(t,e),(null===i||void 0===e||i.get(t)!==e)&&o.add(t)}if(null!==i)for(let e of i.keys())r.has(e)||o.add(e);this.previous=r;let l=new Set;for(let[e,i]of Object.entries(t))if(o.has(e))for(let e of i)l.add(e);return{changed:o,invalidated:l,baseline:n}}reset(){this.previous=null}},ni="data-payload-fragment",ri="data-payload-strategy",oi=new Set(["id","_id","createdAt","updatedAt","createdBy","updatedBy","_status","globalType","collection","locale","localized"]),li=new Set(["text","textarea","email","number","checkbox","date","select","radio","point","code","json","ui","html"]),si={},ai=class{constructor(){St(this,"rawChanges",new ii);St(this,"resolved",null);St(this,"queued",null);St(this,"pending",null);St(this,"timer",null);St(this,"openUntil",0)}decide(e,t){let i=t.message.data??{},{changed:n}=this.rawChanges.diff(i,si);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(_(e)||e.fieldName.includes(".")||B(e.hrefField)||B(e.srcField)||B(e.altField))return!0;return void 0!==e.strategies.fragment&&null!==e.root.querySelector(`[${ni}]`)}(e))return{merge:!1,fields:i};let r=this.resolved;if(null===r)return this.resolved=i,{merge:!0,fields:i};let o={...r},l=t.forceRender;for(let s of n){let n=i[s];if(oi.has(s)){o[s]=n;continue}let a=I(s,r[s],n,e.cache,t.schemaIndex);"own"!==a&&(l=!0),"keep"!==a&&(o[s]=n)}return this.resolved=o,{merge:l,fields:o}}request(e,t,i){let n=Date.now();return n>=this.openUntil?(this.dropQueued(),this.openUntil=n+t,{leading:!0,result:e.merge(i)}):(this.queued=i,this.openUntil=n+t,this.pending??(this.pending=function(){let e;return{promise:new Promise(t=>{e=t}),settle:e}}()),null!==this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.flush(e)},t),{leading:!1,result:this.pending.promise})}recordMerged(e){this.resolved=e}destroy(){this.dropQueued(),this.openUntil=0}dropQueued(){null!==this.timer&&clearTimeout(this.timer),this.timer=null,this.queued=null,this.pending?.settle({status:"superseded"}),this.pending=null}flush(e){let t=this.pending,i=this.queued;this.timer=null,this.pending=null,this.queued=null,null!==t&&null!==i&&e.merge(i).then(t.settle,()=>{t.settle({status:"unavailable"})})}},ui=class{constructor(){St(this,"negotiation",p(void 0));St(this,"observed",new Set)}observe(e,t){let i=e.filter(e=>!this.observed.has(e));if(0!==i.length){for(let e of i)this.observed.add(e);this.negotiation=p(this.negotiation.theirs,this.observed),t("protocol",`observed=${i.join(",")}`)}}applyVersion(e,t){let i=this.negotiation;if(i.theirs===e)return;let n=p(e,this.observed);this.negotiation=n,n.negotiated!==i.negotiated&&t("protocol","ours=4",`theirs=${e}`,`negotiated=${n.negotiated}`)}},di=class{constructor(){St(this,"lastIdentity")}edit(e){let t=e.externallyUpdatedRelationship;if("object"!=typeof t||null===t)return null;let i=JSON.stringify([t.entitySlug,O(t),t.updatedAt]),n=i!==this.lastIdentity;return this.lastIdentity=i,n&&function(e,t){let i=t.globalSlug??t.collectionSlug;if("string"!=typeof i||e.entitySlug!==i)return!0;let n=O(e),r=O(t.data??{});return void 0!==n&&void 0!==r&&n!==r}(t,e)?t:null}},ci=class{constructor(){Ct(this,hi)}reveal(e,t,i){return e===kt(this,hi)?"skipped-same":($t(this,hi,e),function(e,t){return function(e,t){let i=e.getBoundingClientRect(),n=i.bottom>0&&i.top<t.innerHeight,r=i.right>0&&i.left<t.innerWidth;return n&&r}(e,t)?"already-visible":(e.scrollIntoView({behavior:V(t)?"auto":"smooth",block:"center"}),"revealed")}(t,i))}reset(){$t(this,hi,void 0)}},hi=new WeakMap,fi=class{constructor(){St(this,"seen",new Map)}note(e,t,i){let n=$(i);if(void 0===n)return;let r=`${t.owner??""}\\0${t.locale??""}\\0${t.fieldName}`,o=this.seen.get(r);void 0!==o?o!==n&&(e.revealIdentities.push([r,n]),e.revealTarget??(e.revealTarget=t)):this.seen.set(r,n)}commit(e){for(let[t,i]of e.revealIdentities)this.seen.set(t,i);e.revealIdentities=[];let t=e.revealTarget;return e.revealTarget=void 0,t}},pi=class{constructor(){St(this,"started",!1);St(this,"suspended",!1);St(this,"deferredStart",null);St(this,"hydration","idle");St(this,"activeUpdate",null);St(this,"locale");St(this,"schema");St(this,"schemaIndex");St(this,"updateCount",0);St(this,"supersededCount",0);St(this,"completedCount",0);St(this,"skippedUnchangedCount",0);St(this,"lastFlush",null);St(this,"absentFields",new Set);St(this,"warnedOrphanFields",new Set);St(this,"warnedStrategy",new WeakSet);St(this,"warnedUnattributableMessage",!1);St(this,"warnedVisibilityGate",!1);St(this,"warnedFragmentFallback",!1);St(this,"warnedEscalationUnavailable",!1);St(this,"warnedProtocolShape",!1);St(this,"reportedUnfaithful",new WeakSet);St(this,"checkedServerFormat",new WeakSet);St(this,"unfaithfulPatches",[]);St(this,"unfaithfulCount",0);St(this,"escalatedCount",0);St(this,"unfaithfulFields",new Set);St(this,"autoBindSearchMs");St(this,"autoBindGuesses",null);St(this,"warnedForeignSource",!1);St(this,"lastAppliedIdentity",new WeakMap);St(this,"revealLedger",new fi);St(this,"fragmentStats",{rendered:0,failed:0,superseded:0});St(this,"routeStats",{refreshes:0,failed:0,refused:0,loopStopped:0});St(this,"fragmentController",null);St(this,"routeController",null);St(this,"routeRetry",null);St(this,"routeRefreshOwed",!1);St(this,"readyTimers",[]);St(this,"revealer",new ci);St(this,"changes",new ii);St(this,"merges",new ai);St(this,"protocol",new ui);St(this,"relationships",new di)}isRunning(){return this.started}isCurrent(e){return this.started&&this.activeUpdate===e}complete(e){e.completed||(e.completed=!0,this.completedCount+=1)}abortStrategies(){null!==this.routeRetry&&(clearTimeout(this.routeRetry),this.routeRetry=null,this.routeRefreshOwed=!0);for(let e of["fragmentController","routeController"]){let t=this[e];null!==t&&(this[e]=null,t.abort())}}},mi=class{constructor(e,t){St(this,"deps",e);St(this,"state",t);St(this,"instanceContext");this.instanceContext=function(e){let t={};for(let[i,n]of Object.entries(e))void 0!==n&&(t[i]=n);return t}({renderRichText:e.renderRichText,sanitizerPolicy:e.sanitizerPolicy,reportUnfaithful:(i,n)=>{r(e,t,i,n)}})}apply(e){let{deps:t,state:i}=this,n=i.activeUpdate;if(null===n||void 0===e.revision||!m(n.revision,e.revision)||!i.isCurrent(n))return!1;let{target:o,value:a}=e,u=void 0!==n.schemaIndex?S(n.schemaIndex,o.fieldName):void 0,d=function(e,t){if(e.explicitFieldType)return e.fieldType;if(void 0!==t){let e=function(e){if(Object.prototype.hasOwnProperty.call(Gt,e))return Gt[e]}(t);if(void 0!==e)return e}return e.fieldType}(o,u?.type);"text"===d&&!0!==o.explicitFieldType&&function(e){if("object"!=typeof e||null===e||!("root"in e))return!1;let t=e.root;return"object"==typeof t&&null!==t&&Array.isArray(t.children)}(a)&&(d="richText");let c;try{c=t.resolveRenderer(d,o)}catch(e){return this.fail(n,e)}if(!i.isCurrent(n))return!1;let h=t.emitter.listenerCount("elementUpdate")>0,f=h?function(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value:"IMG"===e.tagName?e.src:e.textContent}(o.element):void 0;if(!i.isCurrent(n))return!1;let p={allFields:e.allFields,locale:o.locale??n.locale,schema:u,...this.instanceContext};!0===o.hidesWhenEmpty&&o.element.toggleAttribute("hidden",function(e){return null==e||("string"==typeof e?0===e.trim().length:Array.isArray(e)&&0===e.length)}(a));try{if(void 0!==o.targetAttribute){if("blocked"===function(e,t,i){let n=t.toLowerCase().trim();if(0===n.length||!function(e){return!e.startsWith("on")&&!Yt.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 ei.has(n)&&!T(r)?"blocked":(e.setAttribute(n,r),"applied")}(o.element,o.targetAttribute,a))return t.warn(`[live-preview] LP0401: refused to write "${o.fieldName}" into attribute "${o.targetAttribute}"`),!1}else{if(void 0===c)return t.log("no renderer for",d),r(t,i,o,`has no renderer for "${d}"`),!1;{let e=function(e,t,i,n){if("ignore"===e.onUnfaithfulPatch||void 0!==i.format||!_t.has(n)||t.checkedServerFormat.has(i.element))return;t.checkedServerFormat.add(i.element);let r=l(i.element);return r.trim().length>0?r:void 0}(t,i,o,d);if(!1===function(e,t,i,n){return e.render(t,i,n)}(c,o,a,p)&&function(e){return ti.has(e.render)}(c))return r(t,i,o,`is a value ${c.name} cannot render`),!1;void 0!==e&&function(e,t,i){let n=l(t.element);n!==i&&e.warn(`[live-preview] LP0412: "${t.fieldName}" showed ${s(i)}, the patch wrote ${s(n)} \\u2014 either an edit that arrived before the preview connected, or a template that formats this value differently. Set data-payload-format to match it.`)}(t,o,e)}}}catch(e){return this.fail(n,e)}if(!i.isCurrent(n))return!1;h&&t.emitter.emitWhile("elementUpdate",{element:o.element,fieldName:o.fieldName,previousValue:f,nextValue:a,revision:n.revision.revision,receivedAt:n.receivedAt,source:"patch"},()=>i.isCurrent(n));let g=i.isCurrent(n);return g&&(void 0!==e.valueIdentity?i.lastAppliedIdentity.set(o.element,e.valueIdentity):i.lastAppliedIdentity.delete(o.element)),g}fail(e,t){if(!this.state.isCurrent(e))return!1;let i=t instanceof Error?t:new Error(String(t));return this.deps.emitter.emitWhile("error",{error:i,context:"renderer",code:"LP0603"},()=>this.state.isCurrent(e)),!1}},gi="data-payload-island",vi=`astro-island, [${gi}]`,yi="data-payload-field",bi="data-payload-type",wi="data-payload-attribute",Si="data-payload-href",Ti="data-payload-src",ki="data-payload-alt",Ci="data-payload-array-template",$i="data-payload-array-separator",Ri="data-payload-locale",Fi="data-payload-richtext",Ai="data-payload-html",Ni="data-payload-array",Mi="data-payload-structural",xi="data-payload-owner",Oi="data-payload-depends",Ei="data-payload-strategy",Ui="data-payload-boundary",Pi=[yi,bi,wi,Si,Ti,ki,Ci,$i,Ri,Fi,Ai,Ni,Mi,xi,Oi,Ei,Ui,"type"],Li=`[${yi}]`,Ii=`[${xi}]`,_i=/^[a-z][a-z0-9-]*:[a-z][a-z0-9-]*$/i,ji=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"]),Bi=class{constructor(e={}){St(this,"entriesByField",new Map);St(this,"entryByElement",new WeakMap);St(this,"filter");St(this,"count",0);St(this,"dependencies",null);St(this,"islandRoots",[]);this.filter=e.filter??K}dependencyMap(){if(null!==this.dependencies)return this.dependencies;let e=[];for(let t of this.values())void 0!==t.dependsOn&&e.push(D(t.fieldName,t.dependsOn));return this.dependencies=z(...e),this.dependencies}get islands(){return this.islandRoots}buildFromRoot(e){let t=performance.now();this.clear();let i=0;for(let t of e.querySelectorAll(Li))void 0!==this.add(t)&&(i+=1);return this.islandRoots=function(e){let t=[];for(let i of e.querySelectorAll(vi))H(i)||t.push(i);return t}(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=[]}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(yi);if(null===t||0===t.length)return;let i=e.getAttribute(bi),n=e.getAttribute(wi),r=e.getAttribute(Si),o=e.getAttribute(Ti),l=e.getAttribute(ki),s=e.getAttribute(Ci),a=e.getAttribute($i),u=e.getAttribute(Ri),d=e.getAttribute("data-payload-format"),c=function(e){let t=e.closest(Ii)?.getAttribute(xi);return null==t||0===t.length?void 0:t}(e),h=function(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}(e.getAttribute(Oi)),f=e.getAttribute(Ei),p=e.getAttribute("data-payload-guessed"),m=R(e);return{element:e,fieldName:t,fieldType:J(e),explicitFieldType:null!==i&&G(i),strategyKind:F(e)??"unknown",...null!==m?{fragmentBoundary:m}:{},...null!==n&&n.length>0?{targetAttribute:n}:{},...null!==r&&r.length>0?{hrefField:r}:{},...null!==o&&o.length>0?{srcField:o}:{},...null!==l&&l.length>0?{altField:l}:{},...null!==s?{arrayTemplate:s}:{},...null!==a?{arraySeparator:a}:{},...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(Ui)?{hidesWhenEmpty:!0}:{},...null!==p?{guessed:p}:{}}}},Wi=class{constructor(e){St(this,"serverURL");St(this,"apiRoute");St(this,"depth");St(this,"fetchFn");St(this,"log");St(this,"inflight",null);St(this,"attempt",0);St(this,"destroyDepth",0);this.serverURL=function(e){let t=e.length;for(;e.endsWith("/",t);)t-=1;return e.slice(0,t)}(e.serverURL);let n=e.apiRoute??"/api";this.apiRoute=n.startsWith("/")?n:`/${n}`,this.depth=e.depth??1,this.fetchFn=e.fetchFn,this.log=t(e.log??i)}canMerge(e){return null!==this.endpointOf(e)}endpointOf(e){try{let t=e.globalSlug;if(t)return X(t)?`globals/${encodeURIComponent(t)}`:null;let i=e.collectionSlug??"",n=e.data.id;return X(i)&&function(e){return"number"==typeof e?Number.isFinite(e):"string"==typeof e&&Q(e,512)}(n)?`${encodeURIComponent(i)}/${encodeURIComponent(String(n))}`:null}catch{return null}}async merge(e){if(this.destroyDepth>0)return{status:"superseded"};let t=this.attempt+=1,i=this.inflight;this.inflight=null;let n=null,r=()=>this.attempt!==t;try{if(i?.abort(),r())return{status:"superseded"};let t=this.endpointOf(e);if(null===t)return r()?{status:"superseded"}:{status:"unavailable"};let o=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(void 0===o)return{status:"unavailable"};n=new AbortController,this.inflight=n;let l=`${this.serverURL}${this.apiRoute}/${t}`,s=await o(l,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","X-Payload-HTTP-Method-Override":"GET"},body:JSON.stringify({data:e.data,depth:this.depth,flattenLocales:!1,locale:e.locale}),signal:n.signal});if(r())return{status:"superseded"};if(!s.ok)return this.log("merge HTTP",s.status,l),{status:"unavailable"};let a=await s.json();return r()?{status:"superseded"}:null===a||"object"!=typeof a||Array.isArray(a)?(this.log("merge invalid",l),{status:"unavailable"}):{status:"merged",doc:a}}catch(e){return r()?{status:"superseded"}:(this.log("merge exception",e),{status:"unavailable"})}finally{this.inflight===n&&(this.inflight=null)}}destroy(){this.attempt+=1;let e=this.inflight;this.inflight=null,this.destroyDepth+=1;try{e?.abort()}finally{this.destroyDepth-=1}}},Vi="2.0.4",zi={name:"payload-2",fieldTyping:"schema",populatesRelationships:"admin",documentEvents:!1},Di={name:"payload-3",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!0},Hi={name:"unknown",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!1},qi=1,Gi=class{constructor(e,t={}){St(this,"callbacks");St(this,"debounceMs");St(this,"rootMargin");St(this,"visible",new Set);St(this,"mutation",null);St(this,"intersection",null);St(this,"debounceTimer",null);St(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:[...Pi]})}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)||!function(e){for(let t of e){if("attributes"===t.type&&null!==t.attributeName&&Pi.includes(t.attributeName)&&(t.attributeName===yi||t.attributeName===xi||t.target.nodeType===qi&&t.target.hasAttribute(yi)))return!0;for(let e of t.addedNodes)if(Y(e))return!0;for(let e of t.removedNodes)if(Y(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}},Ji="__livePreviewHydration",Ki="[data-payload-field]",Qi="__vue_app__",Xi="__livePreviewVueHydration",Zi="app:suspense:resolve",Yi=class{constructor(e){St(this,"timeoutMs");St(this,"onTimeout");St(this,"handle",null);St(this,"lastKick",0);this.timeoutMs=e.timeoutMs??0,this.onTimeout=e.onTimeout}kick(){if(this.lastKick=Date.now(),this.timeoutMs<=0)return;null!==this.handle&&clearTimeout(this.handle);let e=setTimeout(()=>{this.handle===e&&(this.handle=null,this.onTimeout())},this.timeoutMs);this.handle=e}stop(){null!==this.handle&&(clearTimeout(this.handle),this.handle=null)}get lastKickAt(){return this.lastKick}get pending(){return null!==this.handle}},en=class{constructor(){St(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)}},tn=new Set(["__proto__","prototype","constructor"]),nn="payload-live-preview",rn=Symbol.for("payload-live-preview.trusted-types"),on=new Set,ln="data-payload-",sn=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"]),an=new Set(["input","button","textarea","select","option","label"]),un=new Set(["script","style","iframe","object","embed","link","meta","base","form","input","button","select","textarea","svg","math","template","frame","frameset","noframes","noscript"]),dn=new Set(["id","class","lang","dir","title","role","tabindex"]),cn="aria-",hn="data-",fn="data-payload-",pn={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"])},mn=new Set(["href","src","cite","poster"]),gn=1,vn=8,yn=(Error,new Set(["id","name","data-payload-key","data-payload-nested-key","data-payload-nested-template"])),bn="strict",wn=(Object.freeze({allowedTags:sn,removeCompletely:un,globalAttributes:dn,attributesByTag:pn,urlAttributes:mn}),Object.freeze({"&":"&","<":"<",">":">",\'"\':""","\'":"'","/":"/","`":"`","=":"="})),Sn=/[&<>"\'/`=]/g,Tn=Object.freeze({"&":"&","<":"<",">":">",\'"\':""","\'":"'"}),kn=/[&<>"\']/g,Cn=new Set,$n=class{constructor(e,t,i){St(this,"deps",e);St(this,"state",t);St(this,"strategies");this.strategies=function(e,t){return{planFragments:()=>null,escalateUnfaithful:()=>{},hasUnboundChange:(i,n)=>{if(i.baseline)return!1;let r=function(e,t,i,n){let r=L(e,i,n),o=[];for(let e of t)!oi.has(e)&&!r(e)&&o.push(e);return o}(e.cache,i.touched,i.locale,n);for(let e of r)o(t,e);return!1},hasRouteBinding:()=>!1,runFragments:()=>Promise.resolve(),refreshRoute:()=>(g("route refreshes"),Promise.resolve()),warnFragmentFallback:i=>{g("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)}handleUpdate(e,t,i){let{deps:n,state:r}=this;if(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),void 0===e.data){void 0!==e.protocolVersion&&r.protocol.applyVersion(e.protocolVersion,n.log);return}if(void 0===i)return;let o=r.relationships.edit(e);null!==o&&n.emitter.emit("relationshipUpdate",{detail:o,timestamp:Date.now()}),"string"==typeof e.locale&&(r.locale=e.locale),Array.isArray(e.fieldSchemaJSON)&&(r.schema=e.fieldSchemaJSON,r.schemaIndex=b(e.fieldSchemaJSON));let l={revision:i,message:e,locale:r.locale,schema:r.schema,schemaIndex:r.schemaIndex,receivedAt:Date.now(),forceRender:null!==o||W(r.activeUpdate),touched:new Set,baseline:!1,invalidated:new Set,revealTarget:void 0,revealIdentities:[],pendingFragments:0,routeRefreshed:!1,cancelled:!1,completed:!1},s=r.activeUpdate;r.abortStrategies(),null!==s&&!s.completed&&(r.supersededCount+=1),r.activeUpdate=l,n.scheduler.acceptRevision(i),r.updateCount+=1,(void 0===e.protocolVersion||(r.protocol.applyVersion(e.protocolVersion,n.log),r.isCurrent(l)))&&(n.connection.markConnected()&&(n.a11y?.announceConnected(),n.emitter.emit("connect",{origin:t,timestamp:Date.now()}),!r.isCurrent(l)||(n.log("connection","disconnected","\\u2192","connected"),!r.isCurrent(l)))||this.processUpdate(l).catch(e=>{n.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,o=z(n.dependencies,n.cache.dependencyMap()),l=r.changes.diff(t.fields,o);l.baseline&&!i&&"off"!==n.autoBind&&g("auto-binding"),e.baseline=l.baseline,e.invalidated=i?Cn:l.invalidated,e.touched=i?Cn:new Set([...l.changed,...l.invalidated]),this.scheduleAllFields(e,t)}async resolveIncomingFields(e){let{deps:t,state:i}=this,n=e.message.data??{};if(null===t.merger||"admin"===Z(i.protocol.observed).populatesRelationships)return n;let r=i.merges.decide(t,e);if(!r.merge)return r.fields;let{message:o}=e,l=i.merges.request(t.merger,t.mergeWindowMs,{collectionSlug:o.collectionSlug,globalSlug:o.globalSlug,data:n,locale:e.locale});if(!l.leading)return this.applyMerged(e,l.result).catch(e=>{t.log("update failed:",e)}),r.fields;let s=await l.result;return i.isCurrent(e)?"merged"===s.status?(i.merges.recordMerged(s.doc),s.doc):"superseded"===s.status?null:r.fields:null}async applyMerged(e,t){let{state:i}=this,n=await t;"merged"!==n.status||!i.isCurrent(e)||(i.merges.recordMerged(n.doc),this.applyFields(e,this.dataFor(e,n.doc),!0))}scheduleAllFields(e,t){let{deps:i,state:n}=this;if(!n.isCurrent(e))return;let r=()=>n.isCurrent(e),o=this.ownerKeysForUpdate(e,t.fields),{touched:l}=e,s=i.strategies.route,a=this.strategies.hasUnboundChange(e,o),u=n.routeRefreshOwed;if(void 0!==s&&!e.routeRefreshed&&(a||u||s.plan(i.root,l)||this.strategies.hasRouteBinding(l))){n.routeRefreshOwed=!1,this.strategies.refreshRoute(e,t,s);return}let d=this.strategies.planFragments(l),c=i.skipUnchanged,h=0;for(let[l,s]of i.cache.entries()){if(!r())return;for(let a of s){if(!1!==o&&!x(a.owner,o))continue;if(!0===d?.covers(a)){if(i.revealEditedField){let i=he(t.fields,a,l,e.locale);n.revealLedger.note(e,a,i)}continue}let s=a.strategyKind??F(a.element)??"unknown";if("unknown"===s){this.strategies.warnUnsupportedStrategy(a);continue}"fragment"===s&&null===d&&this.strategies.warnFragmentFallback(a);let u=he(t.fields,a,l,e.locale);if(void 0===u){n.absentFields.add(l);continue}if(i.revealEditedField&&n.revealLedger.note(e,a,u),!r())return;let f=Me(i,a,u,t.fields,r);if(!r())return;let p=c?fe(a,f,t.fields,e.locale):void 0,m=n.lastAppliedIdentity.get(a.element);if(!e.forceRender&&i.skipUnchanged&&void 0!==p&&m===p&&!e.invalidated.has(l)){n.skippedUnchangedCount+=1;continue}let g={target:a,value:f,allFields:t.fields,revision:e.revision,data:t,valueIdentity:p};i.scheduler.schedule(g),h+=1}}(function(e,t,i,n){let{cache:r}=e;if(0===r.fieldCount||!1!==n&&!function(e,t){for(let i of e.values())if(x(i.owner,t))return!0;return!1}(r,n))return;let o=L(r,i,n);for(let[n,r]of Object.entries(t)){if(oi.has(n))continue;if(me(r)){pe(e,o,n,i,r);continue}if(!ge(r)||o(n))continue;let t=P(n,i);for(let[n,l]of Object.entries(r))!me(l)||oi.has(n)||pe(e,o,`${t}.${n}`,i,l)}})({cache:i.cache,warned:n.warnedOrphanFields,warn:i.warn},t.fields,e.locale,o),null!==d&&d.boundaries.length>0&&(e.pendingFragments=d.boundaries.length,this.strategies.runFragments(e,t,d)),0===h&&0===e.pendingFragments&&(n.complete(e),this.revealPending(e),this.notifyIslands(e,t))}notifyIslands(e,t){0!==e.touched.size&&function(e,t){for(let i of e)i.dispatchEvent(new CustomEvent("payload-live-preview:update",{detail:t,bubbles:!1}));e.length}(this.deps.cache.islands,{fields:t.fields,revision:e.revision.revision,receivedAt:e.receivedAt,locale:e.locale})}restoreGuesses(e,t){let{deps:i,state:n}=this;"off"===i.autoBind||n.autoBindGuesses}ownerKeysForUpdate(e,t){let{deps:i,state:n}=this;if(!i.scopeBindingsByOwner)return!1;let{message:r}=e,o=function(e){if(M(e.globalSlug))return[A(e.globalSlug)];if(!M(e.collectionSlug))return null;let t=N(e.collectionSlug);return M(e.documentId)?[t,N(e.collectionSlug,e.documentId)]:[t]}({globalSlug:"string"==typeof r.globalSlug?r.globalSlug:void 0,collectionSlug:"string"==typeof r.collectionSlug?r.collectionSlug:void 0,documentId:O(t)});return null===o&&!n.warnedUnattributableMessage&&(n.warnedUnattributableMessage=!0,i.warn("[live-preview] LP0202: scopeBindingsByOwner: update names no document; nothing applied")),o}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 o=i.activeUpdate;if(null===o||!i.isCurrent(o)||!m(o.revision,n))return;0===o.pendingFragments&&i.complete(o);let l=()=>i.isCurrent(o)&&m(o.revision,n);if(this.revealPending(o),!l())return;let s=i.unfaithfulPatches;s.length>0&&(i.unfaithfulPatches=[],void 0!==r&&this.strategies.escalateUnfaithful(o,r,s),!l())||void 0!==r&&(e.applied>0&&t.a11y?.announceUpdate(e.applied),l()&&(this.notifyIslands(o,r),l()&&0!==e.applied&&0!==t.emitter.listenerCount("afterUpdate")&&t.emitter.emitWhile("afterUpdate",{data:r,updatedCount:e.applied,durationMs:e.durationMs,revision:n.revision,receivedAt:o.receivedAt,source:"patch"},l)))}revealPending(e){let t=this.state.revealLedger.commit(e);if(void 0!==t)try{this.revealBinding(t)}catch(e){this.deps.log("reveal",e)}}revealField(e){let t=this.deps.cache.get(e)?.[0];return void 0===t?"no-element":this.revealBinding(t)}revealBinding(e){let{element:t}=e,i=t.ownerDocument.defaultView;if(null===i)return"no-element";let n=`${e.owner??""} ${e.fieldName}`;return this.state.revealer.reveal(n,t,i)}},Rn=class{constructor(e,t){St(this,"apply");St(this,"debounceMs");St(this,"maxWaitMs");St(this,"isVisible");St(this,"gateThresholdValue");St(this,"gateDisabled");St(this,"getCacheSize");St(this,"onFlush");St(this,"scheduleFrame");St(this,"cancelFrame");St(this,"pending",new Map);St(this,"replay",new Map);St(this,"activeFlushes",new Set);St(this,"debounceTimer",null);St(this,"debounceToken",0);St(this,"deadlineTimer",null);St(this,"frameHandle",null);St(this,"frameToken",0);St(this,"windowUntil",0);St(this,"activeRevision",null);St(this,"activeRevisionCancelled",!1);this.apply=e,this.debounceMs=t.debounceMs??50,this.maxWaitMs=t.maxWaitMs??4*this.debounceMs,this.isVisible=t.isVisible,this.gateThresholdValue=t.visibilityGateThreshold??50,this.gateDisabled=t.disableVisibilityGate??!1,this.getCacheSize=t.getCacheSize,this.onFlush=t.onFlush,this.scheduleFrame=t.scheduleFrame??("function"==typeof requestAnimationFrame?requestAnimationFrame.bind(globalThis):e=>setTimeout(()=>{e(performance.now())},0)),this.cancelFrame=t.cancelFrame??("function"==typeof cancelAnimationFrame?cancelAnimationFrame.bind(globalThis):e=>{clearTimeout(e)})}schedule(e){if(void 0!==e.revision&&(this.activeRevisionCancelled||null===this.activeRevision||!m(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){null!==this.activeRevision&&m(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.cancelScheduledWork(),this.clearWork(),this.activeRevision=e,this.activeRevisionCancelled=!1)}cancelRevision(e){null===this.activeRevision||!m(e,this.activeRevision)||(this.cancelScheduledWork(),this.clearWork(),this.activeRevisionCancelled=!0)}flushNow(){return this.cancelScheduledWork(),this.flush()}notifyVisible(e){let t=this.replay.get(e);if(!t||(this.replay.delete(e),!this.isCurrent(t)))return;let 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(){this.cancelScheduledWork(),this.clearWork(),this.activeRevision=null,this.activeRevisionCancelled=!1,this.windowUntil=0}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,null!==t&&this.cancelFrame(t),this.frameToken!==e)return;let i=!1,n=this.scheduleFrame(()=>{this.frameToken===e&&(i=!0,this.frameHandle=null,this.flush())});!i&&this.frameToken===e&&(this.frameHandle=n)}flush(){let e=performance.now();this.clearDeadline();let t=this.gateActive,i=this.pending;this.pending=new Map;let n,r=0,o=[],l=0;this.activeFlushes.add(i);try{for(let e of i.values()){if(!this.isCurrent(e))continue;let i=!t||this.isVisible(e.target.element);if(this.isCurrent(e)){if(n??(n=e),!i){this.replay.set(e.target.element,e),l+=1;continue}this.replay.delete(e.target.element),this.didApply(e)&&(r+=1,o.push(e.target.fieldName))}}}finally{this.activeFlushes.delete(i)}let s=this.statsFor(n,r,l,performance.now()-e,o);return this.onFlush?.(s),s}isCurrent(e){return void 0===e.revision||!this.activeRevisionCancelled&&null!==this.activeRevision&&m(e.revision,this.activeRevision)}didApply(e){return!1!==this.apply(e)||!function(e){return ti.has(e)}(this.apply)}retargetBuffer(e,t){let i=e.get(t.element);if(void 0!==i){if(i.target.fieldName!==t.fieldName||i.target.locale!==t.locale){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(),null!==e&&clearTimeout(e),null!==t&&this.cancelFrame(t)}},Fn=[0,500,1e3,2e3],An=class{constructor(e){St(this,"deps");St(this,"state",new pi);St(this,"pipeline");St(this,"writer");St(this,"rootSentinel",null);St(this,"observedRoot",null);let{emitter:r,renderers:o}=e,l=void 0===e.log?i:t(e.log),s=void 0===e.warn?At:t(e.warn),a=e.root??(typ','eof document<"u"?document:void 0);if(void 0===a)throw new Error("LivePreviewRuntime: no document; pass options.root");let u=new Bi({filter:e=>!function(e){let t=e;for(;null!==t;){if(q(t))return!0;t=t.parentElement}return!1}(e)}),d=new Gi({onStructuralChange:()=>{this.rebuildCache()},onVisibilityChange:(e,t)=>{t&&c.notifyVisible(e)}},void 0!==e.intersectionRootMargin?{intersectionRootMargin:e.intersectionRootMargin}:{}),c=new Rn(C(e=>this.writer.apply(e)),{...void 0!==e.debounceMs?{debounceMs:e.debounceMs}:{},...void 0!==e.disableVisibilityGate?{disableVisibilityGate:e.disableVisibilityGate}:{},...void 0!==e.visibilityGateThreshold?{visibilityGateThreshold:e.visibilityGateThreshold}:{},isVisible:e=>d.isVisible(e),getCacheSize:()=>u.elementCount,onFlush:e=>{this.pipeline.onFlush(e)}}),h=new zt(e.originMatcher,{onUpdate:(e,t,i)=>{this.pipeline.handleUpdate(e,t,i)},onDocumentEvent:()=>{this.state.protocol.observe(["document-events"],l),r.emit("documentSave",{timestamp:Date.now()})},onFocusField:e=>{this.deps.revealEditedField&&this.pipeline.revealField(e)},onInvalid:(e,t)=>{if("token"===e){let e=new Error(`Preview token rejected (origin: ${t})`);r.emit("error",{error:e,context:"token",code:"LP0502"})}("shape"===e||"type"===e)&&!this.state.warnedProtocolShape&&(this.state.warnedProtocolShape=!0,s(`[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,s(`[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.`)),l("LP0501 message rejected:",e,t)},...void 0!==e.validateToken?{validateToken:e.validateToken}:{},...void 0!==e.eventSourcePolicy?{sourcePolicy:e.eventSourcePolicy}:{}}),f=e.dataMerge;this.deps={emitter:r,cache:u,observers:d,scheduler:c,bus:h,connection:new en,heartbeat:new Yi({...void 0!==e.heartbeatMs?{timeoutMs:e.heartbeatMs}:{},onTimeout:()=>{this.onHeartbeatTimeout()}}),renderers:o,resolveRenderer:e.resolveRenderer??(e=>o[e]),transformValue:e.transformValue,renderRichText:e.renderRichText,sanitizerPolicy:e.sanitizerPolicy,root:a,readyTargets:"function"==typeof e.readyTargets?e.readyTargets:(e=>()=>e)(e.readyTargets),sendReady:e.sendReady??y,onHeartbeatTimeout:e.onHeartbeatTimeout,log:l,warn:s,a11y:v(e),merger:void 0===f?null:new Wi({serverURL:f.serverURL,...void 0!==f.apiRoute?{apiRoute:f.apiRoute}:{},...void 0!==f.depth?{depth:f.depth}:{},...void 0!==f.fetchFn?{fetchFn:f.fetchFn}:{},log:l}),mergeWindowMs:e.debounceMs??50,scopeBindingsByOwner:!0===e.scopeBindingsByOwner,lockedOrigin:e.lockedOrigin??(()=>{}),skipUnchanged:!0===e.skipUnchanged,dependencies:e.dependencies??{},strategies:e.strategies??{},revealEditedField:!0===e.revealEditedField,onUnfaithfulPatch:n(e),autoBind:e.autoBind??"off",hydration:e.hydration},this.writer=new mi(this.deps,this.state),this.pipeline=new $n(this.deps,this.state,()=>{this.rebuildCache()})}start(){let{state:e}=this;if(e.isRunning())return!1;e.started=!0,e.suspended=!1;try{return function(e){"react"===e.hydration?te():"vue"===e.hydration&&se();let{root:t}=e;if(!function(e){return 9===e.nodeType}(t)||"loading"!==t.readyState){ae(e);return}let i=()=>{e.isRunning()&&e.later(()=>{ae(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},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=xe(t.root)?Oe(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()))for(let i of Fn){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,i&&t.emitter.emit("disconnect",{reason:"destroy",timestamp:Date.now()}),t.a11y?.detach(),t.emitter.emit("destroy",{timestamp:Date.now()})}release(){let{state:e,deps:t}=this;e.activeUpdate=null,e.started=!1;let i=e.deferredStart;e.deferredStart=null,null!==i&&this.runCleanup(i);for(let t of e.readyTimers)this.runCleanup(()=>{clearTimeout(t)});return e.readyTimers.length=0,this.runCleanup(()=>{t.heartbeat.stop()}),this.runCleanup(()=>{t.bus.detach()}),e.abortStrategies(),this.runCleanup(()=>{this.rootSentinel?.disconnect(),this.rootSentinel=null,this.observedRoot=null}),this.runCleanup(()=>{t.observers.stop()}),this.runCleanup(()=>{t.scheduler.destroy()}),this.runCleanup(()=>{t.merger?.destroy(),e.merges.destroy()}),t.cache.clear(),t.connection.markDisconnected()}rollbackFailedStart(){this.release(),this.runCleanup(()=>{this.deps.a11y?.detach()})}runCleanup(e){try{e()}catch(e){this.deps.log("cleanup failed:",e)}}refreshCache(){this.state.isRunning()&&(this.state.revealer.reset(),this.followReplacedRoot()||this.rebuildCache())}watchRootReplacement(){let{root:e}=this.deps;!xe(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()||!xe(e))return!1;let t=Oe(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,o=t.activeUpdate,l=t.lastFlush,s=[],a=new Set,u=[];for(let[e,t]of i.entries()){s.push(e);for(let i of t)void 0!==i.owner&&a.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:Vi,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:Z(r.observed).name},revisions:{accepted:t.updateCount,superseded:t.supersededCount,completed:t.completedCount,skippedUnchanged:t.skippedUnchangedCount,active:null===o?void 0:o.revision.revision},bindings:{elements:i.elementCount,fields:i.fieldCount,fieldNames:s.sort(),absentFields:[...t.absentFields].sort(),orphanFields:[...t.warnedOrphanFields].sort(),ownerScoped:e.scopeBindingsByOwner,owners:[...a].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:o?.pendingFragments??0,...t.fragmentStats},scheduler:{pending:n.pendingCount,deferred:n.replayCount,visibilityGateThreshold:n.gateThreshold,visibilityGateActive:n.gateActive,lastFlush:null===l?void 0:{applied:l.applied,appliedFields:l.appliedFields,deferred:l.deferred,durationMs:l.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;for(let e of t.cache.values())i.set(e.element,e),t.observers.unobserveElement(e.element);if(this.buildCacheAndObserve(),e.isRunning()){for(let e of t.cache.values())i.get(e.element)?.fieldName===e.fieldName?t.scheduler.retarget(e):t.scheduler.forget(e.element),i.delete(e.element);for(let e of i.values())t.scheduler.forget(e.element)}}onHeartbeatTimeout(){let{state:e,deps:t}=this;if(!e.isRunning())return;t.bus.advanceGeneration();let i=e.activeUpdate;e.activeUpdate=null,null!==i&&t.scheduler.cancelRevision(i.revision),t.merger?.destroy(),e.merges.destroy();let n=t.connection.markDisconnected();try{t.onHeartbeatTimeout?.()}catch(e){t.log("heartbeat:",e)}e.isRunning()&&(n&&this.isIdleDisconnected()&&(t.a11y?.announceDisconnected(),t.emitter.emitWhile("disconnect",{reason:"timeout",timestamp:Date.now()},()=>this.isIdleDisconnected()),!e.isRunning()||(this.isIdleDisconnected()&&t.log("connection","connected","\\u2192","disconnected"),!e.isRunning()))||this.sendReadyAfterStart())}sendReadyAfterStart(){try{this.deps.sendReady(this.deps.readyTargets())}catch(e){this.reportError(e,"ready","LP0606")}}reportError(e,t,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}},Nn=/^https?:\\/\\/(localhost|127\\.0\\.0\\.1)(?::\\d+)?$/i,Mn=/^https?:\\/\\/[^/?#\\s]+$/i,xn=[3e3,3001,3333,4e3,4321,5e3,5173,5174,8e3,8080,8888,9e3],On=class{constructor(e={}){Ct(this,En);let t=new Set;for(let i of e.additionalOrigins??[]){let e=Ue(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}());$t(this,En,[t,i,n,void 0!==i,void 0])}matches(e){return 0!==e.length&&"null"!==e&&(void 0!==kt(this,En)[4]?e===kt(this,En)[4]:!!(kt(this,En)[0].has(e)||0===kt(this,En)[0].size&&void 0!==kt(this,En)[1]&&e===kt(this,En)[1]||kt(this,En)[2]&&Nn.test(e)))}lockOrigin(e){return!!this.matches(e)&&(kt(this,En)[4]=e,!0)}unlockOrigin(){let e=kt(this,En)[4];return kt(this,En)[4]=void 0,e}get lockedOrigin(){return kt(this,En)[4]}enumerate(){if(void 0!==kt(this,En)[4])return[kt(this,En)[4]];let e=new Set(kt(this,En)[0]);if(0===kt(this,En)[0].size&&void 0!==kt(this,En)[1]&&e.add(kt(this,En)[1]),kt(this,En)[2])for(let t of xn)e.add(`http://localhost:${String(t)}`),e.add(`http://127.0.0.1:${String(t)}`);return[...e]}get referrerWasAvailable(){return kt(this,En)[3]}get isProductionUnconfigured(){return!(!Ee()||kt(this,En)[0].size>0||kt(this,En)[2]||void 0!==kt(this,En)[1])}get isReferrerOnlyTrust(){return!(kt(this,En)[0].size>0||kt(this,En)[2])&&void 0!==kt(this,En)[1]}},En=new WeakMap,Un={1:"left",2:"center",3:"right",4:"justify"},Pn=new Set(["left","center","right","justify","start","end"]),Ln=new Set(["h1","h2","h3","h4","h5","h6"]),In=\' target="_blank" rel="noopener noreferrer"\',_n=(e,t)=>{let i=t.renderChildren(e.children??[]),n=je(e.fields),r=function(e,t){if("internal"===t?.linkType)return function(e){let t=je(je(e)?.value),i=t?.url;if("string"==typeof i&&i.length>0)return i;let n=t?.slug;return"string"==typeof n&&n.length>0?`/${n}`:void 0}(t.doc);let i=t?.url??e.url;return"string"==typeof i&&i.length>0?i:void 0}(e,n);if(void 0===r||!T(r))return i;let o="string"==typeof e.title?` title="${Ce(e.title)}"`:"";return`<a href="${$e(r)}"${function(e,t,i){if(!0===t?.newTab||k(i))return In;let n="string"==typeof e.target?e.target:"";return""===n?"":"_blank"===n?In:` target="${Ce(n)}"`}(e,n,r)}${o}>${i}</a>`},jn=new Map,Bn=".lp-block:empty,.lp-inline-block:empty",Wn={text:e=>{let t=Ce("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${Ie(e)}${_e(e)}>${i}</p>`},heading:(e,t)=>{let i="string"==typeof e.tag?e.tag.toLowerCase():"h2",n=Ln.has(i)?i:"h2",r=t.renderChildren(e.children??[]);return`<${n}${Ie(e)}${_e(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)}"`:"",o="check"===i?\' role="list"\':"",l=t.renderChildren(e.children??[]);return`<${n}${Ie(e)}${_e(e)}${r}${o}>${l}</${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"}"${_e(e)}>${i}</li>`;let n="number"==typeof e.value?` value="${Ce(String(e.value))}"`:"";return`<li${Ie(e)}${_e(e)}${n}>${i}</li>`},link:_n,autolink:_n,quote:(e,t)=>{let i=t.renderChildren(e.children??[]);return`<blockquote${Ie(e)}${_e(e)}>${i}</blockquote>`},code:e=>{let t=We("string"==typeof e.language?e.language:"");return`<pre><code${""===t?"":` class="language-${t}"`}>${Ce(De(e))}</code></pre>`},"code-highlight":e=>{let t="string"==typeof e.text?e.text:"";return`<span${"string"==typeof e.highlightType?` class="token-${We(e.highlightType)}"`:""}>${Ce(t)}</span>`},linebreak:()=>"<br>",horizontalrule:()=>"<hr>",tab:()=>"\\t",upload:e=>{let t=Be(e.value);if(void 0===t)return"";let i=t.url;if("string"!=typeof i||!T(i))return"";let n="string"==typeof t.mimeType?t.mimeType:"";return n.startsWith("video/")?function(e,t){return`<video controls${He(e)}><source src="${$e(t)}"${qe(e)}></video>`}(t,i):n.startsWith("audio/")?function(e,t){return`<audio controls><source src="${$e(t)}"${qe(e)}></audio>`}(t,i):""===n||n.startsWith("image/")?function(e,t){let i="string"==typeof e.alt?Ce(e.alt):"";return`<img src="${$e(t)}" alt="${i}"${He(e)} loading="lazy" decoding="async">`}(t,i):function(e,t){let i="string"==typeof e.filename?Ce(e.filename):Ce(t);return`<a href="${$e(t)}" target="_blank" rel="noopener noreferrer">${i}</a>`}(t,i)},relationship:e=>{let t="string"==typeof e.relationTo?e.relationTo:"",i=je(e.value),n=Ce((i&&ze(i))??`#${t}`),r=We(t),o=""===r?\' class="lp-relation"\':` class="lp-relation lp-relation--${r}"`,l=i?.url;return"string"==typeof l&&T(l)?`<a href="${$e(l)}"${o}>${n}</a>`:`<span${o}>${n}</span>`},block:(e,t)=>Je(e,t,"div","lp-block"),inlineBlock:(e,t)=>Je(e,t,"span","lp-inline-block"),table:(e,t)=>`<table${Ie(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"\':""}${Ke("colspan",e.colSpan)}${Ke("rowspan",e.rowSpan)}>${t.renderChildren(e.children??[])}</${n}>`}},Vn=new Map,zn=!1,Dn="data-payload-text",Hn=new Set,qn=new Set,Gn=new Set(["DIV","SECTION","ARTICLE"]),Jn={name:"richText",render:C((e,t,i)=>{let n=e.element;if(Fe(t)){n.textContent="";return}let r=i.sanitizerPolicy;if(void 0!==i.renderRichText){let o=i.renderRichText(t,{fieldName:e.fieldName,element:n,locale:i.locale});n.innerHTML=ve(be(o,r));return}if(Qe(t)){let o=new Map,l=et(n,be(function(e,t={}){if(!Qe(e))return"";let i=function(e){let t={renderChildren:e=>{let i="";for(let n of e)i+=Xe(n,t);return i},resolveAlignment:Pe,resolveIndent:Le,onUnrenderedBlock:e};return t}(t.onUnrenderedBlock).renderChildren(e.root.children);return!1===t.sanitize?i:void 0!==we()?function(e){return be(e,void 0,void 0)}(i):(function(){if(!zn){zn=!0;try{console.warn(\'[live-preview] lexicalToHtml() has no sanitizer document and returned unsanitised HTML; call setSanitizerDocument() (linkedom/jsdom) for server rendering, see "HTML sanitization" in docs/security.md.\')}catch{}}}(),i)}(t,{sanitize:!1,onUnrenderedBlock:(e,t)=>{o.set(t,e)}}),r));for(let[t,n]of l){let r=o.get(t);void 0!==r&&it(e,i,r,n)}return}if("string"!=typeof t)return!1;n.innerHTML=ve(be(t,r))})},Kn={name:"html",render(e,t,i){if(Fe(t)){e.element.textContent="";return}let n="string"==typeof t?t:Re(t);e.element.innerHTML=ve(be(n,i.sanitizerPolicy))}},Qn=new WeakSet,Xn=rt("url"),Zn=/^[a-zA-Z][a-zA-Z0-9+.-]*:/,Yn=rt("email",function(e){let t=e.trim();return Zn.test(t)||!t.includes("@")?t:`mailto:${t}`}),er=["src","srcset","sizes"],tr={name:"image",render:C((e,t,i)=>{let n=e.element;if(Fe(t)){at(n);return}let r=void 0!==e.locale,{media:o,candidate:l}=function(e,t,i,n){let r=void 0!==e.srcField&&e.srcField.length>0?de(i.allFields,e.srcField,i.locale,n):t,o=Be(r);return{media:o,candidate:void 0===o?r:o.url}}(e,t,i,r),s=nt(n,e.fieldName,l);if("none"===s.kind)return!1;if("unsafe"!==s.kind){if("IMG"===n.tagName){let t=n;lt(t,s.url,o);let l=function(e,t,i,n,r){if(void 0!==t&&t.length>0){let e=de(i,t,n,r);return"string"==typeof e?e:void 0}return e?.alt}(o,e.altField,i.allFields,i.locale,r);void 0!==l&&(t.alt=l);return}n.style.backgroundImage=`url(\'${function(e){return e.replace(/[\'"()\\\\]/g,"\\\\$&")}(s.url)}\')`}else at(n)})},ir={name:"upload",render:C((e,t)=>{let i=e.element;if(Fe(t)){ut(i);return}let n=Be(t);if(void 0===n)return!1;let r=nt(i,e.fieldName,n.url);if("none"===r.kind)return!1;if("unsafe"===r.kind){ut(i);return}let o=r.url;if("IMG"===i.tagName){let e=i;lt(e,o,n),void 0!==n.alt&&(e.alt=n.alt);return}if("A"===i.tagName){i.setAttribute("href",o),i.textContent=n.filename??o;return}let l=Ce(n.filename??o);i.innerHTML=ve(`<a href="${$e(o)}">${l}</a>`)})},nr={name:"relationship",render(e,t){let i=e.element;if(Fe(t))i.removeAttribute("href"),i.textContent="";else{if("A"===i.tagName&&!Array.isArray(t)){let n=nt(i,e.fieldName,je(t)?.url);"safe"===n.kind?i.setAttribute("href",n.url):"unsafe"===n.kind&&i.removeAttribute("href")}i.textContent=Array.isArray(t)?t.map(dt).join(", "):dt(t)}}},rr={name:"select",render(e,t,i){let n=e.element,r=Fe(t)?[]:function(e){return Array.isArray(e)?e.map(Re):[Re(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=je(t);if(void 0!==i&&Re(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)}},or=new Set(["","false","0","off","no"]),lr={name:"checkbox",render(e,t){let i=e.element,n=function(e){return"boolean"==typeof e?e:"string"==typeof e?!or.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}},sr=new Map,ar=new Map,ur=new Set(["short","medium","long","full"]),dr=new Set(["short","medium","long","full"]),cr=/^[A-Za-z]{3}$/u,hr=/^[0-4]$/u,fr=new WeakSet,pr={name:"date",render(e,t,i){let n=e.element;if(Fe(t)){"INPUT"===n.tagName?n.value="":(n.removeAttribute("datetime"),n.textContent="");return}let r="number"==typeof t?t:Re(t),o=new Date(r),l=!Number.isNaN(o.getTime()),s=String(r);"INPUT"!==n.tagName?("TIME"===n.tagName&&n.setAttribute("datetime",l?o.toISOString():s),n.textContent=l?function(e,t,i){let n=t.locale??i.locale??a(),r=mt("date",t.format,t.element,t.fieldName)??mr;try{return function(e,t){let i=ct(e,t);return Ae(ar,i)??Ne(ar,i,new Intl.DateTimeFormat(e,t),64)}(n,r).format(e)}catch{return e.toISOString()}}(o,e,i):s):n.value=l?function(e,t){let i=`${String(t.getFullYear()).padStart(4,"0")}-${gt(t.getMonth()+1)}-${gt(t.getDate())}`,n=`${gt(t.getHours())}:${gt(t.getMinutes())}`;return"date"===e?i:"datetime-local"===e?`${i}T${n}`:"time"===e?n:t.toISOString()}(n.type,o):s}},mr={dateStyle:"medium",timeStyle:"short"},gr={name:"number",render(e,t,i){let n=e.element;if(Fe(t)){"INPUT"===n.tagName?n.value="":n.textContent="";return}let r="number"==typeof t?t:Number(Re(t));Number.isNaN(r)?n.textContent=Re(t):"INPUT"!==n.tagName?n.textContent=function(e,t,i){let n=t.locale??i.locale??a(),r=mt("number",t.format,t.element,t.fieldName);try{return function(e,t){let i=ct(e,t);return Ae(sr,i)??Ne(sr,i,new Intl.NumberFormat(e,t),64)}(n,r).format(e)}catch{return String(e)}}(r,e,i):n.value=String(r)}},vr=new Map;!function(){if(typ','eof window>"u"||!Ee()&&(typ','eof window>"u"||null==window.opener))return;let e=window.__livePreview,t=JSON.stringify(yt());if(void 0!==e&&(void 0===e.configSignature||e.configSignature===t))return e.refresh(),e;let[i=[],r="",o="/api",l=1,s=!1,a=50,u=!0,d=0,c=!1,h=50,f="200px",p=!0,m=!1,g=!1,v=!0,y="parent-or-opener",b="strict",w,S=!1,T=!1,k,C,$="off",R]=yt(),F=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),A=new On({additionalOrigins:i,enableReferrerDetection:!p,enableLocalhostMatching:!m});A.isProductionUnconfigured?At("[live-preview] LP0101: No trusted origin. Pass allowedOrigins to generateInlineScript() (or to the adapter) \\u2014 the runtime reads no environment variable in the browser."):A.isReferrerOnlyTrust&&At("[live-preview] LP0102: document.referrer fallback trusts any framing site. Set allowedOrigins and a frame-ancestors CSP in production.");let N=new Mt,M=function(){let e=[Jn,Kn,Xn,Yn,tr,ir,nr,rr,{...rr,name:"radio"},lr,pr,gr,vt("array","structural arrays"),vt("blocks","structural arrays")];return function(e=[]){let t={};for(let i of e)t[i.name]=i;for(let[e,i]of vr)t[e]=i;return Object.freeze(t)}([Ye("text"),Ye("textarea"),...e])}(),x=new An({renderers:M,originMatcher:e=>A.matches(e),lockedOrigin:()=>A.lockedOrigin,readyTargets:()=>A.enumerate(),emitter:N,eventSourcePolicy:y,...""!==r?{dataMerge:{serverURL:r,apiRoute:o,depth:l}}:{},debounceMs:a,heartbeatMs:d,intersectionRootMargin:f,disableVisibilityGate:c,visibilityGateThreshold:h,enableA11y:u,scopeBindingsByOwner:g,skipUnchanged:v,revealEditedField:S,onUnfaithfulPatch:n({onUnfaithfulPatch:C,onUnboundChange:k}),autoBind:$,...void 0!==R?{hydration:R}:{},sanitizerPolicy:b,...void 0!==F?{strategies:F}:{},onHeartbeatTimeout:()=>{A.unlockOrigin()},...s?{log:(...e)=>{Nt("[live-preview]",...e)}}:{}});N.on("connect",e=>{A.lockOrigin(e.origin)}),x.start(),e?.destroy();let O=function(e,t={}){let i=t.windowTarget??globalThis.window,n=t.documentTarget??globalThis.document,r=t.softNavigationEvents??[],o=()=>{e.suspend()},l=t=>{!0===t.persisted&&e.resume()},s=()=>{e.refreshCache()};i?.addEventListener("pagehide",o),i?.addEventListener("pageshow",l);for(let e of r)n?.addEventListener(e,s);let a=!1;return()=>{if(!a){a=!0,i?.removeEventListener("pagehide",o),i?.removeEventListener("pageshow",l);for(let e of r)n?.removeEventListener(e,s)}}}({suspend:()=>x.suspend(),resume:()=>x.start(),refreshCache:()=>{x.refreshCache()}}),E=Object.freeze({version:Vi,configSignature:t,destroy:()=>{O(),x.destroy();let e=window;e.__livePreview===E&&delete e.__livePreview},refresh:()=>{x.refreshCache()},enumerateOrigins:()=>A.enumerate(),inspect:()=>x.inspect()});try{Object.defineProperty(window,"__livePreview",{value:E,writable:!1,configurable:!0})}catch(e){throw O(),x.destroy(),e}}()})();'].join(""),t=Object.freeze({profile:"lean",source:e,contentHash:"6aef2e866910ccc9",integrity:"sha384-qDOhyn8FYSVVpW2EN/2WnsGBwJdFAmtlwLXPz0/rdeNz9GiMv/b9W9oXhwa0e2HH"});exports.LEAN_RUNTIME=t;
|
|
2
2
|
//# sourceMappingURL=lean.cjs.map
|