payload-live-preview 2.3.1 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var e="2.3.1";function t(e){if("v1"!==e.defaults&&""!==(e.serverURL??"")&&null==e.mergeDepth)throw new Error("payload-live-preview: `serverURL` needs an explicit `mergeDepth` under the 2.0 defaults — choose the population depth deliberately (0 for none), or pass `defaults: 'v1'` to keep the 1.x default of 1 while migrating (ADR 0007, entry 10).")}function detectInitialLocale(){return function(){if("undefined"==typeof document)return;const e=document.documentElement.getAttribute("lang");return null===e||0===e.length?void 0:e}()??function(){if("undefined"==typeof navigator)return;const e=navigator.language;return"string"==typeof e&&e.length>0?e:void 0}()??"en"}var n="payload-live-preview-a11y",r=/* @__PURE__ */new WeakMap;function i(e){null!==e.timer&&(clearTimeout(e.timer),e.timer=null),e.messageNode?.remove(),e.messageNode=null}var o=class{german;document;lease=null;constructor(e,t){const n=t??("undefined"==typeof document?null:document),r=n?.documentElement.getAttribute("lang")??"";this.german=function(e){return/^de(?:[-_]|$)/i.test(e)}(e??(r.length>0?r:detectInitialLocale())),this.document=n}mount(){const e=this.document;if(null==e?.body)return null;this.lease??=function(e){let t=r.get(e);return void 0===t&&(t={element:null,owned:!1,messageNode:null,refs:0,timer:null},r.set(e,t)),t.refs+=1,t}(e);const t=this.lease,o=t.element;if(o?.isConnected&&o.ownerDocument===e)return o;if(null!==o){const e=t.owned;i(t),e&&o.remove()}let s=e.getElementById(n);return t.owned=null===s,null===s&&(s=e.createElement("div"),s.id=n,s.setAttribute("role","status"),s.setAttribute("aria-live","polite"),s.setAttribute("aria-atomic","true"),s.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0",e.body.appendChild(s)),t.element=s,s}announceConnected(){this.say(this.german?"Vorschau verbunden":"Live preview connected")}announceDisconnected(){this.say(this.german?"Vorschau getrennt":"Live preview disconnected")}announceUpdate(e){e<=0||this.say(this.german?`${String(e)} ${1===e?"Änderung":"Änderungen"} angewendet`:`${String(e)} ${1===e?"change":"changes"} applied`)}announcePartial(){this.say(this.german?"Vorschau teilweise aktualisiert":"Preview partly updated")}detach(){const e=this.lease,t=this.document;if(null===e||null===t)return;if(this.lease=null,e.refs-=1,e.refs>0)return;const n=e.element;null!==n&&i(e),e.owned&&n?.remove(),e.element=null,r.delete(t)}say(e){const t=this.mount(),n=this.lease;if(null===t||null===n)return;let r=n.messageNode;r?.parentNode!==t?(r?.remove(),r=t.ownerDocument.createTextNode(t.hasChildNodes()?` ${e}`:e),n.messageNode=r,t.appendChild(r)):r.data=null===r.previousSibling?e:` ${e}`,null!==n.timer&&clearTimeout(n.timer);const o=setTimeout(()=>{n.timer===o&&n.element===t&&i(n)},1500);n.timer=o}};function s(e){if(++e.nodes>1e4)throw new Error("invalid or oversized field schema")}function a(e,t,n){if(s(t),n>64||t.active.has(e))throw new Error("invalid or oversized field schema");t.active.add(e)}function l(e){try{return u(e,{nodes:0,active:/* @__PURE__ */new WeakSet},0)}catch{return[]}}function u(e,t,n){if(!Array.isArray(e))return[];a(e,t,n);const r=[];for(const i of e){const e=d(i,t,n);e&&r.push(e)}return t.active.delete(e),r}function d(e,t,n){if(s(t),"object"!=typeof e||null===e)return;const r=e,i=r.name,o=r.type;if("string"!=typeof i||0===i.length)return;if("string"!=typeof o||0===o.length)return;const l=u(r.fields,t,n+1),d=function(e,t,n){if("object"==typeof e&&null!==e&&!Array.isArray(e)){a(e,t,n);const r=[];for(const i in e){if(!Object.hasOwn(e,i))continue;s(t);const o=Reflect.get(e,i);"object"!=typeof o||null===o||["__proto__","constructor","prototype"].includes(i)||r.push({...o,slug:i,fields:u(o.fields,t,n+1)})}return t.active.delete(e),r}if(!Array.isArray(e))return[];a(e,t,n);const r=[];for(const i of e){if(s(t),"object"!=typeof i||null===i)continue;const e=i,o=e.slug;if("string"!=typeof o||0===o.length)continue;const a=u(e.fields,t,n+1);r.push({...e,slug:o,fields:a})}return t.active.delete(e),r}(r.blocks,t,n+1),c={...r,name:i,type:o},f=r.relationTo;if(Array.isArray(f)){const e=[];for(const n of f)s(t),e.push(n);c.relationTo=e}return l.length>0?c.fields=l:delete c.fields,d.length>0?c.blocks=d:delete c.blocks,c}function c(e,t){return void 0===e||t(e)}function f(e,t){return null==e||t(e)}function h(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}var p=["data","fieldSchemaJSON","globalSlug","collectionSlug","locale","ready","previewToken","protocolVersion"],g={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"}},m=Object.keys(g);function negotiateProtocol(e,t=[]){const n="number"==typeof e&&Number.isFinite(e)&&e>=1?Math.floor(e):void 0,r=n??1,i=Math.min(4,r),o=new Set(t),s=/* @__PURE__ */new Set;for(const e of m)(i>=g[e].since||o.has(e))&&s.add(e);return{ours:4,...void 0!==n?{theirs:n}:{theirs:void 0},negotiated:i,capabilities:s,observed:o}}function v(e){return("object"==typeof e&&null!==e||"function"==typeof e)&&"function"==typeof e.then&&(Promise.resolve(e).catch(()=>{}),!0)}function y(e,t){return e.generation===t.generation&&e.revision===t.revision}var b=class{matcher;handlers;boundListener=void 0;attachedTarget=void 0;generation=0;revision=0;queueHead=void 0;queueTail=void 0;lastAccepted=void 0;replayedGeneration=0;latestAcceptedAttempt=void 0;constructor(e,t){this.matcher=e,this.handlers=t}attach(e=window){if(void 0!==this.attachedTarget)return;let t=!1;const n=r=>{if(!t||this.boundListener!==n)return;const i=this.generation;try{this.receive(r,i,e)}catch{let e;try{e=r.origin}catch{e=""}this.reportInvalid("shape",e,i)}};this.generation+=1,this.resetQueue(),this.attachedTarget=e,this.boundListener=n;try{e.addEventListener("message",n)}catch(t){this.boundListener===n&&(this.attachedTarget=void 0,this.boundListener=void 0,this.resetQueue());try{e.removeEventListener("message",n)}catch{}throw t}if(this.boundListener===n)t=!0;else try{e.removeEventListener("message",n)}catch{}}detach(){const e=this.attachedTarget,t=this.boundListener;void 0!==e&&void 0!==t&&(this.attachedTarget=void 0,this.boundListener=void 0,this.resetQueue(),e.removeEventListener("message",t))}advanceGeneration(){return void 0!==this.attachedTarget&&(this.generation+=1,this.resetQueue(),!0)}replayLastAccepted(){const e=this.lastAccepted,t=this.generation,n=this.handlers.onReplay;if(void 0===n||void 0===e||e.generation>=t||this.replayedGeneration===t)return!1;if(!this.matchesOrigin(e.origin,t)||this.lastAccepted!==e)return!1;this.replayedGeneration=t;const r={generation:t,revision:this.revision+=1};return this.invokeHandler(t,n,structuredClone(e.message),e.origin,r),!0}forgetLastAccepted(){this.lastAccepted=void 0,this.replayedGeneration=0,this.latestAcceptedAttempt=void 0}static sendReady(e,t){const n={type:"payload-live-preview",ready:!0,protocolVersion:4};for(const r of e)for(const e of t)try{r.postMessage(n,e)}catch{}}receive(e,t,n){const r=e.origin;if(!this.matchesOrigin(r,t))return void this.reportInvalid("origin",r,t);if(!this.matchesSource(e,n))return void this.reportInvalid("source",r,t);const i=e.data;var o;if("object"==typeof(o=i)&&null!==o&&"type"in o&&"string"==typeof o.type)switch(i.type){case"payload-live-preview":return function(e){const t=e;return!(void 0!==t.data&&null!==t.data&&!h(t.data))&&f(t.fieldSchemaJSON,e=>Array.isArray(e))&&f(t.globalSlug,e=>"string"==typeof e)&&f(t.collectionSlug,e=>"string"==typeof e)&&f(t.locale,e=>"string"==typeof e)&&f(t.ready,e=>"boolean"==typeof e)&&f(t.previewToken,e=>"string"==typeof e)&&f(t.protocolVersion,e=>"number"==typeof e)}(i)?void this.dispatchUpdate(function(e){const t={...e};for(const e of p)null===Reflect.get(t,e)&&Reflect.deleteProperty(t,e);return Array.isArray(t.fieldSchemaJSON)?{...t,fieldSchemaJSON:l(t.fieldSchemaJSON)}:t}(i),r,t):void this.reportInvalid("shape",r,t);case"payload-document-event":return function(e){const 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))}(i)?void this.invokeHandler(t,this.handlers.onDocumentEvent,i,r):void this.reportInvalid("shape",r,t);case"payload-live-preview-focus":{const e=function(e){const t=e.field;return"string"==typeof t&&t.length>0?t:void 0}(i);return void 0===e?void this.reportInvalid("shape",r,t):void this.invokeHandler(t,this.handlers.onFocusField,e,r)}default:this.reportInvalid("type",r,t)}else this.reportInvalid("shape",r,t)}dispatchUpdate(e,t,n){const r=h(e.data);if(!this.isCurrentGeneration(n))return;const i=r?{generation:n,revision:this.revision+=1}:void 0,o=this.handlers.validateToken;if(!this.isCurrentGeneration(n))return;if(void 0===o)return void this.commitUpdate(e,t,n,i);if(!0===e.ready&&void 0===e.data)return void this.commitUpdate(e,t,n,void 0);const s={generation:n,message:e,origin:t,messageRevision:i,verdict:void 0,next:void 0};let a;this.enqueue(s);try{a=o(e.previewToken,t)}catch{return void this.settleValidation(s,!1)}"boolean"!=typeof a?Promise.resolve(a).then(e=>{this.settleValidation(s,!0===e)},()=>{this.settleValidation(s,!1)}):this.settleValidation(s,a)}settleValidation(e,t){e.verdict=t,this.drainQueue(e.generation)}drainQueue(e){for(;this.isCurrentGeneration(e);){const 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,n,r){if(void 0===r)this.invokeHandler(n,this.handlers.onUpdate,e,t);else{const i={};this.latestAcceptedAttempt=i;const o=function(e){const t={...e};delete t.previewToken;try{return structuredClone(t)}catch{return null}}(e);if(this.latestAcceptedAttempt!==i||!this.isCurrentGeneration(n))return;this.lastAccepted=null===o?void 0:{generation:n,message:o,origin:t},this.invokeHandler(n,this.handlers.onUpdate,e,t,r)}}reportInvalid(e,t,n){this.invokeHandler(n,this.handlers.onInvalid,e,t)}matchesSource(e,t){if("parent-or-opener"!==this.handlers.sourcePolicy)return!0;try{const n=e.source;if("object"!=typeof n||null===n)return!1;const r=t.parent;return r!==t&&n===r||n===t.opener}catch{return!1}}matchesOrigin(e,t){try{return!0===(this.isCurrentGeneration(t)&&this.matcher(e))&&this.isCurrentGeneration(t)}catch{return!1}}invokeHandler(e,t,...n){if(void 0!==t&&this.isCurrentGeneration(e))try{v(t(...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}};function w(e){return(...t)=>{try{v(e(...t))}catch{}}}function S(){}var A=w((...e)=>console.error(...e)),k=w((...e)=>console.warn(...e)),T=w((...e)=>console.debug(...e)),C={"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'"},R=/* @__PURE__ */new Set;function $(e){R.has(e)||(R.add(e),k(`[live-preview] LP0104: this page carries the lean runtime, which leaves out ${e} (${C[e]}). The elements are left as the server rendered them. Remove \`runtime: LEAN_RUNTIME\` to get the full runtime.`))}function L(e){return"undefined"!=typeof __LEAN_BUILD__&&__LEAN_BUILD__?function(e){return!1!==e.enableA11y&&$("screen-reader announcements"),null}(e):function(e){if(!1===e.enableA11y)return null;const t=e.root,n=void 0===t?void 0:function(e){return 9===e.nodeType}(t)?t:t.ownerDocument;return new o(e.a11yLocale,n)}(e)}function N(e){if("undefined"==typeof window)return;const t=[];window.parent!==window&&t.push(window.parent),window.opener instanceof Window&&t.push(window.opener),b.sendReady(t,e)}function P(e){const t={};for(const[n,r]of Object.entries(e))void 0!==r&&(t[n]=r);return t}var x=/* @__PURE__ */new Set(["tabs","row","collapsible"]);function E(e,t,n,r){for(const i of e){if(x.has(i.type)){const e=i.fields;e&&E(e,r&&"tabs"===i.type?""===t?i.name:`${t}.${i.name}`:t,n,r);continue}const e=""===t?i.name:`${t}.${i.name}`;if(n.set(e,i),"group"===i.type)i.fields&&E(i.fields,e,n,r);else if("array"===i.type&&i.fields)E(i.fields,`${e}.*`,n,r);else if("blocks"===i.type&&i.blocks)for(const t of i.blocks)E(t.fields,`${e}.*.${t.slug}`,n,r)}}function M(e,t){if(e.has(t))return e.get(t);const n=t.replace(/\.\d+(?=\.|$)/g,".*");return e.has(n)?e.get(n):void 0}function O(e){if("object"!=typeof e||null===e)return;const t=e.id;return"string"==typeof t||"number"==typeof t?t:void 0}function F(e){if("object"!=typeof e||null===e)return;const t=e.blockType;return"string"==typeof t?t:void 0}function U(e,t){return t.every(e=>void 0!==O(e))?function(e,t){const n=[],r=/* @__PURE__ */new Map;for(let t=0;t<e.length;t+=1){const n=O(e[t]);void 0!==n&&r.set(n,t)}const i=/* @__PURE__ */new Set;for(let o=0;o<t.length;o+=1){const s=t[o],a=O(s);if(void 0===a){n.push({kind:"insert",index:o,value:s});continue}const l=r.get(a);if(void 0===l){n.push({kind:"insert",index:o,value:s});continue}i.add(l);const u=e[l];F(u)===F(s)?(l!==o&&n.push({kind:"move",from:l,to:o,value:s}),I(u,s)||n.push({kind:"update",index:o,value:s})):n.push({kind:"replace",index:o,oldValue:u,value:s})}for(let t=0;t<e.length;t+=1)i.has(t)||n.push({kind:"remove",index:t,value:e[t]});return n}(e,t):function(e,t){const n=[],r=Math.min(e.length,t.length);for(let i=0;i<r;i+=1)I(e[i],t[i])||n.push({kind:"update",index:i,value:t[i]});if(t.length>e.length)for(let r=e.length;r<t.length;r+=1)n.push({kind:"insert",index:r,value:t[r]});if(e.length>t.length)for(let r=t.length;r<e.length;r+=1)n.push({kind:"remove",index:r,value:e[r]});return n}(e,t)}function I(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;const n=e,r=t,i=Object.keys(n),o=Object.keys(r);if(i.length!==o.length)return!1;for(const e of i)if(!Object.is(n[e],r[e]))return!1;return!0}var _={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"},D=/* @__PURE__ */new Set(["http:","https:","mailto:","tel:"]),j=/^(?:\.{1,2}\/|[a-zA-Z0-9_-]+\/?)/,B=/^[\\/]{2}/,z=/[\t\n\r]/g,W=/[\s\u0000-\u001f\u180e\u2000-\u2029]/g,H=/^([a-z][a-z0-9+.-]*):/i;function isSafeUrl(e){if("string"!=typeof e)return!1;const t=e.trim().replace(z,"");if(0===t.length)return!1;if(t.startsWith("#")||t.startsWith("?"))return!0;if(B.test(t))return!0;if(t.startsWith("/"))return!0;try{const e=new URL(t);return D.has(e.protocol)}catch{return j.test(t)&&!function(e){const t=H.exec(e.replace(W,""))?.[1];return void 0!==t&&!D.has(`${t.toLowerCase()}:`)}(t)}}function isExternalHttpUrl(e){const t=e.trim().replace(z,"");return/^https?:\/\//i.test(t)||B.test(t)}var q=/* @__PURE__ */new Set(["style","srcdoc","formaction","form","id","name","is","srcset","imagesrcset"]),V=/* @__PURE__ */new Set(["href","src","poster","cite","action","xlink:href","data"]);function G(e){return!e.startsWith("on")&&!q.has(e)}function J(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 K(e){return e.onUnfaithfulPatch??("ignore"===e.onUnboundChange?"ignore":"escalate")}function X(e,t,n,r,i){const o=e.onUnfaithfulPatch,s=t.reportedUnfaithful.get(n.element),a=J(i),l=Date.now(),u=void 0!==s&&("escalate"!==o||void 0===a||a===s.identity||l-s.at<1e3);if((u||"escalate"!==o)&&t.display.shortfall(t.activeUpdate,{kind:"unfaithful",field:n.fieldName}),!u){if(t.reportedUnfaithful.set(n.element,{identity:a,at:l}),void 0===s){if(t.unfaithfulCount+=1,t.unfaithfulFields.add(n.fieldName),"ignore"===o)return;if("warn"===o)return void e.warn(`[live-preview] LP0411: "${n.fieldName}" ${r}`)}e.log("LP0411",n.fieldName,r),t.unfaithfulPatches.push(n)}}function Q(e,t){return!e.unfaithfulFields.has(t)&&(e.unfaithfulFields.add(t),e.unfaithfulCount+=1,!0)}var Z=/* @__PURE__ */new Set(["date","number","checkbox","select","radio"]);function Y(e){return"select"===e||"radio"===e}function ee(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value:e.textContent}function te(e){const t=e.trim();return JSON.stringify(t.length>40?`${t.slice(0,40)}…`:t)}var ne=/* @__PURE__ */new WeakSet;function re(e){return ne.add(e),e}var ie=class{previous=null;lastFields;priorFields;keepValues=!1;get previousFields(){return this.priorFields}get isBaseline(){return null===this.previous}diff(e,t,n=oe){const r=this.previous,i=null===r,o=/* @__PURE__ */new Map,s=/* @__PURE__ */new Set,a=Object.entries(e);if(!n())return null;for(const[e,t]of a){const i=J(t);if(!n())return null;o.set(e,i),null!==r&&void 0!==i&&r.get(e)===i||s.add(e)}if(null!==r)for(const e of r.keys())o.has(e)||s.add(e);const l=/* @__PURE__ */new Set,u=Object.entries(t);if(!n())return null;for(const[e,t]of u)if(s.has(e))for(const e of t)if(l.add(e),!n())return null;return n()?(this.previous=o,this.priorFields=this.keepValues?this.lastFields:void 0,this.lastFields=this.keepValues?e:void 0,{changed:s,invalidated:l,baseline:i}):null}reset(){this.previous=null,this.lastFields=void 0,this.priorFields=void 0}};function oe(){return!0}var se=/* @__PURE__ */new Set(["__proto__","prototype","constructor"]);function ae(e,t,n,r=!1){if(r&&void 0!==n){const r=le(e,`${t}_${n}`);if(void 0!==r)return r}const i=le(e,t);if(void 0!==i)return i;if(t.includes(".")){let n=e,r=!0;for(const e of t.split(".")){if(se.has(e)||null===n||"object"!=typeof n){r=!1;break}if(n=le(n,e),void 0===n){r=!1;break}}if(r)return n}return void 0===n?void 0:le(e,`${t}_${n}`)}function le(e,t){if(!se.has(t)&&Object.prototype.hasOwnProperty.call(e,t))return e[t]}function ue(e,t,n,r){return ae(e,n,t.locale??r,void 0!==t.locale)}function de(e,t,n,r){const i=J(t);if(void 0===i)return;const o=[e.hrefField,e.srcField,e.altField];let s=JSON.stringify([e.format,e.locale??r])+i;for(const t of o){if(void 0===t||0===t.length)continue;const i=J(ue(n,e,t,r));if(void 0===i)return;s+=`|${t}=${i}`}return s}var ce="data-payload-fragment",fe="data-payload-fragment-key";function he(e){return e.closest(`[${ce}]`)}function pe(e,t,n){const r=new Set(t);return{boundaries:t,strategy:e,ownerKeys:n,covers:e=>void 0!==e.fragmentBoundary&&r.has(e.fragmentBoundary)}}function ge(e){const t=e.getAttribute("data-payload-strategy");return null!==t&&t.length>0?"patch"===t||"fragment"===t||"route"===t?t:void 0:null!==he(e)?"fragment":null!==e.closest("head")?"route":"patch"}function me(e,t){return void 0===t||""===t?`collection:${e}`:`collection:${e}:${t}`}function ve(e){return"string"==typeof e&&e.length>0}function ye(e,t){return null!==t&&void 0!==e&&t.includes(e)}function be(e){const t=e.id;return"string"==typeof t&&t.length>0?t:"number"==typeof t&&Number.isFinite(t)?String(t):void 0}function we(e){return"object"==typeof e&&null!==e}function Se(e){return Array.isArray(e)?"array":we(e)?"object":"scalar"}function Ae(e,t){return we(e)?e[t]:void 0}function ke(e,t){return("string"==typeof t||"number"==typeof t)&&we(e)&&!Array.isArray(e)&&e.id===t}function Te(e,t){if(!we(e)||!we(t))return ke(e,t)||ke(t,e)||J(e)===J(t);if(Array.isArray(e)!==Array.isArray(t))return!1;const n=Object.keys(t);return n.length===Object.keys(e).length&&n.every(n=>Object.hasOwn(e,n)&&Te(Ae(e,n),Ae(t,n)))}function Ce(e,t){const n=J(t),r=J(e);return void 0!==n&&n===r||!(!ke(e,t)&&!ke(t,e))||void 0!==n&&void 0!==r&&Te(e,t)}function Re(e,t,n){let r=t,i=n;for(const t of e.split("."))r=Ae(r,t),i=Ae(i,t);return!Ce(r,i)}function $e(e,t,n,r){const i=[];let o=0;const s=(e,t,n,a)=>{if(o+=1,r.covers(e)||Ce(t,n))return;if(!((void 0===t||Se(t)===Se(n))&&we(n)&&r.reachesBelow(e)&&a<8))return void i.push({path:e,value:n});const l=function(e,t){const n=new Set(Object.keys(t));if(we(e))for(const t of Object.keys(e))n.add(t);return[...n]}(t,n);0===l.length&&i.push({path:e,value:n});for(const r of l){if(o>=1024)return void i.push({path:e,value:n});s(`${e}.${r}`,Ae(t,r),Ae(n,r),a+1)}};return s(e,t,n,0),i}var Le=/* @__PURE__ */new Set(["id","_id","createdAt","updatedAt","createdBy","updatedBy","_status","globalType","collection","locale","localized"]);function Ne(e,t,n={}){const r=e=>!1===t||ye(e,t),i=[];for(const[t,n]of e.entries())n.some(e=>r(e.owner))&&i.push(t);const o=e.rendered.filter(e=>void 0!==n[e.strategy]);return function(e,t){const n=new Set(e),r=[...t],i=(e,t)=>{const n=`${t}.`;for(const t of e)if(t.startsWith(n))return!0;return!1};return{covers:e=>n.has(e)||r.some(t=>t===e||e.startsWith(`${t}.`)),reachesBelow:e=>i(n,e)||i(r,e)}}(i,[...e.covers,...o].filter(e=>r(e.owner)).flatMap(e=>e.paths))}function Pe(e,t){if(void 0===t||0===t.length)return e;const n=`_${t}`;return e.endsWith(n)?e.slice(0,-n.length):e}function xe(e,t,n,r=Ne(e,n)){let i;const o=r.covers,s=r.reachesBelow;return r=>{const a=Pe(r,t);return o(r)||a!==r&&o(a)?"whole":(i??=function(e,t){const n=/* @__PURE__ */new Set;for(const[r,i]of e.entries())for(const e of i)(!1===t||ye(e.owner,t))&&void 0!==e.locale&&n.add(`${r}_${e.locale}`);return n}(e,n),i.has(r)?"whole":s(r)||a!==r&&s(a)?"below":"none")}}function Ee(e,t,n,r,i){const o=Ne(e,r,i),s=xe(e,n,r,o),a=[];for(const[e,r]of Object.entries(t)){if(Le.has(e)||"below"!==s(e))continue;const t=Pe(e,n);a.push(...$e(t,void 0,r,o))}return a}function Me(e,t,n){return"declared"===e&&void 0!==t&&void 0!==n?{previous:t,next:n}:void 0}function Oe(e,t,n,r,i,o){const s=Ne(e,r,o),a=xe(e,n,r,s),l=[];for(const e of t){if(Le.has(e))continue;const t=a(e);if("none"===t&&l.push(e),"below"!==t||void 0===i)continue;const r=Pe(e,n),{previous:o,next:u}=i;for(const{path:t}of $e(r,o[e],u[e],s))l.push(t)}return l}var Fe=/* @__PURE__ */new Set(["text","textarea","email","number","checkbox","date","select","radio","point","code","json","ui","html"]),Ue=/* @__PURE__ */new Set(["root","paragraph","text","heading","quote","list","listitem","linebreak","tab","horizontalrule","code","code-highlight","table","tablerow","tablecell","link","autolink"]),Ie={},_e=class{rawChanges=new ie;resolved=null;resolvedLocale=null;trailing=null;openUntil=0;requestAttempt=0;decide(e,t){const n=t.rawData;if(!function(e){const{cache:t,emitter:n}=e;if(t.islands.length>0)return!0;if(n.listenerCount("beforeUpdate")>0||n.listenerCount("afterUpdate")>0)return!0;for(const e of t.values()){if(je(e)||e.fieldName.includes("."))return!0;if(We(e.hrefField)||We(e.srcField)||We(e.altField))return!0}return void 0!==e.strategies.fragment&&null!==e.root.querySelector(`[${ce}]`)}(e)&&!function(e,t,n){for(const r of e.values()){if("text"!==r.fieldType||!0===r.explicitFieldType)continue;const e=ue(t,r,r.fieldName,n);if(rt(e)&&Be(e.root))return!0}return!1}(e.cache,n,t.locale))return t.forceRender&&(this.resolvedLocale=null),{merge:!1,fields:n};const{changed:r}=this.rawChanges.diff(n,Ie),i=this.resolvedLocale!==t.locale,o=this.resolved;if(null===o)return this.resolved=n,{merge:!0,fields:n};const s={...o};t.forceRender&&(this.resolvedLocale=null);let a=t.forceRender||i;for(const i of r){const r=n[i];if(Le.has(i)){s[i]=r;continue}const l=De(i,o[i],r,e.cache,t.schemaIndex);"own"!==l&&(a=!0,this.resolvedLocale=null),"keep"!==l&&(s[i]=r)}return this.resolved=s,{merge:a,fields:s}}request(e,t,n){const r=++this.requestAttempt,i=Date.now();if(i>=this.openUntil)return this.openUntil=i+t,this.dropQueued(),this.requestAttempt!==r?{leading:!0,result:Promise.resolve({status:"superseded"})}:{leading:!0,result:e.merge(n)};const o=this.trailing,s=o?.pending??function(){let e;return{promise:new Promise(t=>{e=t}),settle:e}}(),a={request:n,pending:s,timer:null};if(this.trailing=a,this.openUntil=i+t,null!==o&&null!==o.timer&&clearTimeout(o.timer),this.trailing!==a)return{leading:!1,result:s.promise};const l=setTimeout(()=>{this.flush(e,a)},t);return this.trailing===a?a.timer=l:clearTimeout(l),{leading:!1,result:s.promise}}recordMerged(e,t){this.resolved=e,this.resolvedLocale=t}resetRawChanges(){this.rawChanges.reset()}destroy(){this.requestAttempt+=1,this.openUntil=0,this.dropQueued()}dropQueued(){const e=this.trailing;this.trailing=null,null!==e&&(null!==e.timer&&clearTimeout(e.timer),e.pending.settle({status:"superseded"}))}flush(e,t){this.trailing===t&&(this.trailing=null,t.timer=null,e.merge(t.request).then(t.pending.settle))}};function De(e,t,n,r,i){return ze(n)?!ze(t)||function(e,t,n){const r=void 0===n?void 0:M(n,e);return void 0!==r&&!Fe.has(r.type)||!0===t.get(e)?.some(je)||function(e,t){const n=`${t}.`;for(const[t,r]of e.entries())if(t.startsWith(n))return!0;return!1}(t,e)}(e,r,i)?"keep":null==t?"ask":"own":"ask"}function je(e){return!Fe.has(e.fieldType)}function Be(e){const t=[e],n=/* @__PURE__ */new Set;for(let e=t.pop();void 0!==e;e=t.pop()){if("object"!=typeof e||null===e||n.has(e))continue;n.add(e);const{type:r,fields:i,children:o}=e;if(!Ue.has(r))return!0;if("internal"===i?.linkType)return!0;if(Array.isArray(o))for(const e of o)t.push(e)}return!1}function ze(e){return null===e||"object"!=typeof e&&"function"!=typeof e}function We(e){return!0===e?.includes(".")}function isInIframe(){if("undefined"==typeof window)return!1;try{return window.self!==window.top}catch{return!0}}function isInPopup(){return"undefined"!=typeof window&&null!=window.opener}function isInPreviewContext(){return isInIframe()||isInPopup()}function isDevMode(){const e=function(){if("undefined"==typeof process)return;const e=process.env.NODE_ENV;return"string"==typeof e?e:void 0}();if(void 0!==e)return"production"!==e;if("undefined"!=typeof window){const e=window.location.hostname;return"localhost"===e||"127.0.0.1"===e}return!1}var He=class{negotiation=negotiateProtocol(void 0);observed=/* @__PURE__ */new Set;observe(e,t,n){const r=e.filter(e=>!this.observed.has(e));if(0!==r.length){for(const e of r)this.observed.add(e);this.negotiation=negotiateProtocol(this.negotiation.theirs,this.observed),t("protocol",`observed=${r.join(",")}`),"undefined"!=typeof __LEAN_BUILD__&&__LEAN_BUILD__||!r.includes("schema-json")||!isDevMode()||n("[payload-live-preview] This admin sends fieldSchemaJSON, which only Payload 2 does. Every 2.x release of this package supports Payload 2; 3.0 supports Payload 3 and 4.")}}applyVersion(e,t){const n=this.negotiation;if(n.theirs===e)return;const r=negotiateProtocol(e,this.observed);this.negotiation=r,r.negotiated!==n.negotiated&&t("protocol","ours=4",`theirs=${e}`,`negotiated=${r.negotiated}`)}};function qe(e,t){const n=t.globalSlug??t.collectionSlug;if("string"!=typeof n||e.entitySlug!==n)return!0;const r=be(e),i=be(t.data??{});return void 0!==r&&void 0!==i&&r!==i}function Ve(e){return null!==e&&e.forceRender&&!e.completed}var Ge=class{lastIdentity=void 0;inspect(e){const t=e.externallyUpdatedRelationship;if("object"!=typeof t||null===t)return null;const n=JSON.stringify([t.entitySlug,be(t),t.updatedAt]);return{identity:n,edit:n!==this.lastIdentity&&qe(t,e)?t:null}}commit(e){const t=e.identity!==this.lastIdentity;return this.lastIdentity=e.identity,t?e.edit:null}};function Je(e){try{return!0===e.matchMedia?.("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var Ke=class{#e;reveal(e,t,n){return e===this.#e?"skipped-same":(this.#e=e,function(e,t){for(let t;t=e.closest?.("details:not([open])");)t.setAttribute("open","");return function(e,t){const n=e.getBoundingClientRect(),r=n.bottom>0&&n.top<t.innerHeight,i=n.right>0&&n.left<t.innerWidth;return r&&i}(e,t)?"already-visible":(e.scrollIntoView({behavior:Je(t)?"auto":"smooth",block:"center"}),"revealed")}(t,n))}reset(){this.#e=void 0}};function Xe(e,t){const n=t.element.ownerDocument.defaultView;return null===n?"no-element":e.reveal(`${t.owner??""} ${t.fieldName}`,t.element,n)}var Qe=class{seen=/* @__PURE__ */new Map;note(e,t,n){const r=J(n);if(void 0===r)return;const i=`${t.owner??""}\0${t.locale??""}\0${t.fieldName}`,o=this.seen.get(i);void 0!==o?o!==r&&(e.revealIdentities.push([i,r]),e.revealTarget??=t):this.seen.set(i,r)}commit(e){for(const[t,n]of e.revealIdentities)this.seen.set(t,n);e.revealIdentities=[];const t=e.revealTarget;return e.revealTarget=void 0,t}},Ze=()=>{},Ye=class{host={outstanding:()=>!1,report:Ze,failed:Ze};entry=null;ended;begin(e,t){const n=this.entry,r=null===n?void 0:this.view(n);null!==n&&(n.key=void 0),this.ended=void 0,this.entry={key:e,revision:t,shortfalls:[],seen:/* @__PURE__ */new Set,deferred:0,awaiting:0,reported:void 0,queued:!1},null!==n&&void 0!==r&&this.publish(n,"pending"===r.state?{...r,state:"superseded"}:r)}end(){const e=this.entry;if(null!==e){this.entry=null;try{this.ended=this.view(e)}finally{e.key=void 0}}}snapshot(){return null!==this.entry?this.view(this.entry):void 0===this.ended?void 0:{...this.ended,shortfalls:[...this.ended.shortfalls]}}shortfall(e,t){const n=this.entry;if(n?.key!==e)return;const r=JSON.stringify(t);n.seen.has(r)||(n.seen.add(r),n.shortfalls.push(t),this.requestSettle(n.key))}deferred(e,t){this.entry?.key===e&&(this.entry.deferred=t)}handIsland(e){const t=this.entry;if(t?.key!==e)return Ze;t.awaiting+=1;let n=!1;return()=>{n||this.entry!==t||(n=!0,t.awaiting-=1,this.settle(t))}}requestSettle(e){const t=this.entry;t?.key!==e||t.queued||(t.queued=!0,queueMicrotask(()=>{t.queued=!1;try{this.entry===t&&this.settle(t)}catch(e){this.host.failed(e)}}))}settle(e){const t=this.view(e);"pending"!==t.state&&this.publish(e,t)}publish(e,t){e.reported!==t.state&&(e.reported=t.state,this.host.report(t))}view(e){const t=void 0!==e.key&&this.host.outstanding(e.key)?"pending":e.shortfalls.length>0?"partial":e.awaiting>0?"unconfirmed":"current";return{revision:e.revision,state:t,shortfalls:[...e.shortfalls],deferred:e.deferred,awaitingIslands:e.awaiting}}};function et(e){const t=e.getAttribute(fe);return{kind:"fragment",id:e.getAttribute(ce)??"",key:null===t||0===t.length?void 0:t,code:"LP0801"}}var tt=class{started=!1;suspended=!1;deferredStart=null;hydration="idle";activeUpdate=null;locale=void 0;schema=void 0;schemaIndex=void 0;updateCount=0;supersededCount=0;completedCount=0;skippedUnchangedCount=0;lastFlush=null;absentFields=/* @__PURE__ */new Set;warnedOrphanFields=/* @__PURE__ */new Set;warnedStrategy=/* @__PURE__ */new WeakSet;warnedUnattributableMessage=!1;warnedVisibilityGate=!1;warnedFragmentFallback=!1;warnedIslandStart=!1;warnedEscalationUnavailable=!1;warnedProtocolShape=!1;reportedUnfaithful=/* @__PURE__ */new WeakMap;checkedServerFormat=/* @__PURE__ */new WeakSet;rowsOfBinding=/* @__PURE__ */new WeakMap;unfaithfulPatches=[];unfaithfulCount=0;escalatedCount=0;unfaithfulFields=/* @__PURE__ */new Set;autoBindSearchMs=void 0;autoBindGuesses=null;warnedForeignSource=!1;lastAppliedIdentity=/* @__PURE__ */new WeakMap;navigationReplayPending=!1;navigationBindingReplay=!1;revealLedger=new Qe;display=new Ye;fragmentStats={rendered:0,failed:0,superseded:0};routeStats={refreshes:0,partial:0,failed:0,refused:0,loopStopped:0};fragmentControllers=/* @__PURE__ */new Map;routeController=null;routeRetry=null;routeRefreshOwed=!1;routeAwaitsSave=!1;fragmentsOwed=/* @__PURE__ */new Set;readyTimers=[];revealer=new Ke;changes=new ie;merges=new _e;protocol=new He;relationships=new Ge;isRunning(){return this.started}isCurrent(e){return this.started&&this.activeUpdate===e}complete(e){this.display.requestSettle(e),e.completed||(e.completed=!0,e.countsAsUpdate&&(this.completedCount+=1))}forgetOwedWork(){this.routeRefreshOwed=!1,this.routeAwaitsSave=!1,this.fragmentsOwed.clear()}supersedeStrategies(){null!==this.routeRetry&&(clearTimeout(this.routeRetry),this.routeRetry=null,this.routeRefreshOwed=!0);for(const[e,t]of this.fragmentControllers){for(const e of t)this.fragmentsOwed.add(e);e.abort()}this.fragmentControllers.clear()}abortStrategies(){this.supersedeStrategies();const e=this.routeController;this.routeController=null,e?.abort()}},nt=class{constructor(e,t){this.deps=e,this.state=t,this.instanceContext=P({renderRichText:e.renderRichText,internalLinkPattern:e.internalLinkPattern,sanitizerPolicy:e.sanitizerPolicy,serverURL:e.serverURL,reportUnfaithful:(n,r)=>{X(e,t,n,r,this.writing)}})}deps;state;writing;instanceContext;apply(e){const{deps:t,state:n}=this,r=n.activeUpdate;if(null===r||void 0===e.revision||!y(r.revision,e.revision)||!n.isCurrent(r))return!1;const{target:i,value:o}=e,s=void 0!==r.schemaIndex?M(r.schemaIndex,i.fieldName):void 0;let a,l=function(e,t){if(e.explicitFieldType)return e.fieldType;if(void 0!==t){const e=function(e){if(Object.prototype.hasOwnProperty.call(_,e))return _[e]}(t);if(void 0!==e)return e}return e.fieldType}(i,s?.type);"text"===l&&!0!==i.explicitFieldType&&rt(o)&&(l="richText");try{a=t.resolveRenderer(l,i)}catch(e){return this.fail(r,i.fieldName,e)}if(!n.isCurrent(r))return!1;const u=t.emitter.listenerCount("elementUpdate")>0,d=u?"INPUT"===(c=i.element).tagName||"TEXTAREA"===c.tagName?c.value:"IMG"===c.tagName?c.src:c.textContent:void 0;var c;if(!n.isCurrent(r))return!1;const f={allFields:e.allFields,locale:i.locale??r.locale,schema:s,...this.instanceContext};!0===i.hidesWhenEmpty&&i.element.toggleAttribute("hidden",function(e){return null==e||("string"==typeof e?0===e.trim().length:Array.isArray(e)&&0===e.length||it(e))}(o));try{if(void 0!==i.targetAttribute){if("blocked"===function(e,t,n){const r=t.toLowerCase().trim();if(0===r.length)return"blocked";if(!G(r))return"blocked";if(null==n)return e.removeAttribute(r),"applied";if("string"!=typeof n&&"number"!=typeof n&&"boolean"!=typeof n)return"blocked";const i=String(n);return V.has(r)&&!isSafeUrl(i)?"blocked":(e.setAttribute(r,i),"applied")}(i.element,i.targetAttribute,o))return t.warn(`[live-preview] LP0401: refused to write "${i.fieldName}" into attribute "${i.targetAttribute}"`),n.display.shortfall(r,{kind:"write",field:i.fieldName,code:"LP0401"}),!1}else{if(void 0===a)return t.log("no renderer for",l),X(t,n,i,`has no renderer for "${l}"`,o),!1;{const e=function(e,t,n,r){if("ignore"===e.onUnfaithfulPatch)return;if(void 0!==n.format||!Z.has(r))return;if(Y(r)&&n.element.matches("select,input"))return;if(t.checkedServerFormat.has(n.element))return;t.checkedServerFormat.add(n.element);const i=ee(n.element);return i.trim().length>0?i:void 0}(t,n,i,l);this.writing=o;const r=function(e,t,n,r){return e.render(t,n,r)}(a,i,o,f);if(!1===r&&function(e){return ne.has(e.render)}(a))return X(t,n,i,`is a value ${a.name} cannot render`,o),!1;void 0!==e&&function(e,t,n,r){const i=ee(t.element);i!==n&&e.warn(`[live-preview] LP0412: "${t.fieldName}" showed ${te(n)}, the patch wrote ${te(i)} — `+(Y(r)?'Payload sends the value of an option, not its label. Render the label in a data-payload-fragment boundary, or bind it with data-payload-strategy="route".':"either an edit that arrived before the preview connected, or a template that formats this value differently. Set data-payload-format to match it."))}(t,i,e,l)}}}catch(e){return this.fail(r,i.fieldName,e)}if(!n.isCurrent(r))return!1;u&&t.emitter.emitWhile("elementUpdate",{element:i.element,fieldName:i.fieldName,previousValue:d,nextValue:o,revision:r.revision.revision,receivedAt:r.receivedAt,source:"patch"},()=>n.isCurrent(r));const h=n.isCurrent(r);return h&&(void 0!==e.valueIdentity?n.lastAppliedIdentity.set(i.element,e.valueIdentity):n.lastAppliedIdentity.delete(i.element)),h}fail(e,t,n){if(!this.state.isCurrent(e))return!1;this.state.display.shortfall(e,{kind:"write",field:t,code:"LP0603"});const r=n instanceof Error?n:new Error(String(n));return this.deps.emitter.emitWhile("error",{error:r,context:"renderer",code:"LP0603"},()=>this.state.isCurrent(e)),!1}};function rt(e){if("object"!=typeof e||null===e||!("root"in e))return!1;const t=e.root;return"object"==typeof t&&null!==t&&Array.isArray(t.children)}function it(e){return!!rt(e)&&e.root.children.every(e=>{const{type:t,children:n}=e??{};return"paragraph"===t&&(!Array.isArray(n)||0===n.length)})}function ot(e){if(null==e)return[];const t=/* @__PURE__ */new Set,n=[];for(const r of e.split(/[\s,]+/)){const e=r.trim();0===e.length||t.has(e)||(t.add(e),n.push(e))}return n}function st(...e){const t=/* @__PURE__ */new Map;for(const n of e)for(const[e,r]of Object.entries(n)){let n=t.get(e);void 0===n&&(n=/* @__PURE__ */new Set,t.set(e,n));for(const e of r)n.add(e)}const n={};for(const[e,r]of t)n[e]=[...r];return n}function at(e,t){const n={};for(const r of t)r!==e&&(n[r]=[e]);return n}var lt="payload-live-preview:update",ut="data-payload-island",dt=`astro-island, [${ut}]`,ct="data-payload-owned";function ft(e){if(e.tagName.toLowerCase().includes("-")&&!e.hasAttribute("data-payload-morph"))return!0;if(pt(e)||e.hasAttribute(ct))return!0;const t=e.getAttribute("contenteditable");return null!==t&&"false"!==t}function ht(e){return"patch"===e.getAttribute(ut)}function pt(e){return function(e){return"astro-island"===e.tagName.toLowerCase()||e.hasAttribute(ut)}(e)&&!ht(e)}function isInsideIsland(e){let t=e;for(;null!==t;){if(pt(t))return!0;t=t.parentElement}return!1}function gt(e){return"astro-island"===e.tagName.toLowerCase()&&e.hasAttribute("ssr")}var mt=["component-url","component-export","renderer-url","client","opts","before-hydration-url"],vt=/* @__PURE__ */new WeakMap,yt=/* @__PURE__ */new WeakSet;function bt(e){return"astro-island"===e.tagName.toLowerCase()}function wt(e){let t="";for(const n of e.querySelectorAll("astro-slot, template[data-astro-template]"))n.parentElement?.closest("astro-island")===e&&(t+=`${n.getAttribute("name")??n.getAttribute("data-astro-template")??""}\0${n.innerHTML}\0`);return t}function St(e,t){if(!bt(e)||!bt(t))return!0;const n=wt(t);if(!mt.every(n=>e.getAttribute(n)===t.getAttribute(n))||(vt.get(e)??wt(e))!==n||e.getAttribute("props")!==t.getAttribute("props")&&!function(e){const t=e.ownerDocument.defaultView?.customElements.get("astro-island");return void 0!==t&&e instanceof t&&Array.isArray(t.observedAttributes)&&t.observedAttributes.includes("props")}(e))return vt.set(t,n),!1;vt.set(e,n);const r=t.getAttribute("props");return r!==e.getAttribute("props")&&(e.setAttribute("ssr",""),null===r?e.removeAttribute("props"):e.setAttribute("props",r)),!0}function At(e){return Array.from(e.querySelectorAll("astro-island"))}function kt(e){const t=e.ownerDocument.defaultView;if(void 0===t?.customElements.get("astro-island"))return"element";const n=e.getAttribute("client"),r=Reflect.get(t,"Astro");return null===n||"object"!=typeof r||null===r||void 0===Reflect.get(r,n)?"directive":void 0}var Tt="data-payload-field",Ct="data-payload-type",Rt="data-payload-attribute",$t="data-payload-href",Lt="data-payload-src",Nt="data-payload-alt",Pt="data-payload-array-template",xt="data-payload-array-separator",Et="data-payload-locale",Mt="data-payload-format",Ot="data-payload-richtext",Ft="data-payload-html",Ut="data-payload-array",It="data-payload-structural",_t="data-payload-owner",Dt="data-payload-depends",jt="data-payload-strategy",Bt="data-payload-boundary",zt="data-payload-guessed",Wt="data-payload-covers",Ht=[Tt,Ct,Rt,$t,Lt,Nt,Pt,xt,Et,Mt,Ot,Ft,Ut,It,_t,Dt,jt,Bt,"type"],qt=`[${Tt}]`,Vt=`[${_t}]`,Gt=`[${ce}], [${jt}="route"]`;function Jt(e){const t=e.closest(Vt)?.getAttribute(_t);return null==t||0===t.length?void 0:t}var Kt=/^[a-z][a-z0-9-]*:[a-z][a-z0-9-]*$/i,Xt=/* @__PURE__ */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"]);function Qt(e){return Xt.has(e)||Kt.test(e)}function Zt(e,t){return e.fieldName===t.fieldName&&e.locale===t.locale&&e.owner===t.owner&&e.strategyKind===t.strategyKind&&e.fragmentBoundary===t.fragmentBoundary}var Yt=class{entriesByField=/* @__PURE__ */new Map;entryByElement=/* @__PURE__ */new WeakMap;filter;count=0;dependencies=null;islandRoots=[];ownersByIsland=/* @__PURE__ */new Map;navigationRoots=[];coverDeclarations=[];renderedDeclarations=[];constructor(e={}){this.filter=e.filter??tn}dependencyMap(){if(null!==this.dependencies)return this.dependencies;const e=[];for(const t of this.values())void 0!==t.dependsOn&&e.push(at(t.fieldName,t.dependsOn));return this.dependencies=st(...e),this.dependencies}get islands(){return this.islandRoots}get islandOwners(){return this.ownersByIsland}get covers(){return this.coverDeclarations}get rendered(){return this.renderedDeclarations}get navigationReplayRoots(){return this.navigationRoots}buildFromRoot(e){const t=performance.now();this.clear();let n=0;for(const t of e.querySelectorAll(qt))void 0!==this.add(t)&&(n+=1);return this.islandRoots=function(e){const t=[];for(const n of e.querySelectorAll(dt))ht(n)||t.push(n);return t}(e),this.ownersByIsland=new Map(this.islandRoots.map(e=>[e,Jt(e)])),this.navigationRoots=[...e.querySelectorAll(Gt)].filter(e=>this.filter(e)&&(e.hasAttribute(ce)||0===(e.getAttribute(Tt)??"").length)),this.coverDeclarations=[...e.querySelectorAll(`[${Wt}]`)].filter(e=>this.filter(e)).map(e=>({paths:ot(e.getAttribute(Wt)),owner:Jt(e)})),this.renderedDeclarations=[...e.querySelectorAll(`[${Dt}]`)].filter(e=>this.filter(e)).flatMap(e=>{const t=function(e){if((e.getAttribute(ce)??"").length>0)return"fragment";const t=e.getAttribute(jt);return null!==t?"route"===t?"route":void 0:e.hasAttribute(Tt)&&null!==e.closest("head")?"route":void 0}(e);return void 0===t?[]:[{strategy:t,paths:ot(e.getAttribute(Dt)),owner:Jt(e)}]}),{elementCount:n,fieldCount:this.entriesByField.size,durationMs:performance.now()-t}}add(e){const t=this.filter(e)?this.resolveBinding(e):void 0,n=this.entryByElement.get(e);if(this.dependencies=null,void 0!==t)return void 0!==n&&this.replaceEntry(n,t)?(this.entryByElement.set(e,t),t):(void 0!==n&&this.removeEntry(e,n),this.append(t),this.entryByElement.set(e,t),t);void 0!==n&&this.removeEntry(e,n)}remove(e){const 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(const e of this.entriesByField.values())yield*e}has(e){return this.entryByElement.has(e)}clear(){this.entriesByField.clear(),this.entryByElement=/* @__PURE__ */new WeakMap,this.count=0,this.dependencies=null,this.islandRoots=[],this.ownersByIsland=/* @__PURE__ */new Map,this.navigationRoots=[],this.coverDeclarations=[],this.renderedDeclarations=[]}replaceEntry(e,t){if(e.fieldName!==t.fieldName)return!1;const n=this.entriesByField.get(e.fieldName),r=void 0===n?-1:n.indexOf(e);return!(void 0===n||r<0||(n[r]=t,0))}removeEntry(e,t){this.entryByElement.delete(e);const n=this.entriesByField.get(t.fieldName),r=void 0===n?-1:n.indexOf(t);return!(void 0===n||r<0||(n.splice(r,1),0===n.length&&this.entriesByField.delete(t.fieldName),this.count-=1,0))}append(e){const t=this.entriesByField.get(e.fieldName);t?t.push(e):this.entriesByField.set(e.fieldName,[e]),this.count+=1}resolveBinding(e){const t=e.getAttribute(Tt);if(null===t||0===t.length)return;const n=e.getAttribute(Ct),r=e.getAttribute(Rt),i=e.getAttribute($t),o=e.getAttribute(Lt),s=e.getAttribute(Nt),a=e.getAttribute(Pt),l=e.getAttribute(xt),u=e.getAttribute(Et),d=e.getAttribute(Mt),c=Jt(e),f=ot(e.getAttribute(Dt)),h=e.getAttribute(jt),p=e.getAttribute(zt),g=he(e);return{element:e,fieldName:t,fieldType:en(e),explicitFieldType:null!==n&&Qt(n),strategyKind:ge(e)??"unknown",...null!==g?{fragmentBoundary:g}:{},...null!==r&&r.length>0?{targetAttribute:r}:{},...null!==i&&i.length>0?{hrefField:i}:{},...null!==o&&o.length>0?{srcField:o}:{},...null!==s&&s.length>0?{altField:s}:{},...null!==a?{arrayTemplate:a}:{},...null!==l?{arraySeparator:l}:{},...null!==u&&u.length>0?{locale:u}:{},...null!==d&&d.length>0?{format:d}:{},...void 0!==c?{owner:c}:{},...f.length>0?{dependsOn:f}:{},...null!==h&&h.length>0?{strategy:h}:{},...e.hasAttribute(Bt)?{hidesWhenEmpty:!0}:{},...null!==p?{guessed:p}:{}}}};function en(e){const t=e.getAttribute(Ct);if(null!==t&&Qt(t))return t;if(e.hasAttribute(Ot))return"richText";if(e.hasAttribute(Ft))return"html";if(e.hasAttribute(It))return"structural-array";if(e.hasAttribute(Ut))return"array";if("IMG"===e.tagName)return"image";if("A"===e.tagName)return"url";if("TIME"===e.tagName)return"date";if("INPUT"===e.tagName){const t=e.type;if("checkbox"===t)return"checkbox";if("number"===t)return"number";if("date"===t||"datetime-local"===t)return"date"}return"text"}function tn(){return!0}var nn=1e4,rn=1048576,on=/* @__PURE__ */new Set(["__proto__","constructor","prototype"]);function sn(){throw new Error("invalid or oversized legacy population")}function an(e){for(let t=0;t<e.length;t+=1){const n=e.charCodeAt(t);if(n<=31||127===n)return!0}return!1}function ln(e,t){if("string"!=typeof e||0===e.length||e.length>t||"."===e||".."===e)return!1;if(e.includes("/")||e.includes("\\")||an(e))return!1;try{return encodeURIComponent(e),!0}catch{return!1}}function un(e){return ln(e,128)&&!/[?#%]/u.test(e)&&!on.has(e)}function dn(e){return Number.isFinite(e)?String(e):ln(e,512)?e:sn()}function cn(e,t){return Object.hasOwn(e,t)?Reflect.get(e,t):void 0}function fn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0,enumerable:!0})}function hn(e){let t=e.length;for(;t>0&&47===e.charCodeAt(t-1);)t-=1;return e.slice(0,t)}function pn(e){const t=/* @__PURE__ */new WeakSet;let n=0,r=0;return function e(i,o){if(++n>nn||o>64)return sn();if("string"==typeof i)return r+=i.length,r>rn&&sn(),i;if(null==i||"boolean"==typeof i)return i;if("number"==typeof i)return Number.isFinite(i)?i:sn();if(!Array.isArray(i)&&!h(i))return sn();if(Array.isArray(i)){i.length>nn&&sn();for(let e=0;e<i.length;e+=1)Object.hasOwn(i,e)||sn()}if(t.has(i))return sn();t.add(i);const s=Array.isArray(i)?[]:{};for(const t of Object.keys(i))fn(s,t,e(Reflect.get(i,t),o+1));return t.delete(i),s}(e,0)}function gn(e,t,n,r,i,o){if(!Number.isSafeInteger(i)||i<0||i>64)return sn();void 0!==o&&("string"!=typeof o||o.length>128||an(o))&&sn();const s=pn(e);if(!h(s))return sn();const a=/* @__PURE__ */new Map,l=/* @__PURE__ */new Set;let u=0;const d=/* @__PURE__ */new WeakSet,c=e=>{(++u>nn||e>64)&&sn()};function f(e,t,n,r){if(null==r||""===r)return;const o=h(r)?cn(r,"id"):r,s=dn(o);if(0===i)return void fn(e,t,o);const u=JSON.stringify([n,s]);l.add(u),l.size>1e3&&sn();const d=a.get(n)??[];d.push({owner:e,key:t,id:s}),a.set(n,d)}function p(e,t,n){void 0!==n.hasMany&&"boolean"!=typeof n.hasMany&&sn();const r=n.relationTo,i=cn(e,t);if(Array.isArray(r)){0===r.length&&sn();const e=h(i)?cn(i,"relationTo"):void 0;let t;for(const n of r)c(0),un(n)||sn(),n===e&&(t=n);if(null==i||""===i)return;h(i)&&void 0!==t||sn(),f(i,"value",t,cn(i,"value"))}else un(r)||sn(),f(e,t,r,i)}function g(e,t){if(c(t),Array.isArray(e)||h(e)){if(h(e)&&Object.hasOwn(e,"relationTo")&&Object.hasOwn(e,"value")){const t=cn(e,"relationTo");return un(t)||sn(),void f(e,"value",t,cn(e,"value"))}for(const n of Object.keys(e))g(Reflect.get(e,n),t+1)}}!function e(t,n,r){c(r),d.has(t)&&sn(),d.add(t);for(const i of t){c(r),h(i)&&ln(i.name,512)&&!on.has(i.name)||sn();const t=cn(n,i.name);if("relationship"===i.type||"upload"===i.type)if(i.hasMany)if(null==t||Array.isArray(t)||sn(),Array.isArray(t))for(let e=0;e<t.length;e+=1)p(t,e,i);else p(n,i.name,i);else p(n,i.name,i);else if("group"===i.type||"tabs"===i.type)null==t||h(t)||sn(),h(t)&&i.fields&&e(i.fields,t,r+1);else if("row"===i.type||"collapsible"===i.type)i.fields&&e(i.fields,n,r+1);else if("array"===i.type||"blocks"===i.type){if(0===t?fn(n,i.name,[]):null==t||Array.isArray(t)||sn(),Array.isArray(t))for(const n of t)if(h(n)||sn(),"array"===i.type&&i.fields)e(i.fields,n,r+1);else if("blocks"===i.type){const t=cn(n,"blockType"),o=i.blocks?.find(e=>(c(r),e.slug===t));void 0===o&&sn(),e(o.fields,n,r+1)}}else"richText"===i.type&&g(t,r+1)}d.delete(t)}(t,s,0),a.size>25&&sn();const m=[];if(0===a.size)return{doc:s,requests:m};const v=new URL(n);(!["http:","https:"].includes(v.protocol)||v.username||v.password||v.search||v.hash)&&sn(),(!r.startsWith("/")||r.includes("\\")||/[%?#]/u.test(r)||an(r))&&sn(),r.split("/").some(e=>"."===e||".."===e)&&sn();const y=`${hn(n)}${hn(r)}/`;for(const[e,t]of a){const n=[...new Set(t.map(e=>e.id))];let r=0;for(;r<n.length;){const s=n[r];void 0===s&&sn();const a=s.includes(","),l=[];let u="";for(;r<n.length&&l.length<20;){const t=n[r];if(void 0===t||l.length>0&&(a||t.includes(",")))break;const s=[...l,t],d=new URLSearchParams({depth:String(i),limit:String(s.length)});void 0!==o&&d.set("locale",o),d.set(a?"where[id][equals]":"where[id][in]",a?t:s.join(","));const c=`${y}${encodeURIComponent(e)}?${d}`;if(c.length>8192){0===l.length&&sn();break}new URL(c).origin!==v.origin&&sn(),l.push(t),r+=1,u=c}(0===l.length||m.length>=64)&&sn();const d=new Set(l);m.push({url:u,ids:d,slots:t.filter(e=>d.has(e.id))})}}return{doc:s,requests:m}}async function mn(e,t,n){let r,i=!1,o=!1;const s=/* @__PURE__ */Symbol();let a;const l=new Promise(e=>{a=()=>{e(s)}}),u=()=>{n()&&!t.aborted||sn()},d=()=>{if(void 0!==r&&!i){i=!0;try{Promise.resolve(r.cancel()).catch(()=>{})}catch{}}},c=()=>{a?.(),d()};t.addEventListener("abort",c,{once:!0});try{u();const t=e.body??null;if(u(),null===t){const t=e.json.bind(e);u();const n=await Promise.race([Promise.resolve().then(()=>(u(),t())),l]);return u(),n===s&&sn(),n}const n=t.getReader.bind(t);u();const i=n();r=i,u();const a=[];let d=0,c=0;for(;;){const e=Promise.resolve().then(()=>{u();const e=i.read.bind(i);return u(),e()}),t=await Promise.race([e,l]);if(u(),t===s&&sn(),t.done)break;d+=t.value.byteLength,(++c>1e4||d>rn)&&sn(),a.push(t.value)}o=!0;const f=new Uint8Array(d);let h=0;for(const e of a)f.set(e,h),h+=e.byteLength;try{return JSON.parse((new TextDecoder).decode(f))}catch{return sn()}}finally{t.removeEventListener("abort",c),o||d();try{r?.releaseLock()}catch{}}}function vn(e,t){const n=pn(t);h(n)||sn();const r=cn(n,"docs");(!Array.isArray(r)||r.length>20)&&sn();const i=/* @__PURE__ */new Map;for(const t of r){h(t)||sn();const n=dn(cn(t,"id"));e.ids.has(n)&&!i.has(n)||sn(),i.set(n,t)}i.size!==e.ids.size&&sn();for(const t of e.slots)fn(t.owner,t.key,i.get(t.id))}function yn(e,t){return e.length>0&&e.length<=t&&"."!==e&&".."!==e&&!e.includes("/")&&!e.includes("\\")&&!function(e){for(const t of e){const e=t.codePointAt(0)??0;if(e<=31||127===e)return!0}return!1}(e)}function bn(e){return yn(e,128)&&!e.includes("?")&&!e.includes("#")}function wn(e){return"number"==typeof e?Number.isFinite(e):"string"==typeof e&&yn(e,512)}var Sn=new Error,An=class{serverURL;apiRoute;depth;fetchFn;log;timeoutMs;inflight=null;attempt=0;destroyDepth=0;constructor(e){this.serverURL=function(e){let t=e.length;for(;e.endsWith("/",t);)t-=1;return e.slice(0,t)}(e.serverURL);const t=e.apiRoute??"/api";this.apiRoute=t.startsWith("/")?t:`/${t}`,this.depth=e.depth??1,this.fetchFn=e.fetchFn,this.log=w(e.log??S);const n=e.timeoutMs??0;this.timeoutMs=n>0&&n<Number.POSITIVE_INFINITY?n:void 0}canMerge(e){try{const t=e.schema;return void 0!==t?(gn(e.data,t,this.serverURL,this.apiRoute,this.depth,e.locale),!0):null!==this.endpointOf(e)}catch{return!1}}endpointOf(e){try{const t=e.globalSlug;if(t)return bn(t)?{path:`globals/${encodeURIComponent(t)}`,field:"globalType",value:t}:null;const n=e.collectionSlug??"",r=e.data.id;return bn(n)&&wn(r)?{path:`${encodeURIComponent(n)}/${encodeURIComponent(String(r))}`,field:"id",value:String(r)}:null}catch{return null}}async merge(e){if(this.destroyDepth>0)return{status:"superseded"};const t=this.attempt+=1,n=this.inflight;this.inflight=null;let r=null,i=!1;const o=()=>this.attempt!==t,s=this.timeoutMs;let a,l,u=!1;const d=(e,t)=>void 0===s?e:(void 0===l&&(l=new Promise((e,n)=>{a=setTimeout(()=>{u=!0,t.abort(),n(Sn)},s)}),l.catch(()=>{})),Promise.race([e,l]));try{if(n?.abort(),o())return{status:"superseded"};const t=e.schema;if(i=void 0!==t,void 0!==t){const n=gn(e.data,t,this.serverURL,this.apiRoute,this.depth,e.locale);if(o())return{status:"superseded"};if(0===n.requests.length)return{status:"merged",doc:n.doc};const i=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(o())return{status:"superseded"};if(void 0===i)return{status:"unavailable"};r=new AbortController,this.inflight=r;for(const e of n.requests){const t=await d(i(e.url,{method:"GET",credentials:"include",redirect:"error",signal:r.signal}),r);if(o())return{status:"superseded"};const n=t.ok;if(o())return{status:"superseded"};if(!n){const e=t.status;return o()?{status:"superseded"}:(r.abort(),o()?{status:"superseded"}:(this.log("merge HTTP",e),o()?{status:"superseded"}:{status:"unavailable"}))}const s=await d(mn(t,r.signal,()=>!o()),r);if(o())return{status:"superseded"};if(vn(e,s),o())return{status:"superseded"}}return{status:"merged",doc:n.doc}}const s=this.endpointOf(e);if(o())return{status:"superseded"};if(null===s)return{status:"unavailable"};const a=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(o())return{status:"superseded"};if(void 0===a)return{status:"unavailable"};const l=JSON.stringify({data:e.data,depth:this.depth,flattenLocales:!1,locale:e.locale});if(o())return{status:"superseded"};r=new AbortController,this.inflight=r;const u=`${this.serverURL}${this.apiRoute}/${s.path}`,c=await d(a(u,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","X-Payload-HTTP-Method-Override":"GET"},body:l,signal:r.signal}),r);if(o())return{status:"superseded"};const f=c.ok;if(o())return{status:"superseded"};if(!f){const e=c.status;return o()?{status:"superseded"}:(this.log("merge HTTP",e,u),o()?{status:"superseded"}:{status:"unavailable"})}const h=c.json.bind(c);if(o())return{status:"superseded"};const p=await d(h(),r);if(o())return{status:"superseded"};if(null===p||"object"!=typeof p||Array.isArray(p))return this.log("merge invalid",u),o()?{status:"superseded"}:{status:"unavailable"};const g=p,m=g[s.field],v=Object.hasOwn(g,s.field)&&("id"===s.field?!wn(m)||String(m)!==s.value:m!==s.value);return o()?{status:"superseded"}:v?(this.log("merge invalid",u),o()?{status:"superseded"}:{status:"unavailable"}):{status:"merged",doc:g}}catch(e){return o()?{status:"superseded"}:u?(this.log("merge timeout",s),{status:"unavailable"}):i&&(r?.abort(),o())?{status:"superseded"}:(this.log("merge exception",i?new Error("legacy population could not be resolved"):e),o()?{status:"superseded"}:{status:"unavailable"})}finally{clearTimeout(a),this.inflight===r&&(this.inflight=null)}}destroy(){this.attempt+=1;const e=this.inflight;this.inflight=null,this.destroyDepth+=1;try{e?.abort()}finally{this.destroyDepth-=1}}},kn={name:"payload-2",fieldTyping:"schema",populatesRelationships:"admin",documentEvents:!1},Tn={name:"payload-3",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!0},Cn={name:"unknown",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!1};function detectProtocolProfile(e){return e.has("schema-json")?kn:e.has("document-events")||e.has("relationship-events")?Tn:Cn}var Rn="ssr",$n=[Tt,_t,Wt,Dt],Ln=`[${Tt}], [${Wt}], ${dt}, ${Gt}`,Nn=class{callbacks;debounceMs;rootMargin;visible=/* @__PURE__ */new Set;mutation=null;intersection=null;debounceTimer=null;generation=0;constructor(e,t={}){this.callbacks=e,this.debounceMs=t.mutationDebounceMs??100,this.rootMargin=t.intersectionRootMargin??"200px"}start(e){const t=this.generation;this.stop();const n=t+1;if(this.generation!==n)return;let r=null,i=null;try{r=new MutationObserver(e=>{this.handleMutations(e,n)}),i=new IntersectionObserver(e=>{this.handleIntersection(e,n)},{rootMargin:this.rootMargin,threshold:0}),r.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...Ht,Wt,ut,Rn]})}catch(e){throw r?.disconnect(),i?.disconnect(),e}if(this.generation!==n)return r.disconnect(),void i.disconnect();this.mutation=r,this.intersection=i}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;const e=this.debounceTimer,t=this.mutation,n=this.intersection;this.debounceTimer=null,this.mutation=null,this.intersection=null,this.visible.clear(),null!==e&&clearTimeout(e);try{t?.disconnect()}finally{n?.disconnect()}}handleMutations(e,t){if(!this.isCurrentGeneration(t))return;for(const n of e){const e=Pn(n);if(null!==e&&(this.callbacks.onIslandHydrated?.(e),!this.isCurrentGeneration(t)))return}if(!function(e){for(const t of e){if("attributes"===t.type&&t.attributeName===ut)return!0;if("attributes"===t.type&&null!==t.attributeName){if($n.includes(t.attributeName))return!0;if(Ht.includes(t.attributeName)&&1===t.target.nodeType&&t.target.hasAttribute(Tt))return!0}for(const e of t.addedNodes)if(xn(e))return!0;for(const e of t.removedNodes)if(xn(e))return!0}return!1}(e))return;null!==this.debounceTimer&&clearTimeout(this.debounceTimer);const n=setTimeout(()=>{this.isCurrentGeneration(t)&&this.debounceTimer===n&&(this.debounceTimer=null,this.callbacks.onStructuralChange())},this.debounceMs);this.debounceTimer=n}handleIntersection(e,t){for(const n of e){if(!this.isCurrentGeneration(t))return;const{target:e}=n;if(n.isIntersecting){if(this.visible.has(e))continue;this.visible.add(e),this.callbacks.onVisibilityChange(e,!0)}else this.visible.has(e)&&(this.visible.delete(e),this.callbacks.onVisibilityChange(e,!1))}}isCurrentGeneration(e){return this.generation===e&&null!==this.intersection}};function Pn(e){if("attributes"!==e.type||e.attributeName!==Rn||1!==e.target.nodeType)return null;const t=e.target;return"astro-island"!==t.tagName.toLowerCase()||t.hasAttribute(Rn)?null:t}function xn(e){if(1!==e.nodeType)return!1;const t=e;return t.matches(Ln)||null!==t.querySelector(Ln)}var En=class{#t=[];#n;#r=!1;constructor(e){this.#n=e}get closed(){return this.#r}own(e){this.#r?this.#i(e):this.#t.push(e)}close(){if(this.#r)return;this.#r=!0;const e=this.#t.splice(0).reverse();for(const t of e)this.#i(t)}#i(e){try{e()}catch(e){this.#n("runtime cleanup failed:",e)}}},Mn="[data-payload-field]";function On(){if("undefined"==typeof window)return;const e=window;return e.__livePreviewHydration??={armed:!1,committed:!1,commits:[],onCommit:void 0,waiters:[]}}function Fn(){const e=On();if(void 0===e||e.armed)return;e.armed=!0;const t=window,n=t.__REACT_DEVTOOLS_GLOBAL_HOOK__??=function(){const e=/* @__PURE__ */new Map;return{supportsFiber:!0,renderers:e,inject:t=>{const n=e.size+1;return e.set(n,t),n}}}(),r=n.onCommitFiberRoot;n.onCommitFiberRoot=function(t,n,...i){try{r?.call(this,t,n,...i)}catch{}void 0===e.onCommit?e.commits.push(n):e.onCommit(n)}}function Un(e){e.committed=!0;const t=e.waiters;e.waiters=[];for(const e of t)e()}function In(e,t){const n=e.waiters.indexOf(t);n>=0&&e.waiters.splice(n,1)}function _n(e,t,n){if(e.committed)return null;let r=null;const i=()=>{null!==r&&clearTimeout(r),r=null,t("committed")};return e.waiters.push(i),r=setTimeout(()=>{r=null,In(e,i),t("timed-out")},n),()=>{null!==r&&clearTimeout(r),r=null,In(e,i)}}var Dn="__vue_app__";function jn(){if("undefined"==typeof window)return;const e=window;return e.__livePreviewVueHydration??={armed:!1,committed:!1,waiters:[]}}function Bn(e){return Object.prototype.hasOwnProperty.call(e,Dn)?e[Dn]:void 0}function zn(){const e=jn();if(void 0===e||e.armed)return;e.armed=!0;const t=Element.prototype;void 0===Object.getOwnPropertyDescriptor(t,Dn)&&Object.defineProperty(t,Dn,{configurable:!0,get:()=>{},set(e){Object.defineProperty(this,Dn,{value:e,writable:!0,configurable:!0,enumerable:!0});const t=jn();void 0===t||t.committed||null===this.querySelector(Mn)||function(e,t){const n=t?.$nuxt;!0!==n?.isHydrating||"function"!=typeof n.hook?Un(e):n.hook("app:suspense:resolve",()=>{e.committed||Un(e)})}(t,e)}})}function Wn(){if("undefined"==typeof window)return;const e=window;return e.__livePreviewHydrated??={committed:!1,waiters:[]}}function Hn(e){const t=e.hydration;if(void 0===t)return void e.startNow();const n=qn[t](e.root,n=>{e.later(()=>{Gn(e,t,n)})});null!==n?(e.defer(n),e.hydrated("waiting")):Gn(e,t,"committed")}var qn={react:(e,t)=>function(e,t=5e3){Fn();const n=On();if(void 0===n)return null;if(void 0===n.onCommit){const e=e=>{!n.committed&&function(e){const t=e;return null!=t&&function(e){const t=e;return 9===t?.nodeType||null!=t?.querySelector?.(Mn)}(t.containerInfo)&&!function(e){const t=[];for(null!==e.current&&void 0!==e.current&&t.push(e.current);t.length>0;){const e=t.pop();if(void 0===e)continue;const n=e.memoizedState;if((13===e.tag||31===e.tag)&&"object"==typeof n&&null!==n&&"dehydrated"in n&&"object"==typeof n.dehydrated&&null!==n.dehydrated&&"nodeType"in n.dehydrated&&8===n.dehydrated.nodeType)return!0;null!==e.sibling&&void 0!==e.sibling&&t.push(e.sibling),null!==e.child&&void 0!==e.child&&t.push(e.child)}return!1}(t)}(e)&&Un(n)};n.onCommit=e;for(const t of n.commits.splice(0))e(t)}return _n(n,e,t)}(t),vue:function(e,t,n=5e3){zn();const r=jn();return void 0===r?null:(!r.committed&&function(e){for(let t=e.querySelector(Mn);null!==t;t=t.parentElement)if(void 0!==Bn(t))return!0;return!1}(e)&&Un(r),_n(r,t,n))},sveltekit:function(e,t,n=5e3){const r=e.ownerDocument??e,i=()=>null!==r.querySelector("#svelte-announcer");if(i()||!Object.keys(window).some(e=>e.startsWith("__sveltekit_")))return null;const o={committed:!1,waiters:[]},s=new MutationObserver(()=>{!o.committed&&i()&&Un(o)});s.observe(r,{childList:!0,subtree:!0});const a=_n(o,e=>{s.disconnect(),t(e)},n);return()=>{s.disconnect(),a?.()}},manual:function(e,t,n=5e3){const r=Wn();return void 0===r?null:_n(r,t,n)}},Vn={react:"React commit",vue:"Vue mount",sveltekit:"SvelteKit mount",manual:"markHydrated() call"};function Gn(e,t,n){e.hydrated(n),"timed-out"===n&&e.warn(`[live-preview] LP0607: no ${Vn[t]} in ${String(5e3)} ms; started without waiting for hydration.`),e.startNow()}function Jn(e){return 9===e.nodeType}function Kn(e){return e.body}var Xn=class{timeoutMs;onTimeout;handle=null;lastKick=null;constructor(e){this.timeoutMs=e.timeoutMs??0,this.onTimeout=e.onTimeout}kick(){this.lastKick=Date.now(),this.timeoutMs<=0||(this.stop(),this.arm(this.timeoutMs))}resume(){if(this.timeoutMs<=0||null!==this.handle||null===this.lastKick)return!1;const e=Math.max(0,Date.now()-this.lastKick),t=this.timeoutMs-e;return t<=0?(this.lastKick=null,this.onTimeout(),!0):(this.arm(Math.min(t,this.timeoutMs)),!1)}arm(e){const t=setTimeout(()=>{this.handle===t&&(this.handle=null,this.lastKick=null,this.onTimeout())},e);this.handle=t}stop(){null!==this.handle&&(clearTimeout(this.handle),this.handle=null)}get lastKickAt(){return this.lastKick??0}get pending(){return null!==this.handle}},Qn=class{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)}},Zn=/* @__PURE__ */new Set(["true","false","yes","no","on","off"]),Yn=/^[\d\s.,:+/-]+$/u,er=/^[a-z][a-z0-9_-]*$/u,tr=/^[a-z]{2,3}(?:[-_][A-Za-z0-9]{2,8})*$/u,nr=/* @__PURE__ */new Set(["SCRIPT","STYLE","TEMPLATE","TITLE","NOSCRIPT","TEXTAREA","SELECT","OPTION","INPUT","IFRAME"]);function rr(e,t=13){if("string"!=typeof e)return!1;const n=e.trim();return!(n.length<t||Yn.test(n)||Zn.has(n.toLowerCase())||er.test(n)||tr.test(n))}function ir(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function or(e,t,n=13){const r=/* @__PURE__ */new Map,i=(e,t,n)=>{r.set(e,r.has(e)?null:{field:t,media:n})};for(const[r,o]of Object.entries(e)){if(Le.has(r))continue;const e=Pe(r,t);if(rr(o,n))i(o.trim(),e,!1);else if(ir(o))if("string"==typeof o.url)i(o.url,e,!0);else if(!("id"in o)&&!("_id"in o))for(const[t,r]of Object.entries(o))!Le.has(t)&&rr(r,n)&&i(r.trim(),`${e}.${t}`,!1)}return r}function sr(e){if("http://www.w3.org/1999/xhtml"!==e.namespaceURI||nr.has(e.tagName))return!0;if(e.hasAttribute(Tt)||e.hasAttribute("data-payload-no-bind")||e.hasAttribute(ct)||pt(e))return!0;const t=e.getAttribute("contenteditable");return null!==t&&"false"!==t}function ar(e){let t;for(let n=e.firstChild;null!==n;n=n.nextSibling){if(1===n.nodeType)return;if(3!==n.nodeType)continue;const e=n.data.trim();if(0!==e.length){if(void 0!==t)return;t=e}}return t}function lr(e){return G(e)&&!e.startsWith("data-payload-")&&"value"!==e}function ur(e,t,n){let r=e.byElement.get(t);void 0===r&&(r={attributes:/* @__PURE__ */new Map},e.byElement.set(t,r));let i=e.byField.get(n.field);return void 0===i&&(i=/* @__PURE__ */new Set,e.byField.set(n.field,i)),i.add(t),r}function dr(e,t){for(let n=e.firstElementChild;null!==n;n=n.nextElementSibling){if(sr(n))continue;const e=ar(n),r=void 0===e?void 0:t.values.get(e);null==r||r.media||(ur(t,n,r).text=r.field);for(const e of n.getAttributeNames()){if(!lr(e))continue;const r=t.values.get(n.getAttribute(e)??"");null!=r&&(!r.media||"IMG"===n.tagName&&"src"===e)&&ur(t,n,r).attributes.set(e,r)}dr(n,t)}}function cr(e,t,n){const r=e.tagName;if(void 0!==t){const i={[Tt]:t};if("A"===r){const e=n.get("href");void 0===e?i[Ct]="text":e!==t&&(i[$t]=e)}return{element:e,fieldName:t,matched:ar(e)??"",stamps:i}}if("IMG"===r){const t=n.get("src");if(void 0!==t){const r=n.get("alt");return{element:e,fieldName:t,matched:e.getAttribute("src")??"",attribute:"src",stamps:{[Tt]:t,...void 0!==r&&r!==t?{[Nt]:r}:{}}}}}const i=n.entries().next();if(i.done)return;const[o,s]=i.value;return{element:e,fieldName:s,matched:e.getAttribute(o)??"",attribute:o,stamps:{[Tt]:s,[Rt]:o}}}function fr(e,t){const n={values:t,byElement:/* @__PURE__ */new Map,byField:/* @__PURE__ */new Map};t.size>0&&!sr(e)&&dr(e,n);const r=e=>1===n.byField.get(e)?.size,i=[];for(const[e,t]of n.byElement){const n=void 0!==t.text&&r(t.text)?t.text:void 0,o=/* @__PURE__ */new Map;for(const[e,n]of t.attributes)r(n.field)&&o.set(e,n.field);const s=cr(e,n,o);void 0!==s&&i.push(s)}return i}function hr(e){return 9===e.nodeType?e.body:e}function pr(e,t){for(let n=t.length-1;n>=0;n-=1){const r=t[n];if(void 0!==r){r.observed&&e.observers.unobserveElement(r.element);for(let e=r.attributes.length-1;e>=0;e-=1){const t=r.attributes[e];if(void 0===t)continue;const{name:n,before:i,written:o}=t;i!==o&&r.element.getAttribute(n)===o&&(null===i?r.element.removeAttribute(n):r.element.setAttribute(n,i))}r.cacheTouched&&(r.element.hasAttribute(Tt)?e.cache.add(r.element):e.cache.remove(r.element))}}}function gr(e,t,n,r,i){const o=[],s=[],a=()=>(pr(e,s),[]);for(const l of t){if(!i())return a();const{element:t}=l;if(t.hasAttribute(Tt))continue;if(!i())return a();if(!1!==n&&!ye(Jt(t),n))continue;if(!i())return a();const u={element:t,attributes:[],cacheTouched:!1,observed:!1};s.push(u);for(const[e,n]of[...Object.entries(l.stamps),[zt,l.matched]]){const r=t.getAttribute(e);if(!i())return a();if(u.attributes.push({name:e,before:r,written:n}),t.setAttribute(e,n),!i())return a()}if(u.cacheTouched=!0,void 0!==e.cache.add(t)){if(!i())return a();if(e.observers.observeElement(t),u.observed=!0,!i())return a();if(e.log("autoBind",l.fieldName,"→",`<${t.tagName.toLowerCase()}>`,l.attribute??"text",JSON.stringify(l.matched),r),!i())return a();o.push(l)}else pr(e,[u]),s.pop()}return o}function mr(e,t,n,r,i){if("undefined"!=typeof __LEAN_BUILD__&&__LEAN_BUILD__)return;const o=function(e,t){let n,r=e;for(const e of t.split(".")){if("object"!=typeof r||null===r)break;r=r[e];const t=/^\d+$/.test(e)?r?.id:null;"string"!=typeof t&&"number"!=typeof t||(n=`${n??""}/${String(t)}`)}return n}(r,n.fieldName);if(void 0===o)return;if(i)return void t.rowsOfBinding.delete(n.element);const s=t.rowsOfBinding.get(n.element);t.rowsOfBinding.set(n.element,o),void 0!==s&&s!==o&&X(e,t,n,"stands in a row that moved",o)}function vr(e,t,n,r){if(!e.scopeBindingsByOwner)return!1;const{message:i}=n,o=function(e){if(ve(e.globalSlug))return[(t=e.globalSlug,`global:${t}`)];var t;if(!ve(e.collectionSlug))return null;const n=me(e.collectionSlug);return ve(e.documentId)?[n,me(e.collectionSlug,e.documentId)]:[n]}({globalSlug:"string"==typeof i.globalSlug?i.globalSlug:void 0,collectionSlug:"string"==typeof i.collectionSlug?i.collectionSlug:void 0,documentId:be(r)});return null!==o||t.warnedUnattributableMessage||(t.warnedUnattributableMessage=!0,e.warn("[live-preview] LP0202: scopeBindingsByOwner: update names no document; nothing applied")),o}var yr=class{constructor(e,t,n){this.deps=e,this.state=t,this.host=n}deps;state;host;awaitingHydration=/* @__PURE__ */new WeakSet;delivered=/* @__PURE__ */new WeakMap;confirmations=/* @__PURE__ */new WeakMap;reapplyBindings(e){const t=this.currentTransaction();void 0!==t?.renderData&&this.host.schedule(t,t.renderData,e)}reapplyIslands(e,t=!1){const n=t?e.filter(e=>this.awaitingHydration.delete(e)):e,r=this.state.activeUpdate,i=t&&null!==r&&this.state.isCurrent(r)?r:this.currentTransaction();void 0!==i?.renderData&&this.dispatchIslands(i,i.renderData,n)}dispatchIslands(e,t,n){const r=vr(this.deps,this.state,e,t.fields),i=()=>!e.cancelled&&this.state.isCurrent(e);if(!i())return;let o=this.delivered.get(t);void 0===o&&(o=/* @__PURE__ */new WeakSet,this.delivered.set(t,o));for(const s of n){const n=Jt(s);if(!i())return;if(!1!==r&&!ye(n,r)){this.awaitingHydration.delete(s);continue}const a=this.confirmation(s,e);if(gt(s))this.awaitingHydration.add(s);else{if(this.awaitingHydration.delete(s),o.has(s))continue;o.add(s),br(e,t,[s],i,a)}}}hasLateRouteBinding(e,t,n,r){for(const r of e){if((r.getAttribute(Tt)??"").length>0||"route"!==r.getAttribute(jt))continue;if(!1!==t&&!ye(Jt(r),t))continue;const e=ot(r.getAttribute(Dt));if(0===e.length||e.some(e=>n.touched.has(e)))return!0}for(const[i,o]of this.deps.cache.entries())for(const s of o){if(!e.has(s.element))continue;if(!1!==t&&!ye(s.owner,t))continue;if("route"!==(s.strategyKind??ge(s.element)??"unknown"))continue;const o=ue(r.fields,s,i,n.locale);if(!this.state.isCurrent(n))return!1;if(void 0!==o)return!0}return!1}fieldsForElements(e,t){const n=new Set(t);for(const[t,r]of this.deps.cache.entries())r.some(t=>e.has(t.element))&&n.add(t);return n}unrunFragmentPlan(e,t,n){if(null===t)return null;const r=t.boundaries.filter(t=>!e.fragmentBoundariesRun.has(t)&&(void 0===n||[...n].some(e=>e===t||t.contains(e))));return pe(t.strategy,r,t.ownerKeys)}confirmation(e,t){const n=this.confirmations.get(e);if(n?.transaction===t)return n.displayed;const r=this.state.display.handIsland(t);return this.confirmations.set(e,{transaction:t,displayed:r}),r}currentTransaction(){const e=this.state.activeUpdate;return this.state.navigationBindingReplay&&null!==e&&this.state.isCurrent(e)?e:null}};function br(e,t,n,r,i){!function(e,t,n){let r=0;for(const i of e){if(!n())break;if(i.dispatchEvent(new CustomEvent(lt,{detail:t,bubbles:!1})),r+=1,!n())break}}(n,{fields:t.fields,revision:e.revision.revision,receivedAt:e.receivedAt,locale:e.locale,displayed:i},r)}var wr=" subfieldCoverage";function Sr(e,t,n,r,i){const{warned:o,warn:s}=e;if(o.has(n)||t(n))return;o.add(n);const a=`data-payload-field="${Pe(n,r)}"`;s(""!==i?`[live-preview] LP0203: field "${n}" has a value and no <… ${a}> 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 <… ${a}> for the empty field "${n}"; render the anchor unconditionally so edits to an empty field have somewhere to land.`)}function Ar(e){const t=typeof e;return"string"===t||"number"===t||"boolean"===t||"bigint"===t}function kr(e){return Array.isArray(e.docs)&&"boolean"==typeof e.hasNextPage}function Tr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}var Cr="payload-live-preview",Rr=/* @__PURE__ */Symbol.for("payload-live-preview.trusted-types");function $r(){const e=globalThis,t=e[Rr];if(void 0!==t)return t;const n={};return e[Rr]=n,n}function Lr(e){const t=function(){const e=$r();if(void 0!==e.override)return e.override;if(void 0!==e.auto)return e.auto;const t=function(){const e=globalThis.trustedTypes;if("object"==typeof e&&null!==e)return"function"==typeof e.createPolicy?e:void 0}();try{e.auto=void 0===t?null:t.createPolicy(Cr,{createHTML:e=>e})}catch{e.auto=null}return e.auto}();return null===t?e:t.createHTML(e)}var Nr=/* @__PURE__ */new Set(["open","value","checked","selected"]);function Pr(e,t){for(const n of t.keyAttributes){const t=e.getAttribute(n);if(null!==t&&t.length>0)return`${n}=${t}`}}function xr(e,t,n){if(!Or(e,t))return t;const r=n.boundary??ft,i=r(e),o=r(t);if(i||o)return i&&o&&(n.retainBoundary?.(e,t)??1)?e:t;const s=Fr(e);return function(e,t){for(const n of Array.from(e.attributes))t.hasAttribute(n.name)||Nr.has(n.name.toLowerCase())||e.removeAttribute(n.name);for(const n of Array.from(t.attributes))e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value)}(e,t),!0!==n.retainChildrenOf?.(e,t)&&function(e,t,n){const r=function(e,t){const n=/* @__PURE__ */new Map;let r;for(const i of Array.from(e.children)){const e=Pr(i,t);void 0!==e&&(n.has(e)?r??=e.slice(e.indexOf("=")+1):n.set(e,i))}return void 0!==r&&t.onDuplicateKey?.(e,r),n}(e,n),i=new Set(r.values()),o=Array.from(e.childNodes).filter(e=>!i.has(e)),s=/* @__PURE__ */new Set,a=/* @__PURE__ */new Set,l=Array.from(t.childNodes);let u=e.firstChild,d=0;for(let t=0;t<l.length;t+=1){const i=l[t];let c=null,f=i instanceof Element?Pr(i,n):void 0;if(void 0!==f&&a.has(f)&&(f=void 0),void 0!==f){a.add(f);const e=r.get(f);if(void 0!==e&&!s.has(e)&&(c=Er(e,i,n)===e?e:null,null===c)){e.replaceWith(i),s.add(i),u=i.nextSibling;continue}}else{for(;d<o.length;){const r=o[d];if(d+=1,!s.has(r)){if(Or(r,i)){c=Er(r,i,n)===r?r:null,null===c&&(e.replaceChild(i,r),s.add(i),u=i.nextSibling);break}if(r instanceof Element){const n=l[t+1];if(!(i instanceof Element)||void 0!==n&&Or(r,n)){d-=1;break}e.replaceChild(i,r),s.add(i),u=i.nextSibling;break}if(!(i instanceof Element)){e.replaceChild(i,r),s.add(i),u=i.nextSibling;break}}}if(null===c&&s.has(i))continue}const h=c??i;for(s.add(h);null!==u&&u!==h&&!s.has(u)&&Mr(u);)u=u.nextSibling;h!==u&&e.insertBefore(h,u),u=h.nextSibling}for(const t of Array.from(e.childNodes))s.has(t)||t.remove()}(e,t,n),Ur(s),e}function Er(e,t,n){return e instanceof Element&&t instanceof Element?xr(e,t,n):(e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e)}function Mr(e){return e.nodeType===Node.TEXT_NODE&&0===(e.nodeValue??"").trim().length}function Or(e,t){return e.nodeType===t.nodeType&&(!(e instanceof Element&&t instanceof Element)||e.tagName===t.tagName&&e.namespaceURI===t.namespaceURI)}function Fr(e){const t=e.ownerDocument.activeElement;return t instanceof HTMLElement&&e.contains(t)?{element:t,selection:t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?[t.selectionStart,t.selectionEnd]:null}:null}function Ur(e){if(null===e)return;const{element:t,selection:n}=e;if(t.ownerDocument.activeElement!==t&&t.isConnected)try{t.focus({preventScroll:!0});const[e,r]=n??[null,null];null!==e&&null!==r&&t.setSelectionRange(e,r)}catch{}}function Ir(e,t){if(!function(){try{const e=globalThis.process?.env;return void 0!==e&&"production"!==e.NODE_ENV}catch{return!1}}())return;const n=globalThis,r=n.__payloadLivePreviewDeprecationsWarned??=/* @__PURE__ */new Set;if(!r.has(e)){r.add(e);try{console.warn(`[payload-live-preview] ${t}`)}catch{}}}var _r=/* @__PURE__ */new Set;function Dr(e){_r.has(e)||(_r.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("data-payload-")?"A binding inside CMS content is refused by design — 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 — DOM clobbering, refused by design (docs/security.md)":"Put it on an element the template owns, or set `sanitizerPolicy: 'compat'` to keep every `data-*` as 1.x did"}(e)}.`))}var jr=/* @__PURE__ */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"]),Br=/* @__PURE__ */new Set(["input","button","textarea","select","option","label"]),zr=/* @__PURE__ */new Set(["script","style","iframe","object","embed","link","meta","base","form","input","button","select","textarea","svg","math","template","frame","frameset","noframes","noscript"]),Wr=/* @__PURE__ */new Set(["id","class","lang","dir","title","role","tabindex"]),Hr="aria-",qr="data-",Vr={a:/* @__PURE__ */new Set(["href","target","rel","download","hreflang","type"]),img:/* @__PURE__ */new Set(["src","srcset","sizes","alt","width","height","loading","decoding"]),picture:/* @__PURE__ */new Set([]),source:/* @__PURE__ */new Set(["src","srcset","sizes","type","media"]),audio:/* @__PURE__ */new Set(["src","controls","autoplay","loop","muted","preload"]),video:/* @__PURE__ */new Set(["src","poster","controls","autoplay","loop","muted","preload","width","height","playsinline"]),time:/* @__PURE__ */new Set(["datetime"]),abbr:/* @__PURE__ */new Set(["title"]),q:/* @__PURE__ */new Set(["cite"]),blockquote:/* @__PURE__ */new Set(["cite"]),table:/* @__PURE__ */new Set(["summary"]),th:/* @__PURE__ */new Set(["colspan","rowspan","scope","headers","abbr"]),td:/* @__PURE__ */new Set(["colspan","rowspan","headers"]),col:/* @__PURE__ */new Set(["span"]),colgroup:/* @__PURE__ */new Set(["span"]),ol:/* @__PURE__ */new Set(["start","reversed","type"]),li:/* @__PURE__ */new Set(["value"]),code:/* @__PURE__ */new Set(["class"]),pre:/* @__PURE__ */new Set(["class"])},Gr=/* @__PURE__ */new Set(["href","src","cite","poster","action","formaction"]),Jr=class extends Error{name="SanitizerEnvironmentError"},Kr=/* @__PURE__ */new Set(["id","name","data-payload-key","data-payload-morph","data-payload-nested-key","data-payload-nested-template"]),Xr="strict",Qr=/* @__PURE__ */Symbol.for("payload-live-preview.sanitizer-document");function sanitizeHtml(e,t){return Zr(e,void 0,t)}function Zr(e,t,n){const r=n?.document??ti();if(!r)throw Yr();if(""===e)return"";const i=function(e,t){const n=e?.policy??t??Xr;if(!e){const e=/* @__PURE__ */new Map;for(const[t,n]of Object.entries(Vr))e.set(t,n);return{allowedTags:jr,attrByTag:e,allowFormControls:!1,templateMode:!1,mode:n,allowedData:/* @__PURE__ */new Set}}const r=new Set(jr);if(e.additionalAllowedTags?.forEach(e=>r.add(e)),!0===e.allowFormControls)for(const e of Br)r.add(e);const i=/* @__PURE__ */new Map;for(const[e,t]of Object.entries(Vr))i.set(e,t);for(const[t,n]of Object.entries(e.additionalAllowedAttributes??{})){const e=new Set(i.get(t));for(const t of n)e.add(t);i.set(t,e)}return{allowedTags:r,attrByTag:i,allowFormControls:!0===e.allowFormControls,templateMode:!0===e.templateMode,mode:n,allowedData:new Set(e.allowedDataAttributes?.map(e=>e.toLowerCase()))}}(n,t);let o=e;for(let e=0;e<6;e+=1){const e=r.createElement("template");e.innerHTML=Lr(o);const t=e.content;ni(t,i);const n=ei(t);if(n===o)return n;o=n}return Ir("sanitizer-unsettled",`sanitizeHtml: the output did not settle after ${String(6)} passes, so it returned an empty string (ADR 0016).`),""}function Yr(){return"undefined"!=typeof __INLINE_BUILD__&&__INLINE_BUILD__?new Error("sanitizeHtml needs a DOM"):new Jr("sanitizeHtml needs a DOM; pass one per call during SSR: { document } (linkedom, jsdom).")}function ei(e){const t=e.ownerDocument?.createElement("div");if(void 0===t)throw Yr();const n=e.firstChild;if(t.append(e),t.firstChild!==n)throw Yr();return t.innerHTML}function ti(){if("undefined"==typeof __INLINE_BUILD__||!__INLINE_BUILD__){const e=globalThis[Qr];if(e)return e}if("undefined"!=typeof document)return document}function ni(e,t){for(const n of Array.from(e.childNodes))1===n.nodeType?ri(n,t):8===n.nodeType&&n.remove()}function ri(e,t){const n=e.tagName.toLowerCase();if(!zr.has(n)||t.allowFormControls&&Br.has(n)){if(!t.allowedTags.has(n))return ni(e,t),void e.replaceWith(...e.childNodes);!function(e,t,n){const r=n.attrByTag.get(t);for(const t of Array.from(e.attributes)){const i=t.name.toLowerCase();if(i.startsWith("on")||"style"===i)e.removeAttribute(t.name);else if("is"!==i){if("strict"===n.mode){if(n.templateMode&&Kr.has(i))continue;if("id"===i||"name"===i||i.startsWith("data-payload-")){e.removeAttribute(t.name),"name"===i&&!0!==r?.has(i)||Dr(i);continue}if(i.startsWith(qr)){n.allowedData.has(i)||(e.removeAttribute(t.name),Dr(i));continue}if(Wr.has(i)||i.startsWith(Hr))continue}else if(Wr.has(i)||i.startsWith(Hr)||i.startsWith(qr))continue;r?.has(i)?Gr.has(i)&&!isSafeUrl(t.value)?e.removeAttribute(t.name):("srcset"!==i||ii(t.value))&&("ping"!==i||t.value.trim().split(/\s+/u).every(isSafeUrl))||e.removeAttribute(t.name):e.removeAttribute(t.name)}else e.setAttribute("is","")}}(e,n,t),"a"===n&&function(e){const t=e.getAttribute("href");null!==t&&isExternalHttpUrl(t)&&(e.setAttribute("rel","noopener noreferrer"),e.hasAttribute("target")||e.setAttribute("target","_blank"))}(e),ni(e,t)}else e.remove()}function ii(e){for(const t of e.split(",")){const e=t.trim();if(0===e.length)continue;const[n=e]=e.split(/\s/,1);if(!isSafeUrl(n)||!isSafeUrl(e))return!1}return!0}var oi=Object.freeze({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"}),si=/[&<>"'/`=]/g;function escapeHtml(e){return e.replace(si,e=>oi[e])}var ai=Object.freeze({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}),li=/[&<>"']/g;function escapeHtmlAttribute(e){return e.replace(li,e=>ai[e])}var ui=/\{\{([\s\S]*?)\}\}/g;function di(e){const t=/* @__PURE__ */new Set;for(const n of e)if("object"==typeof n&&null!==n)for(const e of Object.keys(n))t.add(e);return t}function ci(e,t,n,r,i){const o="object"==typeof t&&null!==t?t:null;return e.replace(ui,(e,s)=>null!==o&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(o,s)?escapeHtml(r(Reflect.get(o,s))):null===o&&"value"===s?escapeHtml(r(t)):"index"===s?String(n):null!==o&&!0===i?.has(s)?"":e)}function fi(e){const t=e.children,n=t[0];if(void 0===n)return[];const r=[];for(const{name:e,value:i}of Array.from(n.attributes)){if(!G(e)||e.startsWith("data-payload-"))continue;let n=!0;for(let r=1;r<t.length&&n;r+=1)n=t[r]?.getAttribute(e)===i;n&&r.push([e,i])}return r}function hi(e,t){for(const[n,r]of t)e.hasAttribute(n)||e.setAttribute(n,r)}function pi(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 gi(e){return null==e||""===e}function mi(e,t){const n=e.get(t);return void 0!==n&&(e.delete(t),e.set(t,n)),n}function vi(e,t,n,r){return e.set(t,n),function(e,t){for(const n of e.keys()){if(e.size<=t)break;e.delete(n)}}(e,r),n}var yi=["input","textarea","select","option","button","label","details","summary","dialog","video","audio","progress","meter"],bi=["type","name","placeholder","open","disabled","readonly","required","checked","selected","value","min","max","step","rows","cols","for","controls","muted","loop","poster","src"],wi=/<([a-z][a-z0-9]*(?:-[a-z0-9]+)+)\b/gi,Si=/* @__PURE__ */new Map;function Ai(e){const t=mi(Si,e);if(void 0!==t)return t;const n=new Set(yi);for(const t of e.matchAll(wi)){const e=t[1]?.toLowerCase();void 0!==e&&n.add(e)}const r={};for(const e of n)r[e]=bi;const i={additionalAllowedTags:[...n],additionalAllowedAttributes:r,allowFormControls:!0,templateMode:!0};return vi(Si,e,i,64)}var ki="data-payload-key",Ti="data-payload-nested-key",Ci="data-payload-nested-template";function Ri(e){const t=Li(e.container,e.patches,e);return null===t?null:Ni(t,e.store,{morph:e.morph??!0,onDuplicateKey:e.onDuplicateKey})}function $i(e,t){return t.hasAttribute(Ti)&&t.hasAttribute(Ci)}function Li(e,t,n){const r=function(e,t,n){const{template:r,nextItems:i,forceRender:o=!1,store:s,sanitizerPolicy:a}=n,l=s.get(e),u=fi(e),d=di(i),c=Array.from(e.children),f=Ui(c,ki),h=/* @__PURE__ */new Set,p=[];for(let s=0;s<i.length;s+=1){const g=i[s],m=Fi(g);let v=void 0===m?c[s]??null:Ii(f,m)??null;null!==v&&h.has(v)&&(v=null),null!==v&&h.add(v);const y=t.replaces.has(s),b=o||t.renders.has(s)||null===v?_i(e.ownerDocument,r,g,s,a,u,d):void 0;if(null===b)return null;const w=void 0===b?[]:Pi(y?null:v,b,g,void 0===m?void 0:l?.get(m),n);if(null===w)return null;p.push([s,v,b,w,y])}return p}(e,function(e){const t=/* @__PURE__ */new Set,n=/* @__PURE__ */new Set;for(const r of e)"insert"===r.kind||"update"===r.kind?t.add(r.index):"replace"===r.kind&&(t.add(r.index),n.add(r.index));return{renders:t,replaces:n}}(t),n);return null===r?null:[e,r,n.nextItems]}function Ni(e,t,n){const[r,i,o]=e,s=/* @__PURE__ */new Set;let a=!1;const l=Fr(r);for(const[e,o,l,u,d]of i){let i=o;if(void 0!==l){const e=!(!n.morph||d||null===o)&&xr(o,l,{keyAttributes:[ki,Ti],boundary:ft,retainBoundary:St,retainChildrenOf:$i,...void 0!==n.onDuplicateKey?{onDuplicateKey:n.onDuplicateKey}:{}})===o;if(!e)for(const[e,t]of u)null!==e&&(Ei(e,t),t.replaceWith(e));for(const[,,e]of u)void 0!==e&&Ni(e,t,n);e?a=!0:(null!==o&&(o.replaceWith(l),a=!0),i=l)}if(null===i)continue;const c=r.children[e]??null;i!==c&&(r.insertBefore(i,c),a=!0),s.add(i)}for(const e of Array.from(r.children))s.has(e)||(e.remove(),a=!0);Ur(l);const u=function(e,t){let n=t.get(e);return n||(n=/* @__PURE__ */new Map,t.set(e,n)),n}(r,t);u.clear();for(const e of o)Oi(u,e);return a}function Pi(e,t,n,r,i){const o=Ui(null===e?[]:xi(e),Ti),s=[];for(const e of xi(t)){const t=e.getAttribute(Ti);if(null===t)continue;const a=Ii(o,t)??null,l=e.getAttribute(Ci),u=l?a:null,d=u?.getAttribute(Ci)??null;let c;if(l){const o=Mi(n,t);if(void 0!==o||null!==u){const n=o??[],s=U(null===u?[]:Mi(r,t)??[],n),a=null!==u&&d!==l;if((s.length>0||a)&&(c=Li(u??e,s,{template:l,nextItems:n,forceRender:a,store:i.store,sanitizerPolicy:i.sanitizerPolicy})??void 0,void 0===c))return null}}s.push([u,e,c])}return s}function xi(e){return Array.from(e.querySelectorAll(`[${Ti}]`)).filter(t=>{let n=t.parentElement;for(;null!==n&&n!==e;){if(n.hasAttribute(Ti))return!1;n=n.parentElement}return n===e})}function Ei(e,t){for(const n of Array.from(e.attributes))t.hasAttribute(n.name)||e.removeAttribute(n.name);for(const n of Array.from(t.attributes))e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value)}function Mi(e,t){if("object"!=typeof e||null===e)return;const n=e[t];return Array.isArray(n)?n:void 0}function Oi(e,t){const n=Fi(t);void 0!==n&&e.set(n,t)}function Fi(e){if("object"!=typeof e||null===e)return;const t=e.id;return"string"==typeof t||"number"==typeof t?String(t):void 0}function Ui(e,t){const n=/* @__PURE__ */new Map;for(let r=e.length-1;r>=0;r-=1){const i=e[r];if(void 0===i)continue;const o=i.getAttribute(t);if(null===o)continue;const s=n.get(o);void 0===s?n.set(o,[i]):s.push(i)}return n}function Ii(e,t){return e.get(t)?.pop()}function _i(e,t,n,r,i,o,s){const a=Zr(ci(t,n,r,pi,s),i,Ai(t)),l=e.createElement("template");l.innerHTML=Lr(a);const u=l.content.firstElementChild;if(!u)return null;hi(u,o);const d=Fi(n);return void 0!==d&&u.setAttribute(ki,d),u}function Di(e,t,n){t.warnedFragmentFallback||(t.warnedFragmentFallback=!0,e.warn(`[live-preview] LP0806: "${n.fieldName}" asks for the fragment strategy but no handler is configured; patching instead`))}function ji(e,t,n){t.warnedStrategy.has(n.element)||(t.warnedStrategy.add(n.element),e.warn(`[live-preview] LP0407: "${n.fieldName}" asks for strategy "${String(n.strategy)}"; only patch, fragment and route exist`))}function Bi(e,t,n){if(t.warnedEscalationUnavailable)return;t.warnedEscalationUnavailable=!0;const r=`[live-preview] LP0808: onUnfaithfulPatch: 'escalate' has nowhere to go: ${String(n)} field(s) fell short`,i="or onUnfaithfulPatch: 'warn' to keep the patch and say so.";e.warn(void 0===e.strategies.fragment?`${r} and no route or fragment strategy is configured. Set routeStrategy: true or fragments: { endpoint }, ${i}`:`${r}, not all of them inside a data-payload-fragment boundary of this document, and no route strategy is configured. Cover them with a boundary or add the route strategy, ${i}`)}var zi=class{constructor(e,t,n){this.deps=e,this.state=t,this.host=n}deps;state;host;planFragments(e,t){const{deps:n,state:r}=this,i=n.strategies.fragment;if(void 0===i)return null;const o=new Set(i.plan(n.root,e));for(const e of r.fragmentsOwed)n.root.contains(e)?o.add(e):r.fragmentsOwed.delete(e);return pe(i,[...o].filter(e=>Wi(e,t)),t)}escalateUnfaithful(e,t,n,r){if(e.routeRefreshed)return void this.kept(e,n);const{fragment:i,route:o}=this.deps.strategies,s=void 0===i?void 0:function(e){const t=[];for(const n of e){const e=n.fragmentBoundary;if(void 0===e)return;t.includes(e)||t.push(e)}return t}(n),a=void 0===s||s.every(e=>Wi(e,r))?s:void 0;return void 0!==i&&void 0!==a?(this.state.escalatedCount+=n.length,e.pendingFragments+=a.length,void this.runFragments(e,t,pe(i,a,r))):void 0===o?(Bi(this.deps,this.state,n.length),void this.kept(e,n)):(this.state.escalatedCount+=n.length,void this.refreshRoute(e,t,o))}kept(e,t){for(const n of t)this.state.display.shortfall(e,{kind:"unfaithful",field:n.fieldName})}hasUnboundChange(e,t){const{deps:n,state:r}=this;if(e.baseline||e.routeRefreshed)return!1;const i=Oe(n.cache,e.touched,e.locale,t,this.subfields(e),n.strategies);let o=0;for(const e of i)Q(r,e)&&(o+=1);const[s]=i;if(void 0===s)return!1;if("escalate"!==n.onUnfaithfulPatch||void 0===n.strategies.route){"escalate"===n.onUnfaithfulPatch&&Bi(n,r,i.length);for(const t of i)r.display.shortfall(e,{kind:"unbound",field:t});return!1}return e.navigated?(r.routeAwaitsSave=!0,r.display.shortfall(e,{kind:"route-saved"}),!1):(n.log("route","LP0807",`field "${s}" has no binding; refreshing the route`),r.escalatedCount+=o,!0)}subfields(e){const{previousFields:t}=this.state.changes;return Me(this.deps.subfieldCoverage,t,e.renderData?.fields)}plansRoute(e,t,n){const r=e=>!1===n||ye(e,n),i=function(e,t,n){const r=e.rendered.flatMap(e=>"route"===e.strategy?e.paths:[]);for(const[t,n]of e.entries())n.some(e=>"route"===e.strategyKind)&&r.push(t);const i=new Set(t);for(const e of r){const[r=e]=e.split(".");t.has(r)&&(void 0===n||Re(e,n.previous,n.next))&&i.add(e)}return i}(this.deps.cache,t.touched,this.subfields(t));if(e.plan(this.deps.root,i,{inScope:e=>r(Jt(e))}))return!0;for(const[e,t]of this.deps.cache.entries())if(i.has(e)&&t.some(e=>"route"===e.strategyKind&&r(e.owner)))return!0;return!1}async runFragments(e,t,n){const{deps:r,state:i}=this,o=new AbortController,s=new Set(n.boundaries);for(const e of s)i.fragmentsOwed.delete(e);i.fragmentControllers.set(o,s);const a=t=>{s.delete(t)&&(e.pendingFragments-=1)},l=()=>i.isCurrent(e)&&!o.signal.aborted,u=e=>function(e,t,n){if(t.isConnected)return t;const r=t.getAttribute(ce),i=t.getAttribute(fe);let o;for(const t of e.querySelectorAll(`[${ce}]`))if(t.getAttribute(ce)===r&&t.getAttribute(fe)===i&&n(t)){if(void 0!==o)return;o=t}return o}(r.root,e,e=>Wi(e,n.ownerKeys)),{emitter:d}=r,{message:c}=e,f=e.revision.revision,h=e.receivedAt,p={root:r.root,revision:f,receivedAt:h,fields:t.fields,locale:e.locale,collectionSlug:"string"==typeof c.collectionSlug?c.collectionSlug:void 0,globalSlug:"string"==typeof c.globalSlug?c.globalSlug:void 0,signal:o.signal,isCurrent:l,log:(e,t)=>{r.log("fragment",e,t)},morph:(e,t)=>{const n=l()?u(e):void 0;void 0!==n&&function(e,t,n){const r=e.ownerDocument.createElement("template");r.innerHTML=Lr(t);const i=e.cloneNode(!1);i.append(r.content);const o=At(e);xr(e,i,{keyAttributes:[ki],boundary:ft,retainBoundary:St}),function(e){for(const t of e)t.isConnected||yt.has(t)||(yt.add(t),t.dispatchEvent(new CustomEvent("astro:unmount")))}(o);const s=new Set(o);for(const t of At(e)){const e=s.has(t)?void 0:kt(t);void 0!==e&&n(t,e)}}(n,t,(e,t)=>{!function(e,t,n,r){if(t.warnedIslandStart)return;t.warnedIslandStart=!0;const i="element"===r?"<astro-island>":`client:${n.getAttribute("client")??""}`;e.warn(`[live-preview] LP0809: a fragment island cannot start: this page never loaded ${i}; render one on the page`)}(this.deps,this.state,e,t)})},patch:r=>{const i=u(r);void 0!==i&&(i!==r&&this.host.rebuildCache(),this.patchFallback(e,t,i,n.ownerKeys,l))},rendered:(e,t,n)=>{a(e);const r=u(e)??e;d.emitWhile("fragmentRender",{element:r,id:t,key:n,status:"rendered",revision:f,receivedAt:h},l)},failed:(t,n,o,s,c)=>{a(t);const p=u(t)??t;i.display.shortfall(e,{kind:"fragment",id:n,key:o,code:s});const g=`fragment "${n}" fell back to patch: ${c}`;r.log("fragment",s,g),d.emitWhile("error",{error:new Error(g),context:"fragment",code:s},l),d.emitWhile("fragmentRender",{element:p,id:n,key:o,status:"failed",code:s,revision:f,receivedAt:h},l)}};let g={rendered:0,failed:0,superseded:0};try{g=await n.strategy.render(p,n.boundaries)}catch(t){if(r.log("fragment","LP0801",t),l()){for(const t of n.boundaries)p.patch(t),i.display.shortfall(e,et(t));g={rendered:0,failed:n.boundaries.length,superseded:0}}}i.fragmentStats.rendered+=g.rendered,i.fragmentStats.failed+=g.failed,i.fragmentStats.superseded+=g.superseded,i.fragmentControllers.delete(o);for(const e of s)a(e);l()&&(g.rendered>0&&this.host.restoreGuesses(e,t),0===e.pendingFragments&&0===r.scheduler.pendingCount&&i.complete(e),this.host.revealPending(e),l()&&0!==g.rendered&&0!==d.listenerCount("afterUpdate")&&d.emitWhile("afterUpdate",{data:t,updatedCount:g.rendered,durationMs:Date.now()-h,revision:f,receivedAt:h,source:"fragment"},l))}async refreshRoute(e,t,n){const{deps:r,state:i}=this;if(e.routeRefreshed)return i.routeStats.loopStopped+=1,void r.log("route","LP0805",`revision ${String(e.revision.revision)} asked for a second refresh`);e.routeRefreshed=!0,await this.runRoute(e,t,n,!1).catch(e=>{this.routeFailed(e)})}refreshAfterSave(){const{deps:e,state:t}=this,{route:n}=e.strategies,r=t.activeUpdate;t.routeAwaitsSave&&void 0!==n&&void 0!==r?.renderData&&(e.log("route","document saved; refreshing the route"),this.runRoute(r,r.renderData,n,!0).catch(e=>{this.routeFailed(e)}))}routeFailed(e){this.deps.log("route refresh failed:",e)}armRouteRetry(e,t,n,r,i){const{state:o}=this;null!==o.routeRetry&&clearTimeout(o.routeRetry),o.routeRetry=setTimeout(()=>{o.routeRetry=null,o.isCurrent(e)&&this.runRoute(e,t,n,i).catch(e=>{this.routeFailed(e)})},r)}async runRoute(e,t,n,r){const{deps:i,state:o}=this;if(i.routeAfterSave&&!r)return o.routeAwaitsSave=!0,void o.display.shortfall(e,{kind:"route-saved"});const s=o.routeStats,a=new AbortController;o.routeController?.abort(),o.routeController=a;const l=()=>!a.signal.aborted;let u;try{u=await n.refresh({revision:e.revision.revision,receivedAt:e.receivedAt,signal:a.signal,isCurrent:l,log:(e,t)=>{i.log("route",e,t)},retryAfter:i=>{this.armRouteRetry(e,t,n,i,r)}})}catch(e){i.log("route","LP0801",e),u="failed"}if(!l())return;o.routeController=null;const d=o.activeUpdate;if(null===d)return;const c=d.renderData,f=()=>o.isCurrent(d);if("partial"===u?o.display.shortfall(d,{kind:"route-saved"}):("failed"===u||"superseded"===u||"refused"===u&&null===o.routeRetry)&&o.display.shortfall(d,{kind:"route-failed",outcome:u}),"refreshed"===u||"partial"===u){if(s.refreshes+=1,"partial"===u&&(s.partial+=1),o.routeAwaitsSave="partial"===u&&!r,o.lastAppliedIdentity=/* @__PURE__ */new WeakMap,void 0!==c&&this.host.restoreGuesses(d,c),this.host.rebuildCache(),void 0===c||!f())return;return this.host.reapply(d,c),void(i.emitter.listenerCount("afterUpdate")>0&&i.emitter.emitWhile("afterUpdate",{data:c,updatedCount:i.cache.elementCount,durationMs:Date.now()-d.receivedAt,revision:d.revision.revision,receivedAt:d.receivedAt,source:"route"},f))}"failed"===u?s.failed+=1:"refused"===u&&(s.refused+=1),void 0!==c&&this.host.reapply(d,c)}warnFragmentFallback(e){Di(this.deps,this.state,e)}warnUnsupportedStrategy(e){ji(this.deps,this.state,e)}patchFallback(e,t,n,r,i){if(i())for(const[o,s]of this.deps.cache.entries())for(const a of s){if(a.fragmentBoundary!==n)continue;if(!1!==r&&!ye(a.owner,r))continue;const s=ue(t.fields,a,o,e.locale);void 0!==s&&i()&&this.deps.scheduler.schedule({target:a,value:this.host.transform(a,s,t.fields,i),allFields:t.fields,revision:e.revision,data:t})}}};function Wi(e,t){return!1===t||ye(Jt(e),t)}function Hi(e,t,n,r,i){const o=e.transformValue;if(void 0===o)return n;try{const e=o(t.fieldName,n,{element:t.element,allFields:r},i),s=v(e);if(!i())return n;if(s)throw new TypeError(`Transform for "${t.fieldName}" returned a thenable; transforms must be synchronous`);return e}catch(t){if(!i())return n;const r=t instanceof Error?t:new Error(String(t));return e.emitter.emit("error",{error:r,context:"transform",code:"LP0602"}),n}}var qi=/* @__PURE__ */new Set,Vi={kind:"merge"},Gi=class{constructor(e,t,n){this.deps=e,this.state=t,t.changes.keepValues="declared"===e.subfieldCoverage,t.display.host=function(e,t){return{outstanding:n=>!n.completed||n.pendingFragments>0||null!==t.routeController||null!==t.routeRetry||e.scheduler.pendingCount>0,report:t=>{"partial"===t.state&&e.a11y?.announcePartial(),e.emitter.emit("revisionDisplay",t)},failed:t=>{e.log("revision display failed:",t)}}}(e,t),this.strategies="undefined"!=typeof __LEAN_BUILD__&&__LEAN_BUILD__?function(e,t){return{planFragments:()=>null,escalateUnfaithful:(e,n,r)=>{for(const{fieldName:n}of r)t.display.shortfall(e,{kind:"unfaithful",field:n})},hasUnboundChange:(n,r)=>{if(n.baseline)return!1;const i=Oe(e.cache,n.touched,n.locale,r,Me(e.subfieldCoverage,t.changes.previousFields,n.renderData?.fields));for(const e of i)Q(t,e),t.display.shortfall(n,{kind:"unbound",field:e});return!1},plansRoute:()=>!1,runFragments:()=>Promise.resolve(),refreshRoute:()=>($("route refreshes"),Promise.resolve()),refreshAfterSave:()=>{},warnFragmentFallback:n=>{$("server-rendered fragments"),Di(e,t,n)},warnUnsupportedStrategy:n=>{ji(e,t,n)}}}(e,t):new zi(e,t,{reapply:(e,t)=>{this.scheduleAllFields(e,t)},transform:(t,n,r,i)=>Hi(e,t,n,r,i),rebuildCache:n,restoreGuesses:(e,t)=>{this.restoreGuesses(e,t)},revealPending:e=>{this.revealPending(e)}}),this.navigationReplay=new yr(e,t,{schedule:(e,t,n)=>{this.scheduleAllFields(e,t,n)}})}deps;state;strategies;navigationReplay;handleUpdate(e,t,n){const{deps:r,state:i}=this;r.heartbeat.kick(),i.protocol.observe(function(e){const 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),r.log,r.warn);const o=e.data;void 0!==o?void 0!==n&&this.acceptDataUpdate(e,o,t,n,!0):void 0!==e.protocolVersion&&i.protocol.applyVersion(e.protocolVersion,r.log)}handleReplay(e,t,n){const r=e.data;void 0!==r&&this.acceptDataUpdate(e,r,t,n,!1)}reapplyNavigationBindings(e){this.navigationReplay.reapplyBindings(e)}reapplyNavigationIslands(e,t=!1){this.navigationReplay.reapplyIslands(e,t)}acceptDataUpdate(e,t,n,r,i){const{deps:o,state:s}=this,a=i?s.relationships.inspect(e):null,l="string"==typeof e.locale?e.locale:s.locale;let u=s.schema,d=s.schemaIndex;Array.isArray(e.fieldSchemaJSON)&&(u=e.fieldSchemaJSON,d=function(e,t=""){const n=/* @__PURE__ */new Map;return E(e,t,n,!1),E(e,t,n,!0),n}(e.fieldSchemaJSON));const c=s.activeUpdate;if(!s.isRunning()||null!==c&&c.revision.revision>r.revision)return;const f=null===a?null:s.relationships.commit(a),h=c,p={revision:r,message:e,rawData:t,locale:l,schema:u,schemaIndex:d,receivedAt:Date.now(),forceRender:null!==f||Ve(h),countsAsUpdate:i,renderData:void 0,fragmentBoundariesRun:/* @__PURE__ */new WeakSet,touched:/* @__PURE__ */new Set,baseline:!1,navigated:!1,invalidated:/* @__PURE__ */new Set,revealTarget:void 0,revealIdentities:[],pendingFragments:0,routeRefreshed:!1,cancelled:!1,completed:!1};if(s.locale=l,s.schema=u,s.schemaIndex=d,null!==h&&!h.completed&&h.countsAsUpdate&&(s.supersededCount+=1),s.activeUpdate=p,i&&(s.updateCount+=1),s.display.begin(p,r.revision),s.isCurrent(p)&&(o.scheduler.acceptRevision(r),s.isCurrent(p)&&(s.supersedeStrategies(),s.isCurrent(p)&&(null===f||(o.emitter.emitWhile("relationshipUpdate",{detail:f,timestamp:Date.now()},()=>s.isCurrent(p)),s.isCurrent(p)))&&(!i||void 0===e.protocolVersion||(s.protocol.applyVersion(e.protocolVersion,o.log),s.isCurrent(p)))))){if(i&&o.connection.markConnected()){if(o.a11y?.announceConnected(),o.emitter.emit("connect",{origin:n,timestamp:Date.now()}),!s.isCurrent(p))return;if(o.log("connection","disconnected","→","connected"),!s.isCurrent(p))return}this.processUpdate(p).catch(e=>{o.log("update failed:",e)})}}async processUpdate(e){const{deps:t,state:n}=this,r=await this.resolveIncomingFields(e);if(null===r||!n.isCurrent(e))return;const i=this.dataFor(e,r);t.emitter.listenerCount("beforeUpdate")>0&&(!await t.emitter.emitWhile("beforeUpdate",{data:i,revision:e.revision.revision,receivedAt:e.receivedAt,source:"patch",cancel:()=>{e.cancelled=!0,t.scheduler.cancelRevision(e.revision)}},()=>!e.cancelled&&n.isCurrent(e))||e.cancelled||!n.isCurrent(e))||this.applyFields(e,i,!1)}dataFor(e,t){const{message:n}=e;return{fields:t,...void 0!==e.schema?{schema:e.schema}:{},..."string"==typeof n.globalSlug?{globalSlug:n.globalSlug}:{},..."string"==typeof n.collectionSlug?{collectionSlug:n.collectionSlug}:{},...void 0!==e.locale?{locale:e.locale}:{}}}applyFields(e,t,n){const{deps:r,state:i}=this;if(!i.isCurrent(e))return;if(i.changes.isBaseline&&!n&&"off"!==r.autoBind){if("undefined"!=typeof __LEAN_BUILD__&&__LEAN_BUILD__)$("auto-binding");else{const n=vr(r,i,e,t.fields);!function(e,t,n,r,i,o){if(!o())return 0;const s=performance.now(),a=hr(e.root),l=or(n,r);if(!o())return 0;const u=null===a?[]:fr(a,l);if(!o())return 0;const d=gr(e,u,i,"on the first message",o);if(!o())return 0;const c=function(e,t){const n=/* @__PURE__ */new Set;for(const{fieldName:e,stamps:r}of t){n.add(e);for(const e of[$t,Nt]){const t=r[e];void 0!==t&&n.add(t)}}const r=/* @__PURE__ */new Map;for(const[t,i]of e)null!==i&&n.has(i.field)&&r.set(t,i);return{fields:n,values:r}}(l,d),f=performance.now()-s;o()&&(t.autoBindGuesses=c,t.autoBindSearchMs=f,d.length)}(r,i,t.fields,e.locale,n,()=>i.isCurrent(e))}if(!i.isCurrent(e))return}const o=st(r.dependencies,r.cache.dependencyMap());if(!i.isCurrent(e))return;const s=i.changes.diff(t.fields,o,()=>i.isCurrent(e));if(null===s)return;const a=!n&&i.navigationReplayPending;a&&(i.navigationReplayPending=!1,i.navigationBindingReplay=!0),e.baseline=s.baseline&&!a,e.navigated=a,e.invalidated=n?qi:s.invalidated,e.touched=n?qi:/* @__PURE__ */new Set([...s.changed,...s.invalidated]),e.renderData=t,this.scheduleAllFields(e,t)}async resolveIncomingFields(e){const{deps:t,state:n}=this,r=e.rawData;if(null===t.merger)return r;const i=n.merges.decide(t,e);if(!i.merge)return i.fields;const{message:o}=e,s=n.merges.request(t.merger,t.mergeWindowMs,{collectionSlug:o.collectionSlug,globalSlug:o.globalSlug,data:r,...void 0===e.schema?{}:{schema:e.schema},locale:e.locale});if(!s.leading)return this.applyMerged(e,s.result).catch(e=>{t.log("update failed:",e)}),i.fields;const a=await s.result;return n.isCurrent(e)?"merged"===a.status?(n.merges.recordMerged(a.doc,e.locale),a.doc):"superseded"===a.status?null:(n.display.shortfall(e,Vi),i.fields):null}async applyMerged(e,t){const{state:n}=this,r=await t;"unavailable"===r.status&&n.display.shortfall(e,Vi),"merged"===r.status&&n.isCurrent(e)&&(n.merges.recordMerged(r.doc,e.locale),this.applyFields(e,this.dataFor(e,r.doc),!0))}scheduleAllFields(e,t,n){const{deps:r,state:i}=this;if(!i.isCurrent(e))return;const o=void 0!==n,s=()=>i.isCurrent(e),a=vr(r,i,e,t.fields);if(!s())return;const{touched:l}=e,u=r.strategies.route;if(o&&void 0!==u&&!e.routeRefreshed&&this.navigationReplay.hasLateRouteBinding(n,a,e,t))return void(s()&&this.strategies.refreshRoute(e,t,u));const d=!o&&this.strategies.hasUnboundChange(e,a),c=i.routeRefreshOwed;if(!o&&void 0!==u&&!e.routeRefreshed&&(d||c||this.strategies.plansRoute(u,e,a))&&s())return i.routeRefreshOwed=!1,void this.strategies.refreshRoute(e,t,u);const f=o?this.navigationReplay.fieldsForElements(n,l):l,h=this.navigationReplay.unrunFragmentPlan(e,this.strategies.planFragments(f,a),n);if(!s())return;const p=r.skipUnchanged;let g=0;for(const[l,u]of r.cache.entries()){if(!s())return;for(const d of u){if(void 0!==n&&!n.has(d.element))continue;if(!1!==a&&!ye(d.owner,a))continue;if(!0===h?.covers(d)){if(r.revealEditedField){const n=ue(t.fields,d,l,e.locale);i.revealLedger.note(e,d,n)}continue}const u=d.strategyKind??ge(d.element)??"unknown";if("unknown"===u){this.strategies.warnUnsupportedStrategy(d);continue}"fragment"===u&&null===h&&this.strategies.warnFragmentFallback(d);const c=ue(t.fields,d,l,e.locale);if(void 0===c){i.absentFields.add(l);continue}if(mr(r,i,d,t.fields,e.navigated),!o&&r.revealEditedField&&i.revealLedger.note(e,d,c),!s())return;const f=Hi(r,d,c,t.fields,s);if(!s())return;const m=p?de(d,f,t.fields,e.locale):void 0,v=i.lastAppliedIdentity.get(d.element);if(!e.forceRender&&r.skipUnchanged&&void 0!==m&&v===m&&!e.invalidated.has(l)){i.skippedUnchangedCount+=1;continue}const y={target:d,value:f,allFields:t.fields,revision:e.revision,...o?{}:{data:t},valueIdentity:m};r.scheduler.schedule(y),g+=1}}if(o||function(e,t,n,r,i){const{cache:o,strategies:s}=e,a={warned:t,warn:e.warn};if(0===o.fieldCount)return;if(!1!==i&&!function(e,t){for(const n of e.values())if(ye(n.owner,t))return!0;return!1}(o,i))return;const l=function(e,t,n,r){const i=xe(e,t,n,Ne(e,n,r));return e=>"none"!==i(e)}(o,r,i,s);for(const[e,t]of Object.entries(n)){if(Le.has(e))continue;if(Ar(t)){Sr(a,l,e,r,t);continue}if(!Tr(t)||l(e)||kr(t))continue;const n=Pe(e,r);for(const[e,i]of Object.entries(t))Ar(i)&&!Le.has(e)&&Sr(a,l,`${n}.${e}`,r,i)}if("declared"!==e.subfieldCoverage)return void function(e,t,n,r,i){if("undefined"!=typeof __LEAN_BUILD__&&__LEAN_BUILD__)return;if(!e.coverageByDefault||t.has(wr)||!isDevMode())return;t.add(wr);const[o]=Ee(e.cache,n,r,i,e.strategies);void 0!==o&&e.warn(`[live-preview] LP0204: no binding names "${o.path}", and a binding elsewhere in its group covers it, so an edit there changes nothing on the page. 3.0 makes subfieldCoverage: 'declared' the default, where it refreshes the route. Set the option to choose now.`)}(e,t,n,r,i);const u=Ee(o,n,r,i,s);for(const{path:e,value:t}of u)if(Ar(t)&&Sr(a,l,e,r,t),Tr(t)&&!kr(t))for(const[n,i]of Object.entries(t))Ar(i)&&Sr(a,l,`${e}.${n}`,r,i)}(r,i.warnedOrphanFields,e.rawData,e.locale,a),s()){if(null!==h&&h.boundaries.length>0){for(const t of h.boundaries)e.fragmentBoundariesRun.add(t);e.pendingFragments+=h.boundaries.length,this.strategies.runFragments(e,t,h)}!o&&s()&&0===g&&(0===e.pendingFragments&&0===r.scheduler.pendingCount&&(i.complete(e),this.revealPending(e)),this.notifyIslands(e,t))}}notifyIslands(e,t){0!==e.touched.size&&this.navigationReplay.dispatchIslands(e,t,this.deps.cache.islands)}restoreGuesses(e,t){const{deps:n,state:r}=this;if("off"!==n.autoBind&&null!==r.autoBindGuesses&&("undefined"==typeof __LEAN_BUILD__||!__LEAN_BUILD__)){const i=vr(n,r,e,t.fields);!function(e,t,n,r,i,o){if(!o())return 0;const s=t.autoBindGuesses,a=hr(e.root);if(null===s||0===s.fields.size||null===a)return 0;const l=new Map(s.values);for(const[e,t]of or(n,r)){if(null===t||!s.fields.has(t.field))continue;const n=l.get(e);void 0===n?l.set(e,t):n?.field!==t.field&&l.set(e,null)}if(!o())return 0;const u=fr(a,l);o()&&gr(e,u,i,"after a server render",o).length}(n,r,t.fields,e.locale,i,()=>r.isCurrent(e))}}onFlush(e){const{deps:t,state:n}=this;n.lastFlush=e,e.deferred>0&&!n.warnedVisibilityGate&&(n.warnedVisibilityGate=!0,t.warn(`[live-preview] LP0301: visibility gate held ${String(e.deferred)} off-screen update(s) until scrolled into view; see visibilityGateThreshold`));const{revision:r,data:i}=e;if(void 0===r)return;const o=n.activeUpdate;if(null===o||!n.isCurrent(o)||!y(o.revision,r))return;n.display.deferred(o,e.deferred),0===o.pendingFragments&&n.complete(o);const s=()=>n.isCurrent(o)&&y(o.revision,r),a=i??o.renderData;if(this.revealPending(o),!s())return;const l=n.unfaithfulPatches;if(l.length>0){if(n.unfaithfulPatches=[],void 0!==a){const e=vr(t,n,o,a.fields);this.strategies.escalateUnfaithful(o,a,l,e)}if(!s())return}void 0!==i&&(e.applied>0&&t.a11y?.announceUpdate(e.applied),s()&&(this.notifyIslands(o,i),s()&&0!==e.applied&&0!==t.emitter.listenerCount("afterUpdate")&&t.emitter.emitWhile("afterUpdate",{data:i,updatedCount:e.applied,durationMs:e.durationMs,revision:r.revision,receivedAt:o.receivedAt,source:"patch"},s)))}revealPending(e){const t=this.state.revealLedger.commit(e);if(void 0!==t)try{Xe(this.state.revealer,t)}catch(e){this.deps.log("reveal",e)}}revealField(e){const t=this.deps.cache.get(e)?.[0];return void 0===t?"no-element":Xe(this.state.revealer,t)}documentSaved(){this.strategies.refreshAfterSave()}},Ji=class{apply;debounceMs;maxWaitMs;isVisible;gateThresholdValue;gateDisabled;getCacheSize;onFlush;scheduleFrame;cancelFrame;pending=/* @__PURE__ */new Map;replay=/* @__PURE__ */new Map;activeFlushes=/* @__PURE__ */new Set;debounceTimer=null;debounceToken=0;deadlineTimer=null;frameHandle=null;frameFallback=null;frameToken=0;windowUntil=0;activeRevision=null;activeRevisionCancelled=!1;destroying=!1;constructor(e,t){this.apply=e,this.debounceMs=t.debounceMs??50,this.maxWaitMs=t.maxWaitMs??4*this.debounceMs,this.isVisible=t.isVisible,this.gateThresholdValue=t.visibilityGateThreshold??50,this.gateDisabled=t.disableVisibilityGate??!1,this.getCacheSize=t.getCacheSize,this.onFlush=t.onFlush,this.scheduleFrame=t.scheduleFrame??("function"==typeof requestAnimationFrame?requestAnimationFrame.bind(globalThis):e=>setTimeout(()=>{e(performance.now())},0)),this.cancelFrame=t.cancelFrame??("function"==typeof cancelAnimationFrame?cancelAnimationFrame.bind(globalThis):e=>{clearTimeout(e)})}schedule(e){if(this.destroying)return;if(void 0!==e.revision){if(this.activeRevisionCancelled)return;if(null===this.activeRevision||!y(e.revision,this.activeRevision))return}const 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){var t,n;this.destroying||null!==this.activeRevision&&y(e,this.activeRevision)||null!==this.activeRevision&&(t=e,n=this.activeRevision,(t.generation!==n.generation?t.generation-n.generation:t.revision-n.revision)<0)||(this.clearWork(),this.activeRevision=e,this.activeRevisionCancelled=!1,this.cancelScheduledWork())}cancelRevision(e){null!==this.activeRevision&&y(e,this.activeRevision)&&(this.clearWork(),this.activeRevisionCancelled=!0,this.cancelScheduledWork())}flushNow(){return this.cancelScheduledWork(),this.flush()}notifyVisible(e){const t=this.replay.get(e);if(!t)return;if(this.replay.delete(e),!this.isCurrent(t))return;const n=performance.now(),r=this.didApply(t)?1:0;this.onFlush?.(this.statsFor(t,r,0,performance.now()-n,1===r?[t.target.fieldName]:[]))}retarget(e){this.retargetBuffer(this.pending,e),this.retargetBuffer(this.replay,e);for(const t of this.activeFlushes)this.retargetBuffer(t,e)}forget(e){this.pending.delete(e),this.replay.delete(e);for(const t of this.activeFlushes)t.delete(e)}destroy(){if(!this.destroying){this.destroying=!0;try{this.clearWork(),this.activeRevision=null,this.activeRevisionCancelled=!1,this.windowUntil=0,this.cancelScheduledWork()}finally{this.destroying=!1}}}get pendingCount(){return this.pending.size}get replayCount(){return this.replay.size}get gateThreshold(){return this.gateThresholdValue}get gateActive(){return!this.gateDisabled&&this.getCacheSize()>this.gateThresholdValue}armDebounce(){const e=Date.now(),t=e>=this.windowUntil;if(this.windowUntil=e+this.debounceMs,t)return void this.requestFrame();const n=this.debounceToken+=1,r=this.debounceTimer;if(this.debounceTimer=null,null!==r&&clearTimeout(r),this.debounceToken!==n)return;const i=setTimeout(()=>{this.debounceToken===n&&(this.debounceTimer=null,this.pending.size>0&&this.requestFrame())},this.debounceMs);this.debounceToken===n&&(this.debounceTimer=i),null===this.deadlineTimer&&this.maxWaitMs>this.debounceMs&&(this.deadlineTimer=setTimeout(()=>{this.deadlineTimer=null,this.pending.size>0&&this.requestFrame()},this.maxWaitMs))}requestFrame(){const e=this.frameToken+=1,t=this.frameHandle;if(this.frameHandle=null,this.clearFrameFallback(),null!==t&&this.cancelFrame(t),this.frameToken!==e)return;let n=!1;const r=()=>{if(this.frameToken!==e||n)return;n=!0;const t=this.frameHandle;this.frameHandle=null,this.clearFrameFallback(),null!==t&&this.cancelFrame(t),this.flush()},i=this.scheduleFrame(r);n||this.frameToken!==e||(this.frameHandle=i,this.frameFallback=setTimeout(r,100))}clearFrameFallback(){clearTimeout(this.frameFallback??void 0),this.frameFallback=null}flush(){const e=performance.now();this.clearDeadline();const t=this.gateActive,n=this.pending;this.pending=/* @__PURE__ */new Map;let r=0;const i=[];let o,s=0;this.activeFlushes.add(n);try{for(const e of n.values()){if(!this.isCurrent(e))continue;const n=!t||this.isVisible(e.target.element)||Ki(e.target);this.isCurrent(e)&&(o??=e,n?(this.replay.delete(e.target.element),this.didApply(e)&&(r+=1,i.push(e.target.fieldName))):(this.replay.set(e.target.element,e),s+=1))}}finally{this.activeFlushes.delete(n)}const a=this.statsFor(o,r,s,performance.now()-e,i);return this.onFlush?.(a),a}isCurrent(e){return void 0===e.revision||!this.activeRevisionCancelled&&null!==this.activeRevision&&y(e.revision,this.activeRevision)}didApply(e){return!1!==this.apply(e)||(t=this.apply,!ne.has(t));var t}retargetBuffer(e,t){const n=e.get(t.element);void 0!==n&&(Zt(n.target,t)?n.target=t:e.delete(t.element))}clearWork(){this.pending.clear(),this.replay.clear();for(const e of this.activeFlushes)e.clear()}statsFor(e,t,n,r,i){return{applied:t,appliedFields:i,deferred:n,durationMs:r,...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(){const e=this.debounceTimer,t=this.frameHandle;this.debounceToken+=1,this.frameToken+=1,this.debounceTimer=null,this.frameHandle=null,this.clearDeadline(),this.clearFrameFallback(),null!==e&&clearTimeout(e),null!==t&&this.cancelFrame(t)}};function Ki(e){if(!0!==e.hidesWhenEmpty)return!1;const{element:t}=e;if(t.hasAttribute("hidden"))return!0;const n=t.getBoundingClientRect();return 0===n.width||0===n.height}var Xi=[0,500,1e3,2e3],Qi=class{deps;state=new tt;pipeline;writer;rootSentinel=null;scope=null;closingSession=!1;observedRoot=null;replayRetainedOnStart=!1;constructor(e){const{emitter:t,renderers:n}=e,r=void 0===e.log?S:w(e.log),i=void 0===e.warn?k:w(e.warn),o=e.root??("undefined"!=typeof document?document:void 0);if(void 0===o)throw new Error("LivePreviewRuntime: no document; pass options.root");const s=new Yt({filter:e=>!isInsideIsland(e)}),a=new Nn({onStructuralChange:()=>{this.rebuildCache()},onIslandHydrated:e=>{this.pipeline.reapplyNavigationIslands([e],!0)},onVisibilityChange:(e,t)=>{t&&l.notifyVisible(e)}},void 0!==e.intersectionRootMargin?{intersectionRootMargin:e.intersectionRootMargin}:{}),l=new Ji(re(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=>a.isVisible(e),getCacheSize:()=>s.elementCount,onFlush:e=>{this.pipeline.onFlush(e)}}),u=new b(e.originMatcher,{onUpdate:(e,t,n)=>{this.pipeline.handleUpdate(e,t,n)},onReplay:(e,t,n)=>{this.pipeline.handleReplay(e,t,n)},onDocumentEvent:()=>{this.state.protocol.observe(["document-events"],r,i),t.emit("documentSave",{timestamp:Date.now()}),this.pipeline.documentSaved()},onFocusField:e=>{this.deps.revealEditedField&&this.pipeline.revealField(e)},onInvalid:(e,n)=>{if("token"===e){const e=new Error(`Preview token rejected (origin: ${n})`);t.emit("error",{error:e,context:"token",code:"LP0502"})}"shape"!==e&&"type"!==e||this.state.warnedProtocolShape||(this.state.warnedProtocolShape=!0,i(`[live-preview] LP0503: ${n} 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,i(`[live-preview] LP0501: a message from ${n} 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.`)),r("LP0501 message rejected:",e,n)},...void 0!==e.validateToken?{validateToken:e.validateToken}:{},...void 0!==e.eventSourcePolicy?{sourcePolicy:e.eventSourcePolicy}:{}}),d=e.dataMerge;this.deps={emitter:t,cache:s,observers:a,scheduler:l,bus:u,connection:new Qn,heartbeat:new Xn({...void 0!==e.heartbeatMs?{timeoutMs:e.heartbeatMs}:{},onTimeout:()=>{this.onHeartbeatTimeout()}}),renderers:n,resolveRenderer:e.resolveRenderer??(e=>n[e]),transformValue:e.transformValue,renderRichText:e.renderRichText,internalLinkPattern:e.internalLinkPattern,routeAfterSave:!0===e.routeAfterSave,sanitizerPolicy:e.sanitizerPolicy,root:o,readyTargets:"function"==typeof e.readyTargets?e.readyTargets:/* @__PURE__ */(e=>()=>e)(e.readyTargets),sendReady:e.sendReady??N,onHeartbeatTimeout:e.onHeartbeatTimeout,log:r,warn:i,a11y:L(e),serverURL:d?.serverURL,merger:void 0===d?null:new An({...d,log:r}),mergeWindowMs:e.debounceMs??50,scopeBindingsByOwner:!0===e.scopeBindingsByOwner,subfieldCoverage:e.subfieldCoverage??"descendant",coverageByDefault:void 0===e.subfieldCoverage,lockedOrigin:e.lockedOrigin??(()=>{}),skipUnchanged:!0===e.skipUnchanged,dependencies:e.dependencies??{},strategies:e.strategies??{},revealEditedField:!0===e.revealEditedField,onUnfaithfulPatch:K(e),autoBind:e.autoBind??"off",hydration:e.hydration},this.writer=new nt(this.deps,this.state),this.pipeline=new Gi(this.deps,this.state,()=>{this.rebuildCache()})}start(){const{state:e}=this;if(e.isRunning()||this.closingSession)return!1;e.suspended&&(this.replayRetainedOnStart=!0),e.started=!0,e.suspended=!1,this.openScope();try{return function(e){"react"===e.hydration?Fn():"vue"===e.hydration&&zn();const{root:t}=e;if(!Jn(t)||"loading"!==t.readyState)return void Hn(e);const n=()=>{e.isRunning()&&e.later(()=>{Hn(e)})};t.addEventListener("DOMContentLoaded",n,{once:!0}),e.defer(()=>{t.removeEventListener("DOMContentLoaded",n)})}(this.startupHost()),!0}catch(e){throw this.rollbackFailedStart(),e}}startupHost(){const{state:e,deps:t}=this;return{root:t.root,hydration:t.hydration,isRunning:()=>e.isRunning(),defer:t=>{e.deferredStart=t,this.scope?.own(()=>{e.deferredStart===t&&(e.deferredStart=null,t())})},later:t=>{e.deferredStart=null;try{t()}catch(e){this.rollbackFailedStart(),this.reportError(e,"startup","LP0605")}},hydrated:t=>{e.hydration=t},warn:t.warn,startNow:()=>{this.startNow()}}}startNow(){const{state:e,deps:t}=this;if(!e.isRunning())return;const n=Jn(t.root)?Kn(t.root):t.root;if(null===n)throw new Error("LivePreviewRuntime: document.body unavailable");if(t.observers.start(n),this.observedRoot=n,this.watchRootReplacement(),this.buildCacheAndObserve(),!e.isRunning())return;if(t.bus.attach(),t.emitter.emitWhile("init",{timestamp:Date.now()},()=>e.isRunning()),!e.isRunning())return;const r=this.replayRetainedOnStart;this.replayRetainedOnStart=!1;const i=r&&t.heartbeat.resume();if(e.isRunning()&&(!r||i||(e.forgetOwedWork(),e.merges.resetRawChanges(),e.unfaithfulPatches=[],e.revealer.reset(),e.lastAppliedIdentity=/* @__PURE__ */new WeakMap,e.changes.reset(),e.navigationReplayPending=!0,t.bus.replayLastAccepted()||(e.navigationReplayPending=!1),e.isRunning())))for(const n of Xi){if(!e.isRunning())return;0===n?t.sendReady(t.readyTargets()):e.readyTimers.push(setTimeout(()=>{e.isRunning()&&this.sendReadyAfterStart()},n))}}suspend(){if(!this.state.isRunning())return!1;const e=this.release();return this.state.suspended=!0,e&&this.deps.emitter.emit("disconnect",{reason:"unload",timestamp:Date.now()}),!0}destroy(){const{state:e,deps:t}=this;if(!e.isRunning()&&!e.suspended)return;const n=!!e.isRunning()&&this.release();e.suspended=!1,this.replayRetainedOnStart=!1,t.bus.forgetLastAccepted(),n&&t.emitter.emit("disconnect",{reason:"destroy",timestamp:Date.now()}),t.a11y?.detach(),t.emitter.emit("destroy",{timestamp:Date.now()})}openScope(){const{state:e,deps:t}=this,n=new En(t.log);n.own(()=>{t.merger?.destroy(),e.merges.destroy()}),n.own(()=>{t.scheduler.destroy()}),n.own(()=>{t.observers.stop()}),n.own(()=>{this.rootSentinel?.disconnect(),this.rootSentinel=null,this.observedRoot=null}),n.own(()=>{e.abortStrategies()}),n.own(()=>{t.bus.detach()}),n.own(()=>{t.heartbeat.stop()}),n.own(()=>{for(const t of e.readyTimers)clearTimeout(t);e.readyTimers.length=0}),this.scope=n}release(){const{state:e,deps:t}=this;e.display.end(),e.activeUpdate=null,e.navigationBindingReplay=!1,e.started=!1;const n=this.scope;this.scope=null,this.closingSession=!0;try{n?.close()}finally{this.closingSession=!1}return t.cache.clear(),t.connection.markDisconnected()}rollbackFailedStart(){this.release();try{this.deps.a11y?.detach()}catch(e){this.deps.log("runtime cleanup failed:",e)}}refreshCache(){this.state.isRunning()&&(this.state.revealer.reset(),this.followReplacedRoot()||this.rebuildCache())}navigationCommit(){const{state:e,deps:t}=this;e.isRunning()&&null===e.deferredStart&&(this.cancelActiveUpdate(!0),t.merger?.destroy(),e.merges.destroy(),e.abortStrategies(),this.cancelActiveUpdate(!0),e.forgetOwedWork(),e.merges.resetRawChanges(),e.unfaithfulPatches=[],e.revealer.reset(),e.lastAppliedIdentity=/* @__PURE__ */new WeakMap,e.changes.reset(),e.isRunning()&&(t.bus.advanceGeneration(),e.navigationReplayPending=!0,this.followReplacedRoot()||this.rebuildCache(),e.isRunning()&&(t.bus.replayLastAccepted(),e.isRunning()&&this.sendReadyAfterStart())))}watchRootReplacement(){const{root:e}=this.deps;Jn(e)&&"undefined"!=typeof MutationObserver&&(this.rootSentinel?.disconnect(),this.rootSentinel=new MutationObserver(()=>{this.followReplacedRoot()}),this.rootSentinel.observe(e.documentElement,{childList:!0}))}followReplacedRoot(){const{root:e}=this.deps;if(!this.state.isRunning()||!Jn(e))return!1;const t=Kn(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(t,n){const{cache:r,scheduler:i}=t,o=n.protocol.negotiation,s=n.activeUpdate,a=n.lastFlush,l=[],u=/* @__PURE__ */new Set,d=[];for(const[e,t]of r.entries()){l.push(e);for(const n of t)void 0!==n.owner&&u.add(n.owner),void 0!==n.guessed&&d.push({field:e,matched:n.guessed,attribute:n.targetAttribute??("IMG"===n.element.tagName?"src":void 0)})}return{version:e,started:n.started,status:t.connection.status,origins:{trusted:[...t.readyTargets()],locked:t.lockedOrigin()},protocol:{ours:o.ours,theirs:o.theirs,negotiated:o.negotiated,capabilities:[...o.capabilities].sort(),observed:[...o.observed].sort(),profile:detectProtocolProfile(o.observed).name},revisions:{accepted:n.updateCount,superseded:n.supersededCount,completed:n.completedCount,skippedUnchanged:n.skippedUnchangedCount,active:null===s?void 0:s.revision.revision,display:n.display.snapshot()},bindings:{elements:r.elementCount,fields:r.fieldCount,fieldNames:l.sort(),absentFields:[...n.absentFields].sort(),orphanFields:[...n.warnedOrphanFields].sort(),ownerScoped:t.scopeBindingsByOwner,owners:[...u].sort(),guessed:d.sort((e,t)=>e.field.localeCompare(t.field)),autoBind:{mode:t.autoBind,searchMs:n.autoBindSearchMs}},route:{handler:void 0!==t.strategies.route,...n.routeStats},fidelity:{mode:t.onUnfaithfulPatch,canEscalate:void 0!==t.strategies.fragment||void 0!==t.strategies.route,unfaithful:n.unfaithfulCount,escalated:n.escalatedCount,fields:[...n.unfaithfulFields].sort()},hydration:{mode:t.hydration??"off",state:n.hydration},fragments:{handler:void 0!==t.strategies.fragment,inFlight:s?.pendingFragments??0,...n.fragmentStats},scheduler:{pending:i.pendingCount,deferred:i.replayCount,visibilityGateThreshold:i.gateThreshold,visibilityGateActive:i.gateActive,lastFlush:null===a?void 0:{applied:a.applied,appliedFields:a.appliedFields,deferred:a.deferred,durationMs:a.durationMs}},plugins:[],renderers:Object.keys(t.renderers).sort()}}(this.deps,this.state)}buildCacheAndObserve(){const{state:e,deps:t}=this;if(!e.isRunning())return;const n=t.cache.buildFromRoot(t.root);if(t.log("cache",n),e.isRunning()&&(t.emitter.emitWhile("cacheRefresh",n,()=>e.isRunning()),e.isRunning()))for(const n of t.cache.values()){if(!e.isRunning())return;t.observers.observeElement(n.element)}}rebuildCache(){const{state:e,deps:t}=this;if(!e.isRunning())return;const n=/* @__PURE__ */new Map,r=t.cache.islandOwners,i=new Set(t.cache.navigationReplayRoots);for(const e of t.cache.values())n.set(e.element,e),t.observers.unobserveElement(e.element);if(this.buildCacheAndObserve(),!e.isRunning())return;const o=new Set(t.cache.navigationReplayRoots.filter(e=>!i.has(e)));for(const e of t.cache.values()){const r=n.get(e.element);void 0!==r&&Zt(r,e)?t.scheduler.retarget(e):(t.scheduler.forget(e.element),o.add(e.element)),n.delete(e.element)}for(const e of n.values())t.scheduler.forget(e.element);o.size>0&&this.pipeline.reapplyNavigationBindings(o);const s=t.cache.islands.filter(e=>!r.has(e)||t.scopeBindingsByOwner&&r.get(e)!==t.cache.islandOwners.get(e));s.length>0&&this.pipeline.reapplyNavigationIslands(s)}onHeartbeatTimeout(){const{state:e,deps:t}=this;if(!e.isRunning())return;if(this.cancelActiveUpdate(!1),t.merger?.destroy(),e.merges.destroy(),e.abortStrategies(),this.cancelActiveUpdate(!1),!e.isRunning())return;t.bus.advanceGeneration(),t.bus.forgetLastAccepted(),e.navigationBindingReplay=!1;const n=t.connection.markDisconnected();try{t.onHeartbeatTimeout?.()}catch(e){t.log("heartbeat:",e)}if(e.isRunning()){if(n&&this.isIdleDisconnected()){if(t.a11y?.announceDisconnected(),t.emitter.emitWhile("disconnect",{reason:"timeout",timestamp:Date.now()},()=>this.isIdleDisconnected()),!e.isRunning())return;if(this.isIdleDisconnected()&&t.log("connection","connected","→","disconnected"),!e.isRunning())return}this.sendReadyAfterStart()}}cancelActiveUpdate(e){const{state:t,deps:n}=this,r=t.activeUpdate;t.display.end(),t.activeUpdate=null,null!==r&&(r.cancelled=!0,n.scheduler.cancelRevision(r.revision),e&&!r.completed&&r.countsAsUpdate&&(t.supersededCount+=1))}sendReadyAfterStart(){try{this.deps.sendReady(this.deps.readyTargets())}catch(e){this.reportError(e,"ready","LP0606")}}reportError(e,t,n){const r=e instanceof Error?e:new Error(String(e));this.deps.emitter.emit("error",{error:r,context:t,code:n})}isIdleDisconnected(){return this.state.isRunning()&&"disconnected"===this.deps.connection.status&&null===this.state.activeUpdate}},EventEmitter=class{#o=/* @__PURE__ */new Map;#s=/* @__PURE__ */new Map;on(e,t){return this.#a(this.#o,e,t)}once(e,t){return this.#a(this.#s,e,t)}off(e,t){this.#l(this.#o,e,t),this.#l(this.#s,e,t)}async emit(e,t){await this.#u(e,t)}async emitWhile(e,t,n){return this.#u(e,t,n)}async#u(e,t,n){const r=()=>n?.()??!0;if(!r())return!1;const i=this.#o.get(e);if(i)for(const n of[...i]){if(!r())return!1;if(await this.#d(n,t,e),!r())return!1}if(!r())return!1;const o=this.#s.get(e);if(o&&o.size>0){const n=[...o];this.#s.delete(e);for(const i of n){if(!r())return!1;if(await this.#d(i,t,e),!r())return!1}}return r()}listenerCount(e){return(this.#o.get(e)?.size??0)+(this.#s.get(e)?.size??0)}removeAllListeners(e){if(void 0===e)return this.#o.clear(),void this.#s.clear();this.#o.delete(e),this.#s.delete(e)}eventNames(){const e=/* @__PURE__ */new Set;for(const t of this.#o.keys())e.add(t);for(const t of this.#s.keys())e.add(t);return[...e]}#a(e,t,n){let r=e.get(t);return r||(r=/* @__PURE__ */new Set,e.set(t,r)),r.add(n),()=>{this.#l(e,t,n)}}#l(e,t,n){const r=e.get(t);void 0!==r&&(r.delete(n),0===r.size&&e.delete(t))}async#d(e,t,n){try{await e(t)}catch(e){const t="string"==typeof n||"number"==typeof n?String(n):"<event>";A(`[live-preview] LP0601: handler for "${t}" threw:`,e)}}},Zi=/^https?:\/\/(localhost|127\.0\.0\.1)(?::\d+)?$/i,Yi=/^https?:\/\/[^/?#\s]+$/i,eo=[3e3,3001,3333,4e3,4321,5e3,5173,5174,8e3,8080,8888,9e3];function to(){if("undefined"==typeof location)return;const e=location.ancestorOrigins;return e?.[0]}var OriginDetector=class{#c;constructor(e={}){const t=/* @__PURE__ */new Set;for(const n of e.additionalOrigins??[]){const e=no(n);void 0!==e&&t.add(e)}let n;if(e.enableReferrerDetection??1){const t=e.referrer??("undefined"!=typeof document?document.referrer:"");if(t.length>0)try{const e=new URL(t).origin;e&&"null"!==e&&(n=e)}catch{}}const r=(e.enableLocalhostMatching??!0)&&(e.forceDevMode??isDevMode());this.#c=[t,n,r,void 0!==n,void 0,to()]}matches(e){return 0!==e.length&&"null"!==e&&(void 0!==this.#c[4]?e===this.#c[4]:!!this.#c[0].has(e)||0===this.#c[0].size&&void 0!==this.#c[1]&&e===this.#c[1]||!(!this.#c[2]||!Zi.test(e)))}lockOrigin(e){return!!this.matches(e)&&(this.#c[4]=e,!0)}unlockOrigin(){const e=this.#c[4];return this.#c[4]=void 0,e}get lockedOrigin(){return this.#c[4]}enumerate(){if(void 0!==this.#c[4])return[this.#c[4]];const e=new Set(this.#c[0]);0===this.#c[0].size&&void 0!==this.#c[1]&&e.add(this.#c[1]);const t=this.#c[5];if(this.#c[2]&&void 0!==t)Zi.test(t)&&e.add(t);else if(this.#c[2])for(const t of eo)e.add(`http://localhost:${String(t)}`),e.add(`http://127.0.0.1:${String(t)}`);return[...e]}get referrerWasAvailable(){return this.#c[3]}get isProductionUnconfigured(){return!(!isInIframe()||this.#c[0].size>0||this.#c[2]||void 0!==this.#c[1])}get isReferrerOnlyTrust(){return!(this.#c[0].size>0||this.#c[2]||void 0===this.#c[1])}};function no(e){const t=e.trim();if(0!==t.length)try{const e=new URL(t);if("http:"!==e.protocol&&"https:"!==e.protocol)return;if(!Yi.test(e.origin))return;return e.origin}catch{return}}var ro=()=>{},io=class{#f;#n;#h=/* @__PURE__ */new Set;#c="staging";constructor(e,t){this.#f=e,this.#n=t}assertOpen(){if("closed"===this.#c)throw new Error(`Plugin context for "${this.#f}" is no longer active`)}get active(){return"active"===this.#c}eligible(){return"closed"!==this.#c}own(e){return this.assertOpen(),this.#p({kind:"cleanup",acquire:void 0,finalize:void 0,cleanup:e,disposed:!1})}stage(e,t,n){this.assertOpen();const r={kind:e,acquire:t,finalize:n,cleanup:void 0,disposed:!1},i=this.#p(r);if("active"===this.#c)try{this.#g(r)}catch(e){throw this.#m(r),e}return i}counts(){const e={transform:0,renderer:0,subscription:0,cleanup:0};for(const t of this.#h)e[t.kind]+=1;return e}commit(){if("staging"!==this.#c)throw new Error(`Plugin context for "${this.#f}" cannot be committed`);this.#c="committing";try{for(const e of this.#h)this.#g(e);this.#c="active"}catch(e){throw this.close(),e}}close(){if("closed"!==this.#c){this.#c="closed";for(const e of[...this.#h].reverse())this.#m(e);this.#h.clear()}}#p(e){return this.#h.add(e),()=>{this.#m(e)}}#g(e){if(e.disposed||void 0!==e.cleanup||void 0===e.acquire)return;const t=e.acquire();e.cleanup=t??ro}#m(e){if(e.disposed)return;e.disposed=!0,this.#h.delete(e);const t=e.cleanup;if(e.cleanup=void 0,void 0!==t)try{v(t())&&this.#n(`plugin "${this.#f}" cleanup returned a Promise/thenable; cleanups must be synchronous`)}catch(e){this.#n(`plugin "${this.#f}" cleanup failed:`,e)}try{e.finalize?.()}catch(e){this.#n(`plugin "${this.#f}" cleanup failed:`,e)}}},oo=class{#v;#y;#b=/* @__PURE__ */new Set;constructor(e,t){this.#v=e,this.#y=t}on(e,t){return this.#w("on",e,t)}once(e,t){return this.#w("once",e,t)}off(e,t){const n=t;for(const t of[...this.#b])t.event===e&&t.handler===n&&t.dispose()}emit(e,t){return this.#y.assertOpen(),this.#v.emit(e,t)}emitWhile(e,t,n){return this.#y.assertOpen(),this.#v.emitWhile(e,t,()=>{if(!this.#y.eligible())return!1;const e=n();return!!this.#y.eligible()&&e})}listenerCount(e){let t=0;for(const n of this.#b)n.event===e&&(t+=1);return t}removeAllListeners(e){for(const t of[...this.#b])void 0!==e&&t.event!==e||t.dispose()}eventNames(){const e=/* @__PURE__ */new Set;for(const t of this.#b)e.add(t.event);return[...e]}#w(e,t,n){this.#y.assertOpen();const r=n,i=[...this.#b].find(n=>n.kind===e&&n.event===t&&n.handler===r);if(void 0!==i)return i.dispose;let o=ro,s=!0;const a=async t=>{this.#y.active&&s&&("once"===e&&o(),await n(t))},l={kind:e,event:t,handler:r,dispose:ro};return o=this.#y.stage("subscription",()=>this.#v[e](t,a),()=>{s=!1,this.#b.delete(l)}),l.dispose=o,this.#b.add(l),o}},so=class{#v;#S;#A;#k;#n;#T=/* @__PURE__ */new Map;#C=/* @__PURE__ */new Map;#R=/* @__PURE__ */new Map;#$=/* @__PURE__ */new Set;#L=/* @__PURE__ */new Map;#N=Promise.resolve();#P=0;constructor(e){this.#v=e.events,this.#S=e.config,this.#A=e.registerFieldRenderer,this.#n=w(e.log);const t=e.onTransformError;this.#k=void 0===t?void 0:w((...e)=>{const n=e[0];try{return t(n)}catch(e){return void this.#n("transform error reporter failed:",e)}})}register(e){return this.#P>0?this.#x(e,!1):this.#E(()=>this.#x(e,!0))}unregister(e){return this.#P>0?this.#M(e,!1):this.#E(async()=>{await this.#M(e,!0)})}destroyAll(){return this.#P>0?this.#O(!1):this.#E(async()=>{await this.#O(!0)})}applyTransforms(e,t,n,r){const i=this.#L.get(e);if(void 0===i||0===i.length)return t;let o=t;for(const s of[...i]){if(!s.active)continue;const{transform:i}=s;if(!1===r?.())return t;try{o=i(o,{fieldName:e,element:n.element,allFields:n.allFields});const s=v(o);if(!1===r?.())return t;if(s)throw new TypeError(`Transform for "${e}" returned a Promise/thenable; transforms must be synchronous`)}catch(n){if(!1===r?.())return t;const i=n instanceof Error?n:new Error(String(n));return this.#n(`transform for "${e}" failed:`,i),this.#k?.(i),t}}return o}list(){return[...this.#T.keys()]}snapshot(){const e=[],t=(e,t,n,r)=>{const i=r.counts();return{name:e,version:t,state:n,registrations:{transforms:i.transform,renderers:i.renderer,subscriptions:i.subscription,cleanups:i.cleanup}}};for(const[n,r]of this.#C)e.push(t(n,void 0,"initializing",r.scope));for(const[n,r]of this.#T)e.push(t(n,r.plugin.version,"active",r.scope));for(const t of this.#R.keys())e.push({name:t,version:void 0,state:"tearing-down",registrations:{transforms:0,renderers:0,subscriptions:0,cleanups:0}});return e}get size(){return this.#T.size}async#x(t,n){if(this.#T.has(t.name)||this.#C.has(t.name)||this.#R.has(t.name))return void this.#n(`plugin "${t.name}" already registered`);const r=function(e,t){if(void 0!==e){if(void 0!==e.runtime&&!function(e,t){const n=function(e){const t=/^v?(\d+)\.(\d+)\.(\d+)/.exec(e.trim());if(null!==t)return[Number(t[1]),Number(t[2]),Number(t[3])]}(e);return void 0!==n&&t.split("||").some(e=>{const r=e.trim().split(/\s+/).filter(e=>e.length>0);return 0===r.length?""===e.trim()&&""===t.trim():r.every(e=>function(e,t){const n=t.trim();if(""===n||"*"===n)return!0;const r=/^(\^|~|>=|<=|>|<|=)?\s*v?(\d+)\.(\d+)\.(\d+)/.exec(n);if(null===r)return!1;const i=r[1]??"=",o=[Number(r[2]),Number(r[3]),Number(r[4])],s=function(e,t){for(let n=0;n<3;n+=1){const r=(e[n]??0)-(t[n]??0);if(0!==r)return r}return 0}(e,o);switch(i){case"=":return 0===s;case">":return s>0;case">=":return s>=0;case"<":return s<0;case"<=":return s<=0;case"~":return s>=0&&e[0]===o[0]&&e[1]===o[1];case"^":return!(s<0)&&(o[0]>0?e[0]===o[0]:o[1]>0?0===e[0]&&e[1]===o[1]:0===e[0]&&0===e[1]&&e[2]===o[2]);default:return!1}}(n,e))})}(t,e.runtime))return`declares runtime ${e.runtime}, this runtime is ${t}`;if(void 0!==e.protocol){if(!Number.isInteger(e.protocol)||e.protocol<1)return`declares an invalid protocol version ${String(e.protocol)}`;if(e.protocol<4)return`declares protocol ${String(e.protocol)}, this runtime speaks ${String(4)}`}}}(t.compat,e);if(void 0!==r)return void this.#F(t.name,r);const i=new io(t.name,this.#n),o=this.#U(t.name,i),s={scope:i,cancelled:!1};this.#C.set(t.name,s);try{if(await this.#I(()=>t.init(o),n),s.cancelled)return;i.commit()}catch(e){return i.close(),void(s.cancelled||this.#n(`plugin "${t.name}" init failed:`,e))}finally{this.#C.get(t.name)===s&&this.#C.delete(t.name)}this.#T.set(t.name,{plugin:t,scope:i}),this.#n(`plugin "${t.name}" registered`)}#F(e,t){const n=`plugin "${e}" refused: ${t}`;this.#n(n),this.#v.emit("error",{error:new Error(n),context:"plugin",code:"LP0103"})}#U(e,t){return{events:new oo(this.#v,t),registerFieldRenderer:e=>{t.stage("renderer",()=>{const t=this.#A(e);return"function"==typeof t?t:void 0})},registerTransform:(e,n)=>{const r={transform:n,active:!1};t.stage("transform",()=>{r.active=!0;const t=this.#L.get(e);return void 0===t?this.#L.set(e,[r]):t.push(r),()=>{r.active=!1;const t=this.#L.get(e);if(void 0===t)return;const n=t.indexOf(r);n>=0&&t.splice(n,1),0===t.length&&this.#L.delete(e)}})},registerCleanup:e=>{t.own(e)},getConfig:()=>this.#S,log:(...t)=>{this.#n(`[${e}]`,...t)}}}#M(e,t){const n=this.#C.get(e);if(void 0!==n)return n.cancelled=!0,n.scope.close(),Promise.resolve();const r=this.#R.get(e);if(void 0!==r)return this.#$.has(e)?Promise.resolve():t?this.#_(r):r;const i=this.#T.get(e);if(void 0===i)return Promise.resolve();this.#T.delete(e),i.scope.close();const o=Promise.resolve().then(()=>this.#D(e,i.plugin,t));return this.#R.set(e,o),o.then(()=>{this.#R.get(e)===o&&this.#R.delete(e)}),o}async#D(e,t,n){if(void 0!==t.destroy){this.#$.add(e);try{await this.#I(()=>t.destroy?.(),n)}catch(t){this.#n(`plugin "${e}" destroy failed:`,t)}finally{this.#$.delete(e)}}}async#O(e){for(const e of this.#C.values())e.cancelled=!0,e.scope.close();const t=[...this.#T.keys()];for(const n of t)await this.#M(n,e)}async#I(e,t){t?await this.#_(Promise.resolve().then(e)):await e()}async#_(e){this.#P+=1;try{await e}finally{this.#P-=1}}#E(e){const t=this.#N.then(e);return this.#N=t.catch(e=>{this.#n("plugin manager mutation failed:",e)}),t}},ao=class{#j;#B;#z=/* @__PURE__ */new Map;constructor(e){this.#j=e,this.#B={...e}}get renderers(){return this.#B}resolve(e){return this.#B[e]}register(e){const t=e.name,n={renderer:e},r=this.#z.get(t);void 0===r?this.#z.set(t,[n]):r.push(n),this.#B[t]=e;let i=!0;return()=>{if(!i)return;i=!1;const e=this.#z.get(t);if(void 0===e)return;const r=e.indexOf(n);if(r<0)return;const o=r===e.length-1;if(e.splice(r,1),0===e.length&&this.#z.delete(t),!o)return;const s=e.at(-1),a=s?.renderer??this.#j[t];void 0===a?Reflect.deleteProperty(this.#B,t):this.#B[t]=a}}},lo={1:"left",2:"center",3:"right",4:"justify"},uo=/* @__PURE__ */new Set(["left","center","right","justify","start","end"]);function co(e){const t=e.format;return"string"==typeof t&&uo.has(t)?t:"number"==typeof t?lo[t]:void 0}function fo(e){const t=e.indent;return"number"==typeof t&&t>0?t:0}function ho(e){return"rtl"===e.direction?' dir="rtl"':"ltr"===e.direction?' dir="ltr"':""}function po(e){const t=co(e),n=fo(e),r=[];return void 0!==t&&r.push(`lp-align-${t}`),n>0&&r.push(`lp-indent-${String(n)}`),0===r.length?"":` class="${r.join(" ")}"`}var go=/* @__PURE__ */new Set(["h1","h2","h3","h4","h5","h6"]);function mo(e){return"object"==typeof e&&null!==e?e:void 0}function vo(e){return mo(e)}function yo(e,t){if(void 0===t||""===t||!e.startsWith("/"))return e;try{const n=new URL(t),r=new URL(e,n);return r.origin===n.origin?r.href:e}catch{return e}}function bo(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-").toLowerCase()}function wo(e){return"string"==typeof e&&e.length>0?e:void 0}function So(e){const t=wo(e.title)??wo(e.name)??wo(e.slug);return void 0!==t?t:void 0===e.id?void 0:String(e.id)}var Ao=/\{(slug|id|collection|locale)\}/gu,ko=' target="_blank" rel="noopener noreferrer"',To=(e,t)=>{const n=t.renderChildren(e.children??[]),r=mo(e.fields),i=function(e,t,n){if("internal"===t?.linkType)return function(e,t){const n=mo(e),r=mo(n?.value),i=r?.url;if("string"==typeof i&&i.length>0)return i;const o=void 0===t.internalLinkPattern?void 0:function(e,t){const n=e=>{const n=t[e];return"string"==typeof n&&n.length>0||"number"==typeof n?encodeURIComponent(n):void 0};for(const[,t=""]of e.matchAll(Ao))if(void 0===n(t))return;return e.replace(Ao,(e,t)=>n(t)??"")}(t.internalLinkPattern,{slug:r?.slug,id:void 0===r?n?.value:r.id,collection:n?.relationTo,locale:t.locale});if(void 0!==o)return o;const s=r?.slug;return"string"==typeof s&&s.length>0?`/${s}`:void 0}(t.doc,n);const r=t?.url??e.url;return"string"==typeof r&&r.length>0?r:void 0}(e,r,t);if(void 0===i||!isSafeUrl(i))return n;const o="string"==typeof e.title?` title="${escapeHtml(e.title)}"`:"";return`<a href="${escapeHtmlAttribute(i)}"${function(e,t,n){if(!0===t?.newTab||isExternalHttpUrl(n))return ko;const r="string"==typeof e.target?e.target:"";return""===r?"":"_blank"===r?ko:` target="${escapeHtml(r)}"`}(e,r,i)}${o}>${n}</a>`};function Co(e){if("string"==typeof e.text)return e.text;if(!e.children)return"";let t="";for(const n of e.children)t+=Co(n);return t}function Ro(e){return`${"number"==typeof e.width?` width="${String(e.width)}"`:""}${"number"==typeof e.height?` height="${String(e.height)}"`:""}`}function $o(e){return"string"==typeof e.mimeType?` type="${escapeHtmlAttribute(e.mimeType)}"`:""}var Lo=/* @__PURE__ */new Map;function No(e){return Lo.get(e)}var Po=".lp-block:empty,.lp-inline-block:empty";function xo(e,t,n,r){const i=mo(e.fields)??{},o="string"==typeof i.blockType?i.blockType:"",s=bo(o),a=""===s?r:`${r} ${r}--${s}`;if(""!==o){const e=No(o)??No(s);if(e)return e(i,{renderChildren:t.renderChildren});t.onUnrenderedBlock?.(o,a,i)}return`<${n} class="${a}"></${n}>`}function Eo(e,t){return"number"==typeof t&&t>1?` ${e}="${String(t)}"`:""}var Mo={text:e=>{let t=escapeHtml("string"==typeof e.text?e.text:"");const n="number"==typeof e.format?e.format:0;return!!(16&n)&&(t=`<code>${t}</code>`),!!(1&n)&&(t=`<strong>${t}</strong>`),!!(2&n)&&(t=`<em>${t}</em>`),!!(8&n)&&(t=`<u>${t}</u>`),!!(4&n)&&(t=`<s>${t}</s>`),!!(32&n)&&(t=`<sub>${t}</sub>`),!!(64&n)&&(t=`<sup>${t}</sup>`),!!(128&n)&&(t=`<mark>${t}</mark>`),t},paragraph:(e,t)=>{const n=t.renderChildren(e.children??[]);return`<p${ho(e)}${po(e)}>${n}</p>`},heading:(e,t)=>{const n="string"==typeof e.tag?e.tag.toLowerCase():"h2",r=go.has(n)?n:"h2",i=t.renderChildren(e.children??[]);return`<${r}${ho(e)}${po(e)}>${i}</${r}>`},list:(e,t)=>{const n="string"==typeof e.listType?e.listType:"bullet",r="number"===n?"ol":"ul",i="number"===n&&"number"==typeof e.start&&e.start>1?` start="${String(e.start)}"`:"",o="check"===n?' role="list"':"",s=t.renderChildren(e.children??[]);return`<${r}${ho(e)}${po(e)}${i}${o}>${s}</${r}>`},listitem:(e,t)=>{const n=t.renderChildren(e.children??[]);if("boolean"==typeof e.checked)return`<li role="checkbox" aria-checked="${e.checked?"true":"false"}"${po(e)}>${n}</li>`;const r="number"==typeof e.value?` value="${escapeHtml(String(e.value))}"`:"";return`<li${ho(e)}${po(e)}${r}>${n}</li>`},link:To,autolink:To,quote:(e,t)=>{const n=t.renderChildren(e.children??[]);return`<blockquote${ho(e)}${po(e)}>${n}</blockquote>`},code:e=>{const t=bo("string"==typeof e.language?e.language:"");return`<pre><code${""===t?"":` class="language-${t}"`}>${escapeHtml(Co(e))}</code></pre>`},"code-highlight":e=>{const t="string"==typeof e.text?e.text:"";return`<span${"string"==typeof e.highlightType?` class="token-${bo(e.highlightType)}"`:""}>${escapeHtml(t)}</span>`},linebreak:()=>"<br>",horizontalrule:()=>"<hr>",tab:()=>"\t",upload:e=>{const t=vo(e.value);if(void 0===t)return"";const n=t.url;if("string"!=typeof n||!isSafeUrl(n))return"";const r="string"==typeof t.mimeType?t.mimeType:"";return r.startsWith("video/")?function(e,t){return`<video controls${Ro(e)}><source src="${escapeHtmlAttribute(t)}"${$o(e)}></video>`}(t,n):r.startsWith("audio/")?function(e,t){return`<audio controls><source src="${escapeHtmlAttribute(t)}"${$o(e)}></audio>`}(t,n):""===r||r.startsWith("image/")?function(e,t){const n="string"==typeof e.alt?escapeHtml(e.alt):"";return`<img src="${escapeHtmlAttribute(t)}" alt="${n}"${Ro(e)} loading="lazy" decoding="async">`}(t,n):function(e,t){const n="string"==typeof e.filename?escapeHtml(e.filename):escapeHtml(t);return`<a href="${escapeHtmlAttribute(t)}" target="_blank" rel="noopener noreferrer">${n}</a>`}(t,n)},relationship:e=>{const t="string"==typeof e.relationTo?e.relationTo:"",n=mo(e.value),r=escapeHtml((n&&So(n))??`#${t}`),i=bo(t),o=""===i?' class="lp-relation"':` class="lp-relation lp-relation--${i}"`,s=n?.url;return"string"==typeof s&&isSafeUrl(s)?`<a href="${escapeHtmlAttribute(s)}"${o}>${r}</a>`:`<span${o}>${r}</span>`},block:(e,t)=>xo(e,t,"div","lp-block"),inlineBlock:(e,t)=>xo(e,t,"span","lp-inline-block"),table:(e,t)=>`<table${ho(e)}><tbody>${t.renderChildren(e.children??[])}</tbody></table>`,tablerow:(e,t)=>`<tr>${t.renderChildren(e.children??[])}</tr>`,tablecell:(e,t)=>{const n="number"==typeof e.headerState?e.headerState:0,r=3&n?"th":"td";return`<${r}${1===n?' scope="col"':2===n?' scope="row"':""}${Eo("colspan",e.colSpan)}${Eo("rowspan",e.rowSpan)}>${t.renderChildren(e.children??[])}</${r}>`}},Oo=/* @__PURE__ */new Map,Fo=!1;function Uo(e){if("object"!=typeof e||null===e)return!1;if(!("root"in e))return!1;const t=e.root;return"object"==typeof t&&null!==t&&"children"in t&&Array.isArray(t.children)}function Io(e,t={}){if(!Uo(e))return"";const n=function(e){const t={renderChildren:e=>{let n="";for(const r of e)n+=Do(r,t);return n},resolveAlignment:co,resolveIndent:fo,onUnrenderedBlock:e.onUnrenderedBlock,internalLinkPattern:e.internalLinkPattern,locale:e.locale};return t}(t).renderChildren(e.root.children);return!1===t.sanitize?n:void 0!==t.document?sanitizeHtml(n,{document:t.document}):!0===t.requireDocument||void 0!==ti()?sanitizeHtml(n):(function(){if(!Fo){Fo=!0;try{console.warn('[live-preview] lexicalToHtml() has no sanitizer document and returned unsanitised HTML; pass { document } (linkedom, jsdom) per call. 3.0 throws here instead: opt in now with { requireDocument: true }. See "HTML sanitization" in docs/security.md.')}catch{}}}(),n)}function _o(e){return Uo(e)?e.root.children.map(jo).join("\n").trim():""}function Do(e,t){const n=(r=e.type,Oo.get(r)??Mo[r]);var r;return n?n(e,t):void 0!==e.children?t.renderChildren(e.children):""}function jo(e){if("string"==typeof e.text)return e.text;if("linebreak"===e.type)return"\n";if(void 0===e.children)return"";let t="";for(const n of e.children)t+=jo(n);return t}function Bo(e="text"){const t=/* @__PURE__ */new WeakSet;return{name:e,render:/* @__PURE__ */re((e,n)=>{const r=e.element,i=function(e){return null==e?"":Uo(e)?_o(e):"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):JSON.stringify(e)}(n);if("INPUT"!==r.tagName&&"TEXTAREA"!==r.tagName){if(r.textContent.trim()!==i.trim())return function(e){return null!==e.querySelector(":scope > :not(br)")}(r)&&!r.hasAttribute("data-payload-text")?(function(e,t,n){e.has(t)||(e.add(t),k(`[live-preview] LP0402: Skipping text update for "${n}": <${t.tagName.toLowerCase()}> has structured children. Move data-payload-field to the value element, or add data-payload-text to replace them.`))}(t,r,e.fieldName),!1):void(i.includes("\n")||i.includes("\r")?r.innerHTML=Lr(function(e){return escapeHtml(e).replace(/\r\n|\r|\n/g,"<br>")}(i)):r.textContent=i)}else r.value=i})}}var zo=/* @__PURE__ */new Set,Wo=/* @__PURE__ */new Set,Ho=/* @__PURE__ */new WeakMap,qo=/* @__PURE__ */new Set(["DIV","SECTION","ARTICLE"]),Vo={name:"richText",render:/* @__PURE__ */re((e,t,n)=>{const r=e.element;if(gi(t))return void(r.textContent="");const i=n.sanitizerPolicy;if(void 0!==n.renderRichText){const o=n.renderRichText(t,{fieldName:e.fieldName,element:r,locale:n.locale});return void(r.innerHTML=Lr(Zr(o,i)))}if(Uo(t)){if(it(t))return void(r.textContent="");const o=/* @__PURE__ */new Map,s=[],a=function(e,t){const n=e.cloneNode(!1);n.innerHTML=Lr(t);const r=function(e,t){const n=e.firstElementChild,r=1===t.children.length?t.firstElementChild:null;if(null!==n?.nextElementSibling||0===t.children.length)return null;if(!qo.has(n.tagName)||n.hasAttribute(Tt))return null;if(r?.tagName===n.tagName||!0===r?.matches(Po))return null;for(const e of t.children)if(e.tagName===n.tagName&&e.className===n.className)return null;return n}(e,n)??e,i=/* @__PURE__ */new Map,o=n.querySelectorAll(Po);if(o.length>0&&null!==r.firstElementChild){const e=[];Go(r,n,e);for(const[t,n]of e)t.replaceWith(n),n.matches(Po)||i.set(t.className,!1);for(const e of o)null!==e.parentNode&&i.set(e.className,!0)}return r.replaceChildren(...n.childNodes),i}(r,Zr(Io(t,{sanitize:!1,internalLinkPattern:n.internalLinkPattern,locale:n.locale,onUnrenderedBlock:(e,t,n)=>{o.set(t,e),s.push(n)}}),i));for(const[t,r]of a){const i=o.get(t);void 0!==i&&Jo(e,n,i,r)}return void function(e,t,n,r){const i=function(e){try{return JSON.stringify(e,(e,t)=>"object"==typeof t&&null!==t&&"id"in t&&"updatedAt"in t?t.id:t)}catch{return}}(n),o=Ho.get(e.element);void 0===i?Ho.delete(e.element):Ho.set(e.element,i),void 0!==i&&void 0!==o&&i!==o&&[...r.values()].includes(!1)&&t.reportUnfaithful?.(e,"changed a block no renderer draws")}(e,n,s,a)}if("string"!=typeof t)return!1;r.innerHTML=Lr(Zr(t,i))})};function Go(e,t,n){const r=(e,t)=>{e.matches(Po)?n.push([e,t]):Go(t,e,n)};let i=e.firstElementChild,o=t.firstElementChild;if(e.children.length===t.children.length){for(;null!==i&&null!==o;i=i.nextElementSibling)r(o,i),o=o.nextElementSibling;return}const s=/* @__PURE__ */new Set;for(const e of t.children)e.matches(Po)||s.add(e.tagName);const a=(e,t)=>e.matches(Po)?!s.has(t.tagName):e.tagName===t.tagName;let l=0;for(;null!==i&&null!==o&&a(o,i);l+=1)r(o,i),i=i.nextElementSibling,o=o.nextElementSibling;const u=Math.min(e.children.length,t.children.length);i=e.lastElementChild,o=t.lastElementChild;for(let e=l;e<u&&null!==i&&null!==o;e+=1){if(!a(o,i))return;r(o,i),i=i.previousElementSibling,o=o.previousElementSibling}}function Jo(e,t,n,r){r&&t.reportUnfaithful?.(e,`lost the markup the server drew for block "${n}"`);const i=r?Wo:zo;i.has(n)||(i.add(n),k(`[live-preview] ${r?`LP0413: no renderer for block "${n}", and the markup the server rendered for it is lost.`:`LP0410: no renderer for block "${n}"; keeping what the server rendered for it.`} Register one with registerBlockRenderer().`))}var Ko={name:"html",render(e,t,n){if(gi(t))return void(e.element.textContent="");const r="string"==typeof t?t:pi(t);e.element.innerHTML=Lr(Zr(r,n.sanitizerPolicy))}},Xo=/* @__PURE__ */new WeakSet;function Qo(e,t,n,r){if("string"!=typeof n||0===n.length)return{kind:"none"};const i=yo(n,r);return isSafeUrl(i)?{kind:"safe",url:i}:(Xo.has(e)||(Xo.add(e),k(`[live-preview] LP0401: refused an unsafe URL for "${t}" on <${e.tagName.toLowerCase()}>; the attribute was cleared.`)),{kind:"unsafe"})}function Zo(e,t=e=>e){return{name:e,render(e,n,r){const i=e.element;if(gi(n))return void function(e){"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):e.value=""}(i);const o=pi(n);if("INPUT"!==i.tagName&&"TEXTAREA"!==i.tagName){if("A"===i.tagName){const n=e.hrefField,s=void 0===n||0===n.length?t(o):ae(r.allFields,n,r.locale,void 0!==e.locale),a=Qo(i,e.fieldName,s);"safe"===a.kind?i.setAttribute("href",a.url):"unsafe"===a.kind&&i.removeAttribute("href")}i.textContent=o}else i.value=o}}}var Yo=Zo("url"),es=/^[a-zA-Z][a-zA-Z0-9+.-]*:/,ts=Zo("email",function(e){const t=e.trim();return es.test(t)||!t.includes("@")?t:`mailto:${t}`}),ns=["src","srcset","sizes"],rs=/* @__PURE__ */new WeakMap;function is(e){for(const t of ns)e.removeAttribute(t);os(e)}function os(e){if("PICTURE"===e.parentElement?.tagName)for(const t of e.parentElement.querySelectorAll("source"))t.remove()}function ss(e,t,n,r){const i=function(e,t){const n=[];for(const[r,i]of Object.entries(e?.sizes??e?.variants??{})){if("string"!=typeof i.url||"number"!=typeof i.width)continue;const e=yo(i.url,t);isSafeUrl(e)&&n.push({...i,name:r,url:e,width:i.width})}return n}(n,r),o=e.getAttribute("src"),s=i.find(t=>null!==o&&as(e,t.url,o))??i.find(t=>t.name===rs.get(e));void 0===s?.name?rs.delete(e):rs.set(e,s.name),null!==o&&(as(e,t,o)||i.some(t=>as(e,t.url,o)))||os(e),e.src=s?.url??t;const a=s??n,l=i.filter(e=>ls(e,a)),u=l.length>0?l:i.filter(e=>ls({...e,mimeType:void 0},a));if(0===u.length)return e.removeAttribute("srcset"),void e.removeAttribute("sizes");if("number"==typeof n?.width&&"string"==typeof n.url){const e=yo(n.url,r),t={...n,url:e,width:n.width};isSafeUrl(e)&&ls(t,a)&&u.push(t)}const d=/* @__PURE__ */new Set,c=[];for(const e of u)d.has(e.width)||(d.add(e.width),c.push(`${us(e.url)} ${String(e.width)}w`));const f=c.join(", ");e.setAttribute("srcset",f)}function as(e,t,n){try{return new URL(t,e.baseURI).href===new URL(n,e.baseURI).href}catch{return t===n}}function ls(e,t){if(void 0===t)return!0;if("string"==typeof e.mimeType&&"string"==typeof t.mimeType&&e.mimeType!==t.mimeType)return!1;const{width:n,height:r}=t;return"number"!=typeof n||"number"!=typeof r||"number"!=typeof e.width||"number"!=typeof e.height||Math.abs(e.width*r-e.height*n)<=Math.max(n,e.width)}function us(e){return e.replace(/[\s,]/g,encodeURIComponent)}var ds=/^(?:\.{0,2}\/|\S*[/.:]\S*$|.*\.(?:avif|bmp|gif|ico|jpe?g|png|svg|tiff?|webp)$)/i,cs={name:"image",render:/* @__PURE__ */re((e,t,n)=>{const r=e.element;if("IMG"===r.tagName&&e.altField===e.fieldName&&void 0===e.srcField&&("string"==typeof t||gi(t)))return void(r.alt=t??"");if(gi(t))return void fs(r);const i=void 0!==e.locale,{media:o,candidate:s}=function(e,t,n,r){const i=void 0!==e.srcField&&e.srcField.length>0?ae(n.allFields,e.srcField,n.locale,r):t,o=vo(i);return{media:o,candidate:void 0===o?i:o.url}}(e,t,n,i);if(void 0===o&&"string"==typeof s&&!ds.test(s.trim()))return!1;const a=Qo(r,e.fieldName,s,void 0===o?void 0:n.serverURL);if("none"===a.kind)return!1;if("unsafe"!==a.kind){if("IMG"===r.tagName){const t=r;ss(t,a.url,o,n.serverURL);const s=function(e,t,n,r,i){if(void 0!==t&&t.length>0){const e=ae(n,t,r,i);return"string"==typeof e?e:void 0}return e?.alt}(o,e.altField,n.allFields,n.locale,i);return void(void 0!==s&&(t.alt=s))}r.style.backgroundImage=`url('${function(e){return e.replace(/['"()\\]/g,"\\$&")}(a.url)}')`}else fs(r)})};function fs(e){"IMG"===e.tagName?is(e):e.style.backgroundImage=""}var hs={name:"upload",render:/* @__PURE__ */re((e,t,n)=>{const r=e.element;if(gi(t))return void ps(r);const i=vo(t);if(void 0===i)return!1;const o=Qo(r,e.fieldName,i.url,n.serverURL);if("none"===o.kind)return!1;if("unsafe"===o.kind)return void ps(r);const s=o.url;if("IMG"===r.tagName){const e=r;return ss(e,s,i,n.serverURL),void(void 0!==i.alt&&(e.alt=i.alt))}if("A"===r.tagName)return r.setAttribute("href",s),void(r.textContent=i.filename??s);const a=escapeHtml(i.filename??s);r.innerHTML=Lr(`<a href="${escapeHtmlAttribute(s)}">${a}</a>`)})};function ps(e){"IMG"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):is(e)}var gs={name:"relationship",render(e,t){const n=e.element;if(gi(t))return n.removeAttribute("href"),void(n.textContent="");if("A"===n.tagName&&!Array.isArray(t)){const r=Qo(n,e.fieldName,mo(t)?.url);"safe"===r.kind?n.setAttribute("href",r.url):"unsafe"===r.kind&&n.removeAttribute("href")}n.textContent=Array.isArray(t)?t.map(ms).join(", "):ms(t)}};function ms(e){const t=mo(e);return void 0===t?pi(e):So(t)??""}var vs={name:"select",render(e,t,n){const r=e.element,i=gi(t)?[]:function(e){return Array.isArray(e)?e.map(pi):[pi(e)]}(t);if("SELECT"!==r.tagName){if("INPUT"===r.tagName&&"radio"===r.type){const e=r;return void(e.checked=i.includes(e.value))}r.textContent=i.map(e=>function(e,t){const n=t.schema?.options;if(!Array.isArray(n))return e;for(const t of n){const n=mo(t);if(void 0!==n&&pi(n.value)===e)return"string"==typeof n.label?n.label:e}return e}(e,n)).join(", ")}else!function(e,t){if(e.multiple)for(const n of Array.from(e.options))n.selected=t.includes(n.value);else e.value=t[0]??""}(r,i)}},ys=/* @__PURE__ */new Set(["","false","0","off","no"]),bs={name:"checkbox",render(e,t){const n=e.element,r=function(e){return"boolean"==typeof e?e:"string"==typeof e?!ys.has(e.trim().toLowerCase()):"number"==typeof e?0!==e:null!=e}(t);"INPUT"!==n.tagName||"checkbox"!==n.type?n.hasAttribute("aria-checked")?n.setAttribute("aria-checked",r?"true":"false"):n.textContent=r?"true":"false":n.checked=r}},ws=/* @__PURE__ */new Map,Ss=/* @__PURE__ */new Map;function As(e,t){const n=e??"";if(null==t)return n;const r=ks(t);return"{}"===r?n:`${n}|${r}`}function ks(e){if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(e=>ks(e)).join(",")}]`;const t=e,n=Object.keys(t).sort(),r=[];for(const e of n){const n=t[e];void 0!==n&&r.push(`${JSON.stringify(e)}:${ks(n)}`)}return`{${r.join(",")}}`}var Ts=/* @__PURE__ */new Set(["short","medium","long","full"]),Cs=/* @__PURE__ */new Set(["short","medium","long","full"]),Rs=/^[A-Za-z]{3}$/u,$s=/^[0-4]$/u;function Ls(e){return{kind:"date",options:e}}function Ns(e){return{kind:"number",options:e}}var Ps=/* @__PURE__ */new WeakSet;function xs(e,t,n,r){if(void 0===t||""===t)return;const i=function(e){const t=e.indexOf(":"),n=-1===t?e:e.slice(0,t),r=-1===t?void 0:e.slice(t+1);switch(n){case"date":return void 0===r?Ls({dateStyle:"medium"}):Ts.has(r)?Ls({dateStyle:r}):void 0;case"time":return void 0===r?Ls({timeStyle:"short"}):Cs.has(r)?Ls({timeStyle:r}):void 0;case"datetime":return void 0===r?Ls({dateStyle:"medium",timeStyle:"short"}):Ts.has(r)?Ls({dateStyle:r,timeStyle:"short"===r?"short":"medium"}):void 0;case"number":if(void 0===r)return Ns({});if(!$s.test(r))return;return Ns({minimumFractionDigits:Number(r),maximumFractionDigits:Number(r)});case"currency":if(void 0===r||!Rs.test(r))return;return Ns({style:"currency",currency:r.toUpperCase()});case"percent":return void 0===r?Ns({style:"percent"}):void 0;default:return}}(t);if(void 0!==i){if(i.kind===e)return i.options}else!function(e,t,n){Ps.has(e)||(Ps.add(e),k(`[live-preview] LP0408: data-payload-format="${n}" on "${t}" is not a known format; the default formatting was used. Known: date, time, datetime (each also :short|medium|long|full), number, number:0-4, currency:XXX, percent.`))}(n,r,t)}var Es={name:"date",render(e,t,n){const r=e.element;if(gi(t))return void("INPUT"===r.tagName?r.value="":(r.removeAttribute("datetime"),r.textContent=""));const i="number"==typeof t?t:pi(t),o=new Date(i),s=!Number.isNaN(o.getTime()),a=String(i);"INPUT"!==r.tagName?("TIME"===r.tagName&&r.setAttribute("datetime",s?o.toISOString():a),r.textContent=s?function(e,t,n){const r=t.locale??n.locale??detectInitialLocale(),i=xs("date",t.format,t.element,t.fieldName)??Ms;try{return function(e,t){const n=As(e,t);return mi(Ss,n)??vi(Ss,n,new Intl.DateTimeFormat(e,t),64)}(r,i).format(e)}catch{return e.toISOString()}}(o,e,n):a):r.value=s?function(e,t){const n=`${String(t.getFullYear()).padStart(4,"0")}-${Os(t.getMonth()+1)}-${Os(t.getDate())}`,r=`${Os(t.getHours())}:${Os(t.getMinutes())}`;return"date"===e?n:"datetime-local"===e?`${n}T${r}`:"time"===e?r:t.toISOString()}(r.type,o):a}},Ms={dateStyle:"medium",timeStyle:"short"};function Os(e){return String(e).padStart(2,"0")}var Fs={name:"number",render(e,t,n){const r=e.element;if(gi(t))return void("INPUT"===r.tagName?r.value="":r.textContent="");const i="number"==typeof t?t:Number(pi(t));Number.isNaN(i)?r.textContent=pi(t):"INPUT"!==r.tagName?r.textContent=function(e,t,n){const r=t.locale??n.locale??detectInitialLocale(),i=xs("number",t.format,t.element,t.fieldName);try{return function(e,t){const n=As(e,t);return mi(ws,n)??vi(ws,n,new Intl.NumberFormat(e,t),64)}(r,i).format(e)}catch{return String(e)}}(i,e,n):r.value=String(i)}},Us={name:"array",render:/* @__PURE__ */re((e,t,n)=>{const r=e.element;if(gi(t))return void(r.textContent="");if(!Array.isArray(t))return!1;const i=e.arrayTemplate;if(void 0!==i&&i.length>0){const e=function(e,t){const n=di(t);let r="";for(let i=0;i<t.length;i+=1)r+=ci(e,t[i],i,pi,n);return r}(i,t),o=n.sanitizerPolicy,s=Ai(i),a=fi(r);r.innerHTML=Lr(Zr(e,o,s));for(const e of Array.from(r.children))hi(e,a);return}r.textContent=t.map(pi).join(e.arraySeparator??", ")})};function Is(){const e=/* @__PURE__ */new WeakMap,t=/* @__PURE__ */new WeakSet,n=/* @__PURE__ */new WeakMap,r=/* @__PURE__ */new WeakMap;return{name:"structural-array",render:/* @__PURE__ */re((i,o,s)=>{const a=gi(o)?[]:o;if(!Array.isArray(a))return!1;const l=i.element,u=i.arrayTemplate;if(void 0===u||0===u.length)return function(e,t,n){e.has(t)||(e.add(t),k(`[live-preview] LP0403: Skipping structural update for "${n}": <${t.tagName.toLowerCase()} data-payload-structural> needs data-payload-array-template (for example "<li>{{label}}</li>").`))}(t,l,i.fieldName),!1;const d=e.get(l),c=_s(l),f=U(d?.values??c.map((e,t)=>null===e?{__payloadDomPosition:t}:{id:e}),a),h=function(e,t,n){return void 0===e||e.template!==t||!function(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}(e.domSnapshot,n)}(d,u,c);if(0===f.length&&!h)return e.set(l,{values:a.slice(),template:u,domSnapshot:c}),!1;!function(e,t,n,r,i){const o=i.map(Ds),s=/* @__PURE__ */new Set,a=o.find(e=>!(void 0===e||!s.has(e)&&(s.add(e),1)));if(void 0!==a&&js(e,t,n,a),o.some(e=>void 0===e)&&Bs(e,t,"LP0404",`LP0404: an item of "${n}" has no id and pairs by position, so an insert re-renders every row after it. Give items a stable id.`),r?.length===i.length&&i.length>1){const i=new Set(r.map(Ds).filter(e=>void 0!==e)),s=o.some(e=>void 0!==e&&i.has(e));i.size>0&&!s&&Bs(e,t,"LP0406",`LP0406: every key of "${n}" changed at once; the source generates ids per message, so no item can be retained across updates.`)}}(n,l,i.fieldName,d?.values,a);const p=Ri({template:u,container:l,patches:f,nextItems:a,store:r,forceRender:h,sanitizerPolicy:s.sanitizerPolicy,onDuplicateKey:(e,t)=>{js(n,e,i.fieldName,t)}});return null!==p&&(e.set(l,{values:a.slice(),template:u,domSnapshot:_s(l)}),!!p&&void 0)})}}function _s(e){return Array.from(e.children,e=>e.getAttribute(ki))}function Ds(e){if("object"!=typeof e||null===e)return;const t=e.id;return"string"==typeof t||"number"==typeof t?String(t):void 0}function js(e,t,n,r){Bs(e,t,"LP0405",`LP0405: two items of "${n}" share the key "${r}"; later ones pair by position. Make \`id\` unique per item.`)}function Bs(e,t,n,r){let i=e.get(t);void 0===i&&(i=/* @__PURE__ */new Set,e.set(t,i)),i.has(n)||(i.add(n),k(`[live-preview] ${r}`))}var zs=/* @__PURE__ */new Map;function Ws(e,t){return{name:e,render(){$(t)}}}function Hs(){const e=[Vo,Ko,Yo,ts,cs,hs,gs,vs,{...vs,name:"radio"},bs,Es,Fs,..."undefined"!=typeof __LEAN_BUILD__&&__LEAN_BUILD__?[Ws("array","structural arrays"),Ws("blocks","structural arrays")]:[Us,{...Us,name:"blocks"}]];return function(e=[]){const t={};for(const n of e)t[n.name]=n;for(const[e,n]of zs)t[e]=n;return Object.freeze(t)}([Bo("text"),Bo("textarea"),...e,..."undefined"!=typeof __LEAN_BUILD__&&__LEAN_BUILD__?[]:[Is()]])}var qs=Object.freeze({disableReferrerDetection:!0,eventSourcePolicy:"parent-or-opener",skipUnchanged:!0,sanitizerPolicy:"strict"}),Vs=Object.freeze({disableReferrerDetection:!1,eventSourcePolicy:"any",skipUnchanged:!1,sanitizerPolicy:"compat"});function Gs(e){return void 0===e?void 0:!e}var LivePreviewClient=class{#W=new EventEmitter;#H;#q;#V;#T;#n;#G=!1;#J=!1;#K=!1;#X=null;constructor(e={}){const n=function(e){const t="v1"===e.defaults?Vs:qs;return{...e,skipUnchanged:e.skipUnchanged??t.skipUnchanged,disableReferrerDetection:e.disableReferrerDetection??t.disableReferrerDetection,eventSourcePolicy:e.eventSourcePolicy??t.eventSourcePolicy,sanitizerPolicy:e.sanitizerPolicy??t.sanitizerPolicy}}(e),r=n.serverURL??"";t({defaults:e.defaults,serverURL:r,mergeDepth:n.mergeDepth});const i=n.debug??isDevMode();this.#n=i?(...e)=>{T("[live-preview]",...e)}:S,this.#H=new OriginDetector(P({additionalOrigins:n.allowedOrigins,enableReferrerDetection:Gs(n.disableReferrerDetection),enableLocalhostMatching:Gs(n.disableLocalhostMatching)})),this.#H.isProductionUnconfigured&&this.#n("no trusted origin could be detected — set allowedOrigins"),this.#q=new ao(Hs()),this.#T=new so({events:this.#W,config:Object.freeze({...n}),registerFieldRenderer:e=>this.#q.register(e),onTransformError:e=>{this.#W.emit("error",{error:e,context:"transform",code:"LP0602"})},log:this.#n}),this.#V=new Qi(P({root:n.root,renderers:this.#q.renderers,resolveRenderer:(e,t)=>n.resolveRenderer?.(e,t)??this.#q.resolve(e),renderRichText:n.renderRichText,internalLinkPattern:n.internalLinkPattern,routeAfterSave:n.routeAfterSave,sanitizerPolicy:n.sanitizerPolicy,transformValue:(e,t,n,r)=>this.#T.applyTransforms(e,t,n,r),originMatcher:e=>this.#H.matches(e),readyTargets:()=>this.#H.enumerate(),emitter:this.#W,dataMerge:""===r?void 0:P({serverURL:r,apiRoute:n.apiRoute,depth:n.mergeDepth,timeoutMs:n.mergeTimeoutMs,fetchFn:n.mergeFetch}),debounceMs:n.debounceMs,heartbeatMs:n.heartbeatMs,intersectionRootMargin:n.intersectionRootMargin,scopeBindingsByOwner:n.scopeBindingsByOwner,skipUnchanged:n.skipUnchanged,revealEditedField:n.revealEditedField,autoBind:n.autoBind,subfieldCoverage:n.subfieldCoverage,eventSourcePolicy:n.eventSourcePolicy,dependencies:n.dependencies,strategies:n.strategies,disableVisibilityGate:n.disableVisibilityGate,visibilityGateThreshold:n.visibilityGateThreshold,enableA11y:n.enableA11y,a11yLocale:n.a11yLocale,onHeartbeatTimeout:()=>{this.#H.unlockOrigin()},lockedOrigin:()=>this.#H.lockedOrigin,validateToken:n.validateToken,log:this.#n})),this.#W.on("connect",e=>{this.#H.lockOrigin(e.origin)}),!1!==n.autoStart&&this.start()}start(){if(this.#J)return!1;if(this.#G)return this.#V.start(),!0;if(!isInPreviewContext())return!1;const e=this.#V.start();return e&&(this.#G=!0),e}suspend(){return!(this.#J||!this.#G)&&this.#V.suspend()}resume(){return!(this.#J||!this.#G)&&this.#V.start()}destroy(){if(null!==this.#X)return this.#X;let e,t;this.#J=!0;const n=new Promise((n,r)=>{e=n,t=r});this.#X=n;const r=()=>{this.#W.removeAllListeners(),this.#K=!0};try{this.#V.destroy(),this.#T.destroyAll().finally(r).then(e,t)}catch(e){r(),t(e)}return n}async use(e){if(this.#J)throw new Error("LivePreviewClient: already destroyed");await this.#T.register(e)}async unuse(e){if(this.#K)throw new Error("LivePreviewClient: already destroyed");await this.#T.unregister(e)}refreshCache(){this.#V.refreshCache()}refreshAfterNavigation(){this.#V.navigationCommit()}get events(){return this.#W}get plugins(){return this.#T.list()}get status(){return this.#V.status}inspect(){return{...this.#V.inspect(),plugins:this.#T.snapshot()}}get updateCount(){return this.#V.updateCount}get destroyed(){return this.#J}};function Js(e,t,n){if(0===t.length)return;const r={type:"payload-live-preview-focus",field:t};e.postMessage(r,n)}var Ks="astro:page-load",Xs="astro:after-swap",Qs="__livePreviewRouteRefresh",Zs=Object.freeze({NoTrustedOrigin:"LP0101",ReferrerOnlyTrust:"LP0102",PluginIncompatible:"LP0103",ProfileFeatureOmitted:"LP0104",OrphanField:"LP0201",UnattributableUpdate:"LP0202",UnboundField:"LP0203",CoverageDefaultChanges:"LP0204",VisibilityGateDeferred:"LP0301",UnsafeAttributeWrite:"LP0401",TextTargetHasChildren:"LP0402",MissingArrayTemplate:"LP0403",StructuralItemUnkeyed:"LP0404",StructuralDuplicateKey:"LP0405",StructuralUnstableKeys:"LP0406",UnsupportedStrategy:"LP0407",UnknownValueFormat:"LP0408",SanitizerDroppedAttribute:"LP0409",UnrenderedBlockKept:"LP0410",UnfaithfulPatch:"LP0411",ServerFormatReplaced:"LP0412",UnrenderedBlockLost:"LP0413",MessageRejected:"LP0501",TokenRejected:"LP0502",ProtocolShapeUnknown:"LP0503",HandlerThrew:"LP0601",TransformThrew:"LP0602",RendererThrew:"LP0603",StartupFailed:"LP0605",ReadyFailed:"LP0606",HydrationWaitTimedOut:"LP0607",AuditRuntimeMissing:"LP0701",AuditNoFrameAncestors:"LP0702",AuditFrameOptionsBlocks:"LP0703",AuditBindingsExposed:"LP0704",AuditGateThresholdExceeded:"LP0705",AuditUnownedBindings:"LP0706",AuditNoBindings:"LP0707",AuditNotAPage:"LP0708",FragmentRequestFailed:"LP0801",FragmentResponseInvalid:"LP0802",FragmentUnauthorized:"LP0803",FragmentSuperseded:"LP0804",RouteRefreshLoop:"LP0805",FragmentStrategyUnavailable:"LP0806",UnboundChangeRefresh:"LP0807",EscalationUnavailable:"LP0808",IslandStartUnavailable:"LP0809",RouteRefreshUnconfirmed:"LP0810",V2ReadinessGap:"LP0709",RuntimeOnPublicPage:"LP0710",AuditModifierWithoutField:"LP0711"}),Ys=/* @__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(...n)=>{try{e(t(...n))}catch{}}}function n(){}function i(e){switch(typeof e){case"string":return e.length>65536?void 0:`s:${e}`;case"number":return`n:${Object.is(e,-0)?"-0":String(e)}`;case"boolean":return"b:"+(e?"1":"0");case"bigint":return`i:${String(e)}`;case"undefined":return"u";case"object":{if(null===e)return"z";let t;try{t=JSON.stringify(e)}catch{return}return t.length>65536?void 0:`o:${t}`}case"symbol":case"function":return}}function r(e){return e.onUnfaithfulPatch??("ignore"===e.onUnboundChange?"ignore":"escalate")}function l(e,t,n,r,l){let a=e.onUnfaithfulPatch,o=t.reportedUnfaithful.get(n.element),s=i(l),u=Date.now(),d=void 0!==o&&("escalate"!==a||void 0===s||s===o.identity||u-o.at<Ui);if((d||"escalate"!==a)&&t.display.shortfall(t.activeUpdate,{kind:"unfaithful",field:n.fieldName}),!d){if(t.reportedUnfaithful.set(n.element,{identity:s,at:u}),void 0===o){if(t.unfaithfulCount+=1,t.unfaithfulFields.add(n.fieldName),"ignore"===a)return;if("warn"===a){e.warn(`[live-preview] LP0411: "${n.fieldName}" ${r}`);return}}e.log("LP0411",n.fieldName,r),t.unfaithfulPatches.push(n)}}function a(e,t){return!e.unfaithfulFields.has(t)&&(e.unfaithfulFields.add(t),e.unfaithfulCount+=1,!0)}function o(e){return"select"===e||"radio"===e}function s(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value:e.textContent}function u(e){let t=e.trim();return JSON.stringify(t.length>ji?`${t.slice(0,ji)}\\u2026`:t)}function d(){return function(){if(typ','eof document>"u")return;let e=document.documentElement.getAttribute("lang");return null===e||0===e.length?void 0:e}()??function(){if(typeof navigator>"u")return;let e=navigator.language;return"string"==typeof e&&e.length>0?e:void 0}()??"en"}function c(e){null!==e.timer&&(clearTimeout(e.timer),e.timer=null),e.messageNode?.remove(),e.messageNode=null}function h(e){if(++e.nodes>1e4)throw new Error("invalid or oversized field schema")}function f(e,t,n){if(h(t),n>64||t.active.has(e))throw new Error("invalid or oversized field schema");t.active.add(e)}function p(e){try{return g(e,{nodes:0,active:new WeakSet},0)}catch{return[]}}function g(e,t,n){if(!Array.isArray(e))return[];f(e,t,n);let i=[];for(let r of e){let e=m(r,t,n);e&&i.push(e)}return t.active.delete(e),i}function m(e,t,n){if(h(t),"object"!=typeof e||null===e)return;let i=e,r=i.name,l=i.type;if("string"!=typeof r||0===r.length||"string"!=typeof l||0===l.length)return;let a=g(i.fields,t,n+1),o=function(e,t,n){if("object"==typeof e&&null!==e&&!Array.isArray(e)){f(e,t,n);let i=[];for(let r in e){if(!Object.hasOwn(e,r))continue;h(t);let l=Reflect.get(e,r);"object"!=typeof l||null===l||["__proto__","constructor","prototype"].includes(r)||i.push({...l,slug:r,fields:g(l.fields,t,n+1)})}return t.active.delete(e),i}if(!Array.isArray(e))return[];f(e,t,n);let i=[];for(let r of e){if(h(t),"object"!=typeof r||null===r)continue;let e=r,l=e.slug;if("string"!=typeof l||0===l.length)continue;let a=g(e.fields,t,n+1);i.push({...e,slug:l,fields:a})}return t.active.delete(e),i}(i.blocks,t,n+1),s={...i,name:r,type:l},u=i.relationTo;if(Array.isArray(u)){let e=[];for(let n of u)h(t),e.push(n);s.relationTo=e}return a.length>0?s.fields=a:delete s.fields,o.length>0?s.blocks=o:delete s.blocks,s}function v(e,t){return void 0===e||t(e)}function y(e,t){return null==e||t(e)}function b(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}function w(e,t=[]){let n="number"==typeof e&&Number.isFinite(e)&&e>=1?Math.floor(e):void 0,i=Math.min(4,n??1),r=new Set(t),l=new Set;for(let e of Vi)(i>=zi[e].since||r.has(e))&&l.add(e);return{ours:4,...void 0!==n?{theirs:n}:{theirs:void 0},negotiated:i,capabilities:l,observed:r}}function S(e,t){return e.generation===t.generation&&e.revision===t.revision}function A(e){return function(e){if(!1===e.enableA11y)return null;let t=e.root,n=void 0===t?void 0:function(e){return 9===e.nodeType}(t)?t:t.ownerDocument;return new Bi(e.a11yLocale,n)}(e)}function k(e){if(typ','eof window>"u")return;let t=[];window.parent!==window&&t.push(window.parent),window.opener instanceof Window&&t.push(window.opener),qi.sendReady(t,e)}function T(e,t,n,i){for(let r of e){if(Hi.has(r.type)){let e=r.fields;e&&T(e,i&&"tabs"===r.type?""===t?r.name:`${t}.${r.name}`:t,n,i);continue}let e=""===t?r.name:`${t}.${r.name}`;if(n.set(e,r),"group"===r.type)r.fields&&T(r.fields,e,n,i);else if("array"===r.type&&r.fields)T(r.fields,`${e}.*`,n,i);else if("blocks"===r.type&&r.blocks)for(let t of r.blocks)T(t.fields,`${e}.*.${t.slug}`,n,i)}}function C(e,t){if(e.has(t))return e.get(t);let n=t.replace(/\\.\\d+(?=\\.|$)/g,".*");return e.has(n)?e.get(n):void 0}function R(e){if("object"!=typeof e||null===e)return;let t=e.id;return"string"==typeof t||"number"==typeof t?t:void 0}function $(e){if("object"!=typeof e||null===e)return;let t=e.blockType;return"string"==typeof t?t:void 0}function F(e,t){return t.every(e=>void 0!==R(e))?function(e,t){let n=[],i=new Map;for(let t=0;t<e.length;t+=1){let n=R(e[t]);void 0!==n&&i.set(n,t)}let r=new Set;for(let l=0;l<t.length;l+=1){let a=t[l],o=R(a);if(void 0===o){n.push({kind:"insert",index:l,value:a});continue}let s=i.get(o);if(void 0===s){n.push({kind:"insert",index:l,value:a});continue}r.add(s);let u=e[s];$(u)===$(a)?(s!==l&&n.push({kind:"move",from:s,to:l,value:a}),N(u,a)||n.push({kind:"update",index:l,value:a})):n.push({kind:"replace",index:l,oldValue:u,value:a})}for(let t=0;t<e.length;t+=1)r.has(t)||n.push({kind:"remove",index:t,value:e[t]});return n}(e,t):function(e,t){let n=[],i=Math.min(e.length,t.length);for(let r=0;r<i;r+=1)N(e[r],t[r])||n.push({kind:"update",index:r,value:t[r]});if(t.length>e.length)for(let i=e.length;i<t.length;i+=1)n.push({kind:"insert",index:i,value:t[i]});if(e.length>t.length)for(let i=t.length;i<e.length;i+=1)n.push({kind:"remove",index:i,value:e[i]});return n}(e,t)}function N(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;let n=e,i=t,r=Object.keys(n),l=Object.keys(i);if(r.length!==l.length)return!1;for(let e of r)if(!Object.is(n[e],i[e]))return!1;return!0}function M(e){if("string"!=typeof e)return!1;let t=e.trim().replace(Qi,"");if(0===t.length)return!1;if(t.startsWith("#")||t.startsWith("?")||Xi.test(t)||t.startsWith("/"))return!0;try{let e=new URL(t);return Ki.has(e.protocol)}catch{return Ji.test(t)&&!function(e){let t=Yi.exec(e.replace(Zi,""))?.[1];return void 0!==t&&!Ki.has(`${t.toLowerCase()}:`)}(t)}}function O(e){let t=e.trim().replace(Qi,"");return/^https?:\\/\\//i.test(t)||Xi.test(t)}function E(e){return!e.startsWith("on")&&!er.has(e)}function L(e){return nr.add(e),e}function P(){return!0}function x(e,t,n,i=!1){if(i&&void 0!==n){let i=U(e,`${t}_${n}`);if(void 0!==i)return i}let r=U(e,t);if(void 0!==r)return r;if(t.includes(".")){let n=e,i=!0;for(let e of t.split(".")){if(rr.has(e)||null===n||"object"!=typeof n){i=!1;break}if(n=U(n,e),void 0===n){i=!1;break}}if(i)return n}return void 0===n?void 0:U(e,`${t}_${n}`)}function U(e,t){if(!rr.has(t)&&Object.prototype.hasOwnProperty.call(e,t))return e[t]}function I(e,t,n,i){return x(e,n,t.locale??i,void 0!==t.locale)}function j(e,t,n,r){let l=i(t);if(void 0===l)return;let a=[e.hrefField,e.srcField,e.altField],o=JSON.stringify([e.format,e.locale??r])+l;for(let t of a){if(void 0===t||0===t.length)continue;let l=i(I(n,e,t,r));if(void 0===l)return;o+=`|${t}=${l}`}return o}function D(e){return e.closest(`[${lr}]`)}function W(e,t,n){let i=new Set(t);return{boundaries:t,strategy:e,ownerKeys:n,covers:e=>void 0!==e.fragmentBoundary&&i.has(e.fragmentBoundary)}}function B(e){let t=e.getAttribute(or);return null!==t&&t.length>0?"patch"===t||"fragment"===t||"route"===t?t:void 0:null!==D(e)?"fragment":null!==e.closest("head")?"route":"patch"}function _(e){return`global:${e}`}function z(e,t){return void 0===t||""===t?`collection:${e}`:`collection:${e}:${t}`}function V(e){return"string"==typeof e&&e.length>0}function q(e,t){return null!==t&&void 0!==e&&t.includes(e)}function H(e){let t=e.id;return"string"==typeof t&&t.length>0?t:"number"==typeof t&&Number.isFinite(t)?String(t):void 0}function G(e){return"object"==typeof e&&null!==e}function K(e){return Array.isArray(e)?"array":G(e)?"object":"scalar"}function J(e,t){return G(e)?e[t]:void 0}function X(e,t){return("string"==typeof t||"number"==typeof t)&&G(e)&&!Array.isArray(e)&&e.id===t}function Q(e,t){if(!G(e)||!G(t))return X(e,t)||X(t,e)||i(e)===i(t);if(Array.isArray(e)!==Array.isArray(t))return!1;let n=Object.keys(t);return n.length===Object.keys(e).length&&n.every(n=>Object.hasOwn(e,n)&&Q(J(e,n),J(t,n)))}function Z(e,t){let n=i(t),r=i(e);return!!(void 0!==n&&n===r||X(e,t)||X(t,e))||void 0!==n&&void 0!==r&&Q(e,t)}function Y(e,t,n){let i=t,r=n;for(let t of e.split("."))i=J(i,t),r=J(r,t);return!Z(i,r)}function ee(e,t,n,i){let r=[],l=0,a=(e,t,n,o)=>{if(l+=1,i.covers(e)||Z(t,n))return;if(!((void 0===t||K(t)===K(n))&&G(n)&&i.reachesBelow(e)&&o<sr)){r.push({path:e,value:n});return}let s=function(e,t){let n=new Set(Object.keys(t));if(G(e))for(let t of Object.keys(e))n.add(t);return[...n]}(t,n);0===s.length&&r.push({path:e,value:n});for(let i of s){if(l>=ur){r.push({path:e,value:n});return}a(`${e}.${i}`,J(t,i),J(n,i),o+1)}};return a(e,t,n,0),r}function te(e,t,n={}){let i=e=>!1===t||q(e,t),r=[];for(let[t,n]of e.entries())n.some(e=>i(e.owner))&&r.push(t);let l=e.rendered.filter(e=>void 0!==n[e.strategy]);return function(e,t){let n=new Set(e),i=[...t],r=(e,t)=>{let n=`${t}.`;for(let t of e)if(t.startsWith(n))return!0;return!1};return{covers:e=>n.has(e)||i.some(t=>t===e||e.startsWith(`${t}.`)),reachesBelow:e=>r(n,e)||r(i,e)}}(r,[...e.covers,...l].filter(e=>i(e.owner)).flatMap(e=>e.paths))}function ne(e,t){if(void 0===t||0===t.length)return e;let n=`_${t}`;return e.endsWith(n)?e.slice(0,-n.length):e}function ie(e,t,n,i=te(e,n)){let r,l=i.covers,a=i.reachesBelow;return i=>{let o=ne(i,t);return l(i)||o!==i&&l(o)||(r??(r=function(e,t){let n=new Set;for(let[i,r]of e.entries())for(let e of r)!1!==t&&!q(e.owner,t)||void 0!==e.locale&&n.add(`${i}_${e.locale}`);return n}(e,n)),r.has(i))?"whole":a(i)||o!==i&&a(o)?"below":"none"}}function re(e,t,n,i,r){let l=te(e,i,r),a=ie(e,n,i,l),o=[];for(let[e,i]of Object.entries(t)){if(dr.has(e)||"below"!==a(e))continue;let t=ne(e,n);o.push(...ee(t,void 0,i,l))}return o}function le(e,t,n,i,r){return se(n)?!se(t)||function(e,t,n){let i=void 0===n?void 0:C(n,e);return void 0!==i&&!cr.has(i.type)||!0===t.get(e)?.some(ae)||function(e,t){let n=`${t}.`;for(let[t,i]of e.entries())if(t.startsWith(n))return!0;return!1}(t,e)}(e,i,r)?"keep":null==t?"ask":"own":"ask"}function ae(e){return!cr.has(e.fieldType)}function oe(e){let t=[e],n=new Set;for(let e=t.pop();void 0!==e;e=t.pop()){if("object"!=typeof e||null===e||n.has(e))continue;n.add(e);let{type:i,fields:r,children:l}=e;if(!hr.has(i)||"internal"===r?.linkType)return!0;if(Array.isArray(l))for(let e of l)t.push(e)}return!1}function se(e){return null===e||"object"!=typeof e&&"function"!=typeof e}function ue(e){return!0===e?.includes(".")}function de(){if(typ','eof window>"u")return!1;try{return window.self!==window.top}catch{return!0}}function ce(){let e=function(){if(typ','eof process>"u")return;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}function he(e,t){let n=t.globalSlug??t.collectionSlug;if("string"!=typeof n||e.entitySlug!==n)return!0;let i=H(e),r=H(t.data??{});return void 0!==i&&void 0!==r&&i!==r}function fe(e){return null!==e&&e.forceRender&&!e.completed}function pe(e){try{return!0===e.matchMedia?.("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function ge(e,t){let n=t.element.ownerDocument.defaultView;return null===n?"no-element":e.reveal(`${t.owner??""} ${t.fieldName}`,t.element,n)}function me(e){let t=e.getAttribute(ar);return{kind:"fragment",id:e.getAttribute(lr)??"",key:null===t||0===t.length?void 0:t,code:"LP0801"}}function ve(e){if("object"!=typeof e||null===e||!("root"in e))return!1;let t=e.root;return"object"==typeof t&&null!==t&&Array.isArray(t.children)}function ye(e){return!!ve(e)&&e.root.children.every(e=>{let{type:t,children:n}=e??{};return"paragraph"===t&&(!Array.isArray(n)||0===n.length)})}function be(e){if(null==e)return[];let t=new Set,n=[];for(let i of e.split(/[\\s,]+/)){let e=i.trim();0===e.length||t.has(e)||(t.add(e),n.push(e))}return n}function we(...e){let t=new Map;for(let n of e)for(let[e,i]of Object.entries(n)){let n=t.get(e);void 0===n&&(n=new Set,t.set(e,n));for(let e of i)n.add(e)}let n={};for(let[e,i]of t)n[e]=[...i];return n}function Se(e,t){let n={};for(let i of t)i!==e&&(n[i]=[e]);return n}function Ae(e){if(e.tagName.toLowerCase().includes("-")&&!e.hasAttribute(Fr)||Te(e)||e.hasAttribute($r))return!0;let t=e.getAttribute("contenteditable");return null!==t&&"false"!==t}function ke(e){return"patch"===e.getAttribute(Cr)}function Te(e){return function(e){return"astro-island"===e.tagName.toLowerCase()||e.hasAttribute(Cr)}(e)&&!ke(e)}function Ce(e){return"astro-island"===e.tagName.toLowerCase()&&e.hasAttribute("ssr")}function Re(e){return"astro-island"===e.tagName.toLowerCase()}function $e(e){let t="";for(let n of e.querySelectorAll("astro-slot, template[data-astro-template]"))n.parentElement?.closest("astro-island")===e&&(t+=`${n.getAttribute("name")??n.getAttribute("data-astro-template")??""}\\0${n.innerHTML}\\0`);return t}function Fe(e,t){if(!Re(e)||!Re(t))return!0;let n=$e(t);if(!Nr.every(n=>e.getAttribute(n)===t.getAttribute(n))||(Mr.get(e)??$e(e))!==n||e.getAttribute("props")!==t.getAttribute("props")&&!function(e){let t=e.ownerDocument.defaultView?.customElements.get("astro-island");return void 0!==t&&e instanceof t&&Array.isArray(t.observedAttributes)&&t.observedAttributes.includes("props")}(e))return Mr.set(t,n),!1;Mr.set(e,n);let i=t.getAttribute("props");return i!==e.getAttribute("props")&&(e.setAttribute("ssr",""),null===i?e.removeAttribute("props"):e.setAttribute("props",i)),!0}function Ne(e){return Array.from(e.querySelectorAll("astro-island"))}function Me(e){let t=e.ownerDocument.defaultView;if(void 0===t?.customElements.get("astro-island"))return"element";let n=e.getAttribute("client"),i=Reflect.get(t,"Astro");return null===n||"object"!=typeof i||null===i||void 0===Reflect.get(i,n)?"directive":void 0}function Oe(e){let t=e.closest(el)?.getAttribute(Hr);return null==t||0===t.length?void 0:t}function Ee(e){return il.has(e)||nl.test(e)}function Le(e,t){return e.fieldName===t.fieldName&&e.locale===t.locale&&e.owner===t.owner&&e.strategyKind===t.strategyKind&&e.fragmentBoundary===t.fragmentBoundary}function Pe(e){let t=e.getAttribute(Lr);if(null!==t&&Ee(t))return t;if(e.hasAttribute(_r))return"richText";if(e.hasAttribute(zr))return"html";if(e.hasAttribute(qr))return"structural-array";if(e.hasAttribute(Vr))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 xe(){return!0}function Ue(){throw new Error("invalid or oversized legacy population")}function Ie(e){for(let t=0;t<e.length;t+=1){let n=e.charCodeAt(t);if(n<=31||127===n)return!0}return!1}function je(e,t){if("string"!=typeof e||0===e.length||e.length>t||"."===e||".."===e||e.includes("/")||e.includes("\\\\")||Ie(e))return!1;try{return encodeURIComponent(e),!0}catch{return!1}}function De(e){return je(e,128)&&!/[?#%]/u.test(e)&&!fl.has(e)}function We(e){return Number.isFinite(e)?String(e):je(e,512)?e:Ue()}function Be(e,t){return Object.hasOwn(e,t)?Reflect.get(e,t):void 0}function _e(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0,enumerable:!0})}function ze(e){let t=e.length;for(;t>0&&47===e.charCodeAt(t-1);)t-=1;return e.slice(0,t)}function Ve(e){let t=new WeakSet,n=0,i=0;return function e(r,l){if(++n>al||l>ll)return Ue();if("string"==typeof r)return i+=r.length,i>dl&&Ue(),r;if(null==r||"boolean"==typeof r)return r;if("number"==typeof r)return Number.isFinite(r)?r:Ue();if(!Array.isArray(r)&&!b(r))return Ue();if(Array.isArray(r)){r.length>al&&Ue();for(let e=0;e<r.length;e+=1)Object.hasOwn(r,e)||Ue()}if(t.has(r))return Ue();t.add(r);let a=Array.isArray(r)?[]:{};for(let t of Object.keys(r))_e(a,t,e(Reflect.get(r,t),l+1));return t.delete(r),a}(e,0)}function qe(e,t,n,i,r,l){function a(e,t,n,i){if(null==i||""===i)return;let l=b(i)?Be(i,"id"):i,a=We(l);if(0===r){_e(e,t,l);return}let o=JSON.stringify([n,a]);c.add(o),c.size>ol&&Ue();let s=d.get(n)??[];s.push({owner:e,key:t,id:a}),d.set(n,s)}function o(e,t,n){void 0!==n.hasMany&&"boolean"!=typeof n.hasMany&&Ue();let i=n.relationTo,r=Be(e,t);if(Array.isArray(i)){0===i.length&&Ue();let e,t=b(r)?Be(r,"relationTo"):void 0;for(let n of i)p(0),De(n)||Ue(),n===t&&(e=n);if(null==r||""===r)return;(!b(r)||void 0===e)&&Ue(),a(r,"value",e,Be(r,"value"))}else De(i)||Ue(),a(e,t,i,r)}function s(e,t){if(p(t),Array.isArray(e)||b(e)){if(b(e)&&Object.hasOwn(e,"relationTo")&&Object.hasOwn(e,"value")){let t=Be(e,"relationTo");De(t)||Ue(),a(e,"value",t,Be(e,"value"));return}for(let n of Object.keys(e))s(Reflect.get(e,n),t+1)}}if(!Number.isSafeInteger(r)||r<0||r>ll)return Ue();void 0!==l&&("string"!=typeof l||l.length>128||Ie(l))&&Ue();let u=Ve(e);if(!b(u))return Ue();let d=new Map,c=new Set,h=0,f=new WeakSet,p=e=>{(++h>al||e>ll)&&Ue()};(function e(t,n,i){p(i),f.has(t)&&Ue(),f.add(t);for(let r of t){p(i),(!b(r)||!je(r.name,512)||fl.has(r.name))&&Ue();let t=Be(n,r.name);if("relationship"===r.type||"upload"===r.type)if(r.hasMany)if(null!=t&&!Array.isArray(t)&&Ue(),Array.isArray(t))for(let e=0;e<t.length;e+=1)o(t,e,r);else o(n,r.name,r);else o(n,r.name,r);else if("group"===r.type||"tabs"===r.type)null!=t&&!b(t)&&Ue(),b(t)&&r.fields&&e(r.fields,t,i+1);else if("row"===r.type||"collapsible"===r.type)r.fields&&e(r.fields,n,i+1);else if("array"===r.type||"blocks"===r.type){if(0===t?_e(n,r.name,[]):null!=t&&!Array.isArray(t)&&Ue(),Array.isArray(t))for(let n of t)if(b(n)||Ue(),"array"===r.type&&r.fields)e(r.fields,n,i+1);else if("blocks"===r.type){let t=Be(n,"blockType"),l=r.blocks?.find(e=>(p(i),e.slug===t));void 0===l&&Ue(),e(l.fields,n,i+1)}}else"richText"===r.type&&s(t,i+1)}f.delete(t)})(t,u,0),d.size>25&&Ue();let g=[];if(0===d.size)return{doc:u,requests:g};let m=new URL(n);(!["http:","https:"].includes(m.protocol)||m.username||m.password||m.search||m.hash)&&Ue(),(!i.startsWith("/")||i.includes("\\\\")||/[%?#]/u.test(i)||Ie(i))&&Ue(),i.split("/").some(e=>"."===e||".."===e)&&Ue();let v=`${ze(n)}${ze(i)}/`;for(let[e,t]of d){let n=[...new Set(t.map(e=>e.id))],i=0;for(;i<n.length;){let a=n[i];void 0===a&&Ue();let o=a.includes(","),s=[],u="";for(;i<n.length&&s.length<hl;){let t=n[i];if(void 0===t||s.length>0&&(o||t.includes(",")))break;let a=[...s,t],d=new URLSearchParams({depth:String(r),limit:String(a.length)});void 0!==l&&d.set("locale",l),d.set(o?"where[id][equals]":"where[id][in]",o?t:a.join(","));let c=`${v}${encodeURIComponent(e)}?${d}`;if(c.length>ul){0===s.length&&Ue();break}new URL(c).origin!==m.origin&&Ue(),s.push(t),i+=1,u=c}(0===s.length||g.length>=sl)&&Ue();let d=new Set(s);g.push({url:u,ids:d,slots:t.filter(e=>d.has(e.id))})}}return{doc:u,requests:g}}async function He(e,t,n){let i,r,l=!1,a=!1,o=Symbol(),s=new Promise(e=>{r=()=>{e(o)}}),u=()=>{(!n()||t.aborted)&&Ue()},d=()=>{if(void 0!==i&&!l){l=!0;try{Promise.resolve(i.cancel()).catch(()=>{})}catch{}}},c=()=>{r?.(),d()};t.addEventListener("abort",c,{once:!0});try{u();let t=e.body??null;if(u(),null===t){let t=e.json.bind(e);u();let n=await Promise.race([Promise.resolve().then(()=>(u(),t())),s]);return u(),n===o&&Ue(),n}let n=t.getReader.bind(t);u();let r=n();i=r,u();let l=[],d=0,c=0;for(;;){let e=Promise.resolve().then(()=>{u();let e=r.read.bind(r);return u(),e()}),t=await Promise.race([e,s]);if(u(),t===o&&Ue(),t.done)break;d+=t.value.byteLength,(++c>cl||d>dl)&&Ue(),l.push(t.value)}a=!0;let h=new Uint8Array(d),f=0;for(let e of l)h.set(e,f),f+=e.byteLength;try{return JSON.parse((new TextDecoder).decode(h))}catch{return Ue()}}finally{t.removeEventListener("abort",c),a||d();try{i?.releaseLock()}catch{}}}function Ge(e,t){let n=Ve(t);b(n)||Ue();let i=Be(n,"docs");(!Array.isArray(i)||i.length>hl)&&Ue();let r=new Map;for(let t of i){b(t)||Ue();let n=We(Be(t,"id"));(!e.ids.has(n)||r.has(n))&&Ue(),r.set(n,t)}r.size!==e.ids.size&&Ue();for(let t of e.slots)_e(t.owner,t.key,r.get(t.id))}function Ke(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 Je(e){return Ke(e,128)&&!e.includes("?")&&!e.includes("#")}function Xe(e){return"number"==typeof e?Number.isFinite(e):"string"==typeof e&&Ke(e,512)}function Qe(e){return e.has("schema-json")?vl:e.has("document-events")||e.has("relationship-events")?yl:bl}function Ze(e){if("attributes"!==e.type||e.attributeName!==wl||e.target.nodeType!==Sl)return null;let t=e.target;return"astro-island"!==t.tagName.toLowerCase()||t.hasAttribute(wl)?null:t}function Ye(e){if(e.nodeType!==Sl)return!1;let t=e;return t.matches(kl)||null!==t.querySelector(kl)}function et(){if(typ','eof window>"u")return;let e=window;return e[Ol]??(e[Ol]={armed:!1,committed:!1,commits:[],onCommit:void 0,waiters:[]})}function tt(){let e=et();if(void 0===e||e.armed)return;e.armed=!0;let t=window,n=t.__REACT_DEVTOOLS_GLOBAL_HOOK__??(t.__REACT_DEVTOOLS_GLOBAL_HOOK__=function(){let e=new Map;return{supportsFiber:!0,renderers:e,inject:t=>{let n=e.size+1;return e.set(n,t),n}}}()),i=n.onCommitFiberRoot;n.onCommitFiberRoot=function(t,n,...r){try{i?.call(this,t,n,...r)}catch{}void 0===e.onCommit?e.commits.push(n):e.onCommit(n)}}function nt(e){e.committed=!0;let t=e.waiters;e.waiters=[];for(let e of t)e()}function it(e,t){let n=e.waiters.indexOf(t);n>=0&&e.waiters.splice(n,1)}function rt(e,t,n){if(e.committed)return null;let i=null,r=()=>{null!==i&&clearTimeout(i),i=null,t("committed")};return e.waiters.push(r),i=setTimeout(()=>{i=null,it(e,r),t("timed-out")},n),()=>{null!==i&&clearTimeout(i),i=null,it(e,r)}}function lt(){if(typ','eof window>"u")return;let e=window;return e[Pl]??(e[Pl]={armed:!1,committed:!1,waiters:[]})}function at(e){return Object.prototype.hasOwnProperty.call(e,Ll)?e[Ll]:void 0}function ot(){let e=lt();if(void 0===e||e.armed)return;e.armed=!0;let t=Element.prototype;void 0===Object.getOwnPropertyDescriptor(t,Ll)&&Object.defineProperty(t,Ll,{configurable:!0,get:()=>{},set(e){Object.defineProperty(this,Ll,{value:e,writable:!0,configurable:!0,enumerable:!0});let t=lt();void 0===t||t.committed||null===this.querySelector(El)||function(e,t){let n=t?.$nuxt;!0!==n?.isHydrating||"function"!=typeof n.hook?nt(e):n.hook(xl,()=>{e.committed||nt(e)})}(t,e)}})}function st(e){let t=e.hydration;if(void 0===t){e.startNow();return}let n=Il[t](e.root,n=>{e.later(()=>{ut(e,t,n)})});null!==n?(e.defer(n),e.hydrated("waiting")):ut(e,t,"committed")}function ut(e,t,n){e.hydrated(n),"timed-out"===n&&e.warn(`[live-preview] LP0607: no ${jl[t]} in ${String(5e3)} ms; started without waiting for hydration.`),e.startNow()}function dt(e){return 9===e.nodeType}function ct(e){return e.body}function ht(e,t=_l){if("string"!=typeof e)return!1;let n=e.trim();return!(n.length<t||Vl.test(n)||zl.has(n.toLowerCase())||ql.test(n)||Hl.test(n))}function ft(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function pt(e,t,n=_l){let i=new Map,r=(e,t,n)=>{i.set(e,i.has(e)?null:{field:t,media:n})};for(let[i,l]of Object.entries(e)){if(dr.has(i))continue;let e=ne(i,t);if(ht(l,n))r(l.trim(),e,!1);else if(ft(l))if("string"==typeof l.url)r(l.url,e,!0);else if(!("id"in l)&&!("_id"in l))for(let[t,i]of Object.entries(l))dr.has(t)||!ht(i,n)||r(i.trim(),`${e}.${t}`,!1)}return i}function gt(e){if(e.namespaceURI!==Kl||Gl.has(e.tagName)||e.hasAttribute(Er)||e.hasAttribute(Bl)||e.hasAttribute($r)||Te(e))return!0;let t=e.getAttribute("contenteditable");return null!==t&&"false"!==t}function mt(e){let t;for(let n=e.firstChild;null!==n;n=n.nextSibling){if(1===n.nodeType)return;if(3!==n.nodeType)continue;let e=n.data.trim();if(0!==e.length){if(void 0!==t)return;t=e}}return t}function vt(e){return E(e)&&!e.startsWith("data-payload-")&&"value"!==e}function yt(e,t,n){let i=e.byElement.get(t);void 0===i&&(i={attributes:new Map},e.byElement.set(t,i));let r=e.byField.get(n.field);return void 0===r&&(r=new Set,e.byField.set(n.field,r)),r.add(t),i}function bt(e,t){for(let n=e.firstElementChild;null!==n;n=n.nextElementSibling){if(gt(n))continue;let e=mt(n),i=void 0===e?void 0:t.values.get(e);null!=i&&!i.media&&(yt(t,n,i).text=i.field);for(let e of n.getAttributeNames()){if(!vt(e))continue;let i=t.values.get(n.getAttribute(e)??"");null!=i&&(i.media&&("IMG"!==n.tagName||"src"!==e)||yt(t,n,i).attributes.set(e,i))}bt(n,t)}}function wt(e,t,n){let i=e.tagName;if(void 0!==t){let r={[Er]:t};if("A"===i){let e=n.get("href");void 0===e?r[Lr]="text":e!==t&&(r[xr]=e)}return{element:e,fieldName:t,matched:mt(e)??"",stamps:r}}if("IMG"===i){let t=n.get("src");if(void 0!==t){let i=n.get("alt");return{element:e,fieldName:t,matched:e.getAttribute("src")??"",attribute:"src",stamps:{[Er]:t,...void 0!==i&&i!==t?{[Ir]:i}:{}}}}}let r=n.entries().next();if(r.done)return;let[l,a]=r.value;return{element:e,fieldName:a,matched:e.getAttribute(l)??"",attribute:l,stamps:{[Er]:a,[Pr]:l}}}function St(e,t){let n={values:t,byElement:new Map,byField:new Map};t.size>0&&!gt(e)&&bt(e,n);let i=e=>1===n.byField.get(e)?.size,r=[];for(let[e,t]of n.byElement){let n=void 0!==t.text&&i(t.text)?t.text:void 0,l=new Map;for(let[e,n]of t.attributes)i(n.field)&&l.set(e,n.field);let a=wt(e,n,l);void 0!==a&&r.push(a)}return r}function At(e){return 9===e.nodeType?e.body:e}function kt(e,t){for(let n=t.length-1;n>=0;n-=1){let i=t[n];if(void 0!==i){i.observed&&e.observers.unobserveElement(i.element);for(let e=i.attributes.length-1;e>=0;e-=1){let t=i.attributes[e];if(void 0===t)continue;let{name:n,before:r,written:l}=t;r===l||i.element.getAttribute(n)!==l||(null===r?i.element.removeAttribute(n):i.element.setAttribute(n,r))}i.cacheTouched&&(i.element.hasAttribute(Er)?e.cache.add(i.element):e.cache.remove(i.element))}}}function Tt(e,t,n,i,r){let l=[],a=[],o=()=>(kt(e,a),[]);for(let s of t){if(!r())return o();let{element:t}=s;if(t.hasAttribute(Er))continue;if(!r())return o();if(!1!==n&&!q(Oe(t),n))continue;if(!r())return o();let u={element:t,attributes:[],cacheTouched:!1,observed:!1};a.push(u);for(let[e,n]of[...Object.entries(s.stamps),[Xr,s.matched]]){let i=t.getAttribute(e);if(!r()||(u.attributes.push({name:e,before:i,written:n}),t.setAttribute(e,n),!r()))return o()}if(u.cacheTouched=!0,void 0!==e.cache.add(t)){if(!r()||(e.observers.observeElement(t),u.observed=!0,!r())||(e.log("autoBind",s.fieldName,"\\u2192",`<${t.tagName.toLowerCase()}>`,s.attribute??"text",JSON.stringify(s.matched),i),!r()))return o();l.push(s)}else kt(e,[u]),a.pop()}return l}function Ct(e,t,n,i,r){let a=function(e,t){let n,i=e;for(let e of t.split(".")){if("object"!=typeof i||null===i)break;i=i[e];let t=/^\\d+$/.test(e)?i?.id:null;("string"==typeof t||"number"==typeof t)&&(n=`${n??""}/${String(t)}`)}return n}(i,n.fieldName);if(void 0===a)return;if(r){t.rowsOfBinding.delete(n.element);return}let o=t.rowsOfBinding.get(n.element);t.rowsOfBinding.set(n.element,a),void 0!==o&&o!==a&&l(e,t,n,"stands in a row that moved",a)}function Rt(e,t,n,i){if(!e.scopeBindingsByOwner)return!1;let{message:r}=n,l=function(e){if(V(e.globalSlug))return[_(e.globalSlug)];if(!V(e.collectionSlug))return null;let t=z(e.collectionSlug);return V(e.documentId)?[t,z(e.collectionSlug,e.documentId)]:[t]}({globalSlug:"string"==typeof r.globalSlug?r.globalSlug:void 0,collectionSlug:"string"==typeof r.collectionSlug?r.collectionSlug:void 0,documentId:H(i)});return null===l&&!t.warnedUnattributableMessage&&(t.warnedUnattributableMessage=!0,e.warn("[live-preview] LP0202: scopeBindingsByOwner: update names no document; nothing applied")),l}function $t(e,t,n,i,r){!function(e,t,n){let i=0;for(let r of e)if(!n()||(r.dispatchEvent(new CustomEvent(Tr,{detail:t,bubbles:!1})),i+=1,!n()))break}(n,{fields:t.fields,revision:e.revision.revision,receivedAt:e.receivedAt,locale:e.locale,displayed:r},i)}function Ft(e,t,n,i,r){let{warned:l,warn:a}=e;if(l.has(n)||t(n))return;l.add(n);let o=`data-payload-field="${ne(n,i)}"`;a(""!==r?`[live-preview] LP0203: field "${n}" has a value and no <\\u2026 ${o}> 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 ${o}> for the empty field "${n}"; render the anchor unconditionally so edits to an empty field have somewhere to land.`)}function Nt(e){let t=typeof e;return"string"===t||"number"===t||"boolean"===t||"bigint"===t}function Mt(e){return Array.isArray(e.docs)&&"boolean"==typeof e.hasNextPage}function Ot(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Et(e){let t=function(){let e=function(){let e=globalThis,t=e[Zl];if(void 0!==t)return t;let n={};return e[Zl]=n,n}();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(Ql,{createHTML:e=>e})}catch{e.auto=null}return e.auto}();return null===t?e:t.createHTML(e)}function Lt(e,t){for(let n of t.keyAttributes){let t=e.getAttribute(n);if(null!==t&&t.length>0)return`${n}=${t}`}}function Pt(e,t,n){if(!It(e,t))return t;let i=n.boundary??Ae,r=i(e),l=i(t);if(r||l)return r&&l&&(n.retainBoundary?.(e,t)??1)?e:t;let a=jt(e);return function(e,t){for(let n of Array.from(e.attributes))t.hasAttribute(n.name)||Yl.has(n.name.toLowerCase())||e.removeAttribute(n.name);for(let n of Array.from(t.attributes))e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value)}(e,t),!0!==n.retainChildrenOf?.(e,t)&&function(e,t,n){let i=function(e,t){let n,i=new Map;for(let r of Array.from(e.children)){let e=Lt(r,t);if(void 0!==e){if(i.has(e)){n??(n=e.slice(e.indexOf("=")+1));continue}i.set(e,r)}}return void 0!==n&&t.onDuplicateKey?.(e,n),i}(e,n),r=new Set(i.values()),l=Array.from(e.childNodes).filter(e=>!r.has(e)),a=new Set,o=new Set,s=Array.from(t.childNodes),u=e.firstChild,d=0;for(let t=0;t<s.length;t+=1){let r=s[t],c=null,h=r instanceof Element?Lt(r,n):void 0;if(void 0!==h&&o.has(h)&&(h=void 0),void 0!==h){o.add(h);let e=i.get(h);if(void 0!==e&&!a.has(e)&&(c=xt(e,r,n)===e?e:null,null===c)){e.replaceWith(r),a.add(r),u=r.nextSibling;continue}}else{for(;d<l.length;){let i=l[d];if(d+=1,!a.has(i)){if(It(i,r)){c=xt(i,r,n)===i?i:null,null===c&&(e.replaceChild(r,i),a.add(r),u=r.nextSibling);break}if(i instanceof Element){let n=s[t+1];if(!(r instanceof Element)||void 0!==n&&It(i,n)){d-=1;break}e.replaceChild(r,i),a.add(r),u=r.nextSibling;break}if(!(r instanceof Element)){e.replaceChild(r,i),a.add(r),u=r.nextSibling;break}}}if(null===c&&a.has(r))continue}let f=c??r;for(a.add(f);null!==u&&u!==f&&!a.has(u)&&Ut(u);)u=u.nextSibling;f!==u&&e.insertBefore(f,u),u=f.nextSibling}for(let t of Array.from(e.childNodes))a.has(t)||t.remove()}(e,t,n),Dt(a),e}function xt(e,t,n){return e instanceof Element&&t instanceof Element?Pt(e,t,n):(e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e)}function Ut(e){return e.nodeType===Node.TEXT_NODE&&0===(e.nodeValue??"").trim().length}function It(e,t){return e.nodeType===t.nodeType&&(!(e instanceof Element&&t instanceof Element)||e.tagName===t.tagName&&e.namespaceURI===t.namespaceURI)}function jt(e){let t=e.ownerDocument.activeElement;return t instanceof HTMLElement&&e.contains(t)?{element:t,selection:t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?[t.selectionStart,t.selectionEnd]:null}:null}function Dt(e){if(null===e)return;let{element:t,selection:n}=e;if(t.ownerDocument.activeElement!==t&&t.isConnected)try{t.focus({preventScroll:!0});let[e,i]=n??[null,null];null!==e&&null!==i&&t.setSelectionRange(e,i)}catch{}}function Wt(e){ta.has(e)||(ta.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(na)?"A binding inside CMS content is refused by design \\u2014 an editor could otherwise aim a write at any element on the page (docs/security.md)":"id"===e||"name"===e?"CMS content that can name an element can shadow a global of that name \\u2014 DOM clobbering, refused by design (docs/security.md)":"Put it on an element the template owns, or set `sanitizerPolicy: \'compat\'` to keep every `data-*` as 1.x did"}(e)}.`))}function Bt(e,t){return _t(e,void 0,t)}function _t(e,t,n){let i=n?.document??qt();if(!i)throw zt();if(""===e)return"";let r=function(e,t){let n=e?.policy??t??ma;if(!e){let e=new Map;for(let[t,n]of Object.entries(da))e.set(t,n);return{allowedTags:ia,attrByTag:e,allowFormControls:!1,templateMode:!1,mode:n,allowedData:new Set}}let i=new Set(ia);if(e.additionalAllowedTags?.forEach(e=>i.add(e)),!0===e.allowFormControls)for(let e of ra)i.add(e);let r=new Map;for(let[e,t]of Object.entries(da))r.set(e,t);for(let[t,n]of Object.entries(e.additionalAllowedAttributes??{})){let e=new Set(r.get(t));for(let t of n)e.add(t);r.set(t,e)}return{allowedTags:i,attrByTag:r,allowFormControls:!0===e.allowFormControls,templateMode:!0===e.templateMode,mode:n,allowedData:new Set(e.allowedDataAttributes?.map(e=>e.toLowerCase()))}}(n,t),l=e;for(let e=0;e<ha;e+=1){let e=i.createElement("template");e.innerHTML=Et(l);let t=e.content;Ht(t,r);let n=Vt(t);if(n===l)return n;l=n}return function(e,t){if(!function(){try{let e=glo','balThis.process?.env;return void 0!==e&&"production"!==e.NODE_ENV}catch{return!1}}())return;let n=globalThis,i=n[ea]??(n[ea]=new Set);if(!i.has(e)){i.add(e);try{console.warn(`[payload-live-preview] ${t}`)}catch{}}}("sanitizer-unsettled",`sanitizeHtml: the output did not settle after ${String(ha)} passes, so it returned an empty string (ADR 0016).`),""}function zt(){return new Error("sanitizeHtml needs a DOM")}function Vt(e){let t=e.ownerDocument?.createElement("div");if(void 0===t)throw zt();let n=e.firstChild;if(t.append(e),t.firstChild!==n)throw zt();return t.innerHTML}function qt(){if(!(typ','eof document>"u"))return document}function Ht(e,t){for(let n of Array.from(e.childNodes))n.nodeType===fa?Gt(n,t):n.nodeType===pa&&n.remove()}function Gt(e,t){let n=e.tagName.toLowerCase();!la.has(n)||t.allowFormControls&&ra.has(n)?t.allowedTags.has(n)?(function(e,t,n){let i=n.attrByTag.get(t);for(let t of Array.from(e.attributes)){let r=t.name.toLowerCase();if(r.startsWith("on")||"style"===r)e.removeAttribute(t.name);else if("is"!==r){if("strict"===n.mode){if(n.templateMode&&ga.has(r))continue;if("id"===r||"name"===r||r.startsWith(ua)){e.removeAttribute(t.name),("name"!==r||!0===i?.has(r))&&Wt(r);continue}if(r.startsWith(sa)){n.allowedData.has(r)||(e.removeAttribute(t.name),Wt(r));continue}if(aa.has(r)||r.startsWith(oa))continue}else if(aa.has(r)||r.startsWith(oa)||r.startsWith(sa))continue;i?.has(r)?(ca.has(r)&&!M(t.value)||"srcset"===r&&!Kt(t.value)||"ping"===r&&!t.value.trim().split(/\\s+/u).every(M))&&e.removeAttribute(t.name):e.removeAttribute(t.name)}else e.setAttribute("is","")}}(e,n,t),"a"===n&&function(e){let t=e.getAttribute("href");null===t||!O(t)||(e.setAttribute("rel","noopener noreferrer"),e.hasAttribute("target")||e.setAttribute("target","_blank"))}(e),Ht(e,t)):(Ht(e,t),e.replaceWith(...e.childNodes)):e.remove()}function Kt(e){for(let t of e.split(",")){let e=t.trim();if(0===e.length)continue;let[n=e]=e.split(/\\s/,1);if(!M(n)||!M(e))return!1}return!0}function Jt(e){return e.replace(ya,e=>va[e])}function Xt(e){return e.replace(wa,e=>ba[e])}function Qt(e){let t=new Set;for(let n of e)if("object"==typeof n&&null!==n)for(let e of Object.keys(n))t.add(e);return t}function Zt(e,t,n,i,r){let l="object"==typeof t&&null!==t?t:null;return e.replace(Sa,(e,a)=>null!==l&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(l,a)?Jt(i(Reflect.get(l,a))):null===l&&"value"===a?Jt(i(t)):"index"===a?String(n):null!==l&&!0===r?.has(a)?"":e)}function Yt(e){let t=e.children,n=t[0];if(void 0===n)return[];let i=[];for(let{name:e,value:r}of Array.from(n.attributes)){if(!E(e)||e.startsWith(Aa))continue;let n=!0;for(let i=1;i<t.length&&n;i+=1)n=t[i]?.getAttribute(e)===r;n&&i.push([e,r])}return i}function en(e,t){for(let[n,i]of t)e.hasAttribute(n)||e.setAttribute(n,i)}function tn(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 nn(e){return null==e||""===e}function rn(e,t){let n=e.get(t);return void 0!==n&&(e.delete(t),e.set(t,n)),n}function ln(e,t,n,i){return e.set(t,n),function(e,t){for(let n of e.keys()){if(e.size<=t)break;e.delete(n)}}(e,i),n}function an(e){let t=rn($a,e);if(void 0!==t)return t;let n=new Set(ka);for(let t of e.matchAll(Ca)){let e=t[1]?.toLowerCase();void 0!==e&&n.add(e)}let i={};for(let e of n)i[e]=Ta;let r={additionalAllowedTags:[...n],additionalAllowedAttributes:i,allowFormControls:!0,templateMode:!0};return ln($a,e,r,Ra)}function on(e){let t=un(e.container,e.patches,e);return null===t?null:dn(t,e.store,{morph:e.morph??!0,onDuplicateKey:e.onDuplicateKey})}function sn(e,t){return t.hasAttribute(Na)&&t.hasAttribute(Ma)}function un(e,t,n){let i=function(e,t,n){let{template:i,nextItems:r,forceRender:l=!1,store:a,sanitizerPolicy:o}=n,s=a.get(e),u=Yt(e),d=Qt(r),c=Array.from(e.children),h=vn(c,Fa),f=new Set,p=[];for(let a=0;a<r.length;a+=1){let g=r[a],m=mn(g),v=void 0===m?c[a]??null:yn(h,m)??null;null!==v&&f.has(v)&&(v=null),null!==v&&f.add(v);let y=t.replaces.has(a),b=l||t.renders.has(a)||null===v?bn(e.ownerDocument,i,g,a,o,u,d):void 0;if(null===b)return null;let w=void 0===b?[]:cn(y?null:v,b,g,void 0===m?void 0:s?.get(m),n);if(null===w)return null;p.push([a,v,b,w,y])}return p}(e,function(e){let t=new Set,n=new Set;for(let i of e)"insert"===i.kind||"update"===i.kind?t.add(i.index):"replace"===i.kind&&(t.add(i.index),n.add(i.index));return{renders:t,replaces:n}}(t),n);return null===i?null:[e,i,n.nextItems]}function dn(e,t,n){let[i,r,l]=e,a=new Set,o=!1,s=jt(i);for(let[e,l,s,u,d]of r){let r=l;if(void 0!==s){let e=!(!n.morph||d||null===l)&&Pt(l,s,{keyAttributes:[Fa,Na],boundary:Ae,retainBoundary:Fe,retainChildrenOf:sn,...void 0!==n.onDuplicateKey?{onDuplicateKey:n.onDuplicateKey}:{}})===l;if(!e)for(let[e,t]of u)null!==e&&(fn(e,t),t.replaceWith(e));for(let[,,e]of u)void 0!==e&&dn(e,t,n);e?o=!0:(null!==l&&(l.replaceWith(s),o=!0),r=s)}if(null===r)continue;let c=i.children[e]??null;r!==c&&(i.insertBefore(r,c),o=!0),a.add(r)}for(let e of Array.from(i.children))a.has(e)||(e.remove(),o=!0);Dt(s);let u=function(e,t){let n=t.get(e);return n||(n=new Map,t.set(e,n)),n}(i,t);u.clear();for(let e of l)gn(u,e);return o}function cn(e,t,n,i,r){let l=vn(null===e?[]:hn(e),Na),a=[];for(let e of hn(t)){let t=e.getAttribute(Na);if(null===t)continue;let o,s=yn(l,t)??null,u=e.getAttribute(Ma),d=u?s:null,c=d?.getAttribute(Ma)??null;if(u){let l=pn(n,t);if(void 0!==l||null!==d){let n=l??[],a=F(null===d?[]:pn(i,t)??[],n),s=null!==d&&c!==u;if((a.length>0||s)&&(o=un(d??e,a,{template:u,nextItems:n,forceRender:s,store:r.store,sanitizerPolicy:r.sanitizerPolicy})??void 0,void 0===o))return null}}a.push([d,e,o])}return a}function hn(e){return Array.from(e.querySelectorAll(`[${Na}]`)).filter(t=>{let n=t.parentElement;for(;null!==n&&n!==e;){if(n.hasAttribute(Na))return!1;n=n.parentElement}return n===e})}function fn(e,t){for(let n of Array.from(e.attributes))t.hasAttribute(n.name)||e.removeAttribute(n.name);for(let n of Array.from(t.attributes))e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value)}function pn(e,t){if("object"!=typeof e||null===e)return;let n=e[t];return Array.isArray(n)?n:void 0}function gn(e,t){let n=mn(t);void 0!==n&&e.set(n,t)}function mn(e){if("object"!=typeof e||null===e)return;let t=e.id;return"string"==typeof t||"number"==typeof t?String(t):void 0}function vn(e,t){let n=new Map;for(let i=e.length-1;i>=0;i-=1){let r=e[i];if(void 0===r)continue;let l=r.getAttribute(t);if(null===l)continue;let a=n.get(l);void 0===a?n.set(l,[r]):a.push(r)}return n}function yn(e,t){return e.get(t)?.pop()}function bn(e,t,n,i,r,l,a){let o=_t(Zt(t,n,i,tn,a),r,an(t)),s=e.createElement("template");s.innerHTML=Et(o);let u=s.content.firstElementChild;if(!u)return null;en(u,l);let d=mn(n);return void 0!==d&&u.setAttribute(Fa,d),u}function wn(e,t,n){if(t.warnedEscalationUnavailable)return;t.warnedEscalationUnavailable=!0;let i=`[live-preview] LP0808: onUnfaithfulPatch: \'escalate\' has nowhere to go: ${String(n)} field(s) fell short`,r="or onUnfaithfulPatch: \'warn\' to keep the patch and say so.";e.warn(void 0===e.strategies.fragment?`${i} and no route or fragment strategy is configured. Set routeStrategy: true or fragments: { endpoint }, ${r}`:`${i}, not all of them inside a data-payload-fragment boundary of this document, and no route strategy is configured. Cover them with a boundary or add the route strategy, ${r}`)}function Sn(e,t){return!1===t||q(Oe(e),t)}function An(t,n,i,r,l){let a=t.transformValue;if(void 0===a)return i;try{let t=a(n.fieldName,i,{element:n.element,allFields:r},l),o=e(t);if(!l())return i;if(o)throw new TypeError(`Transform for "${n.fieldName}" returned a thenable; transforms must be synchronous`);return t}catch(e){if(!l())return i;let n=e instanceof Error?e:new Error(String(e));return t.emitter.emit("error",{error:n,context:"transform",code:"LP0602"}),i}}function kn(e){if(!0!==e.hidesWhenEmpty)return!1;let{element:t}=e;if(t.hasAttribute("hidden"))return!0;let n=t.getBoundingClientRect();return 0===n.width||0===n.height}function Tn(e){let t=e.trim();if(0!==t.length)try{let e=new URL(t);return"http:"!==e.protocol&&"https:"!==e.protocol||!Da.test(e.origin)?void 0:e.origin}catch{return}}function Cn(e){let t=e.format;return"string"==typeof t&&Ha.has(t)?t:"number"==typeof t?qa[t]:void 0}function Rn(e){let t=e.indent;return"number"==typeof t&&t>0?t:0}function $n(e){return"rtl"===e.direction?\' dir="rtl"\':"ltr"===e.direction?\' dir="ltr"\':""}function Fn(e){let t=Cn(e),n=Rn(e),i=[];return void 0!==t&&i.push(`lp-align-${t}`),n>0&&i.push(`lp-indent-${String(n)}`),0===i.length?"":` class="${i.join(" ")}"`}function Nn(e){return"object"==typeof e&&null!==e?e:void 0}function Mn(e){return Nn(e)}function On(e,t){if(void 0===t||""===t||!e.startsWith("/"))return e;try{let n=new URL(t),i=new URL(e,n);return i.origin===n.origin?i.href:e}catch{return e}}function En(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-").toLowerCase()}function Ln(e){return"string"==typeof e&&e.length>0?e:void 0}function Pn(e){let t=Ln(e.title)??Ln(e.name)??Ln(e.slug);return void 0!==t?t:void 0===e.id?void 0:String(e.id)}function xn(e){if("string"==typeof e.text)return e.text;if(!e.children)return"";let t="";for(let n of e.children)t+=xn(n);return t}function Un(e){return`${"number"==typeof e.width?` width="${String(e.width)}"`:""}${"number"==typeof e.height?` height="${String(e.height)}"`:""}`}function In(e){return"string"==typeof e.mimeType?` type="${Xt(e.mimeType)}"`:""}function jn(e){return Qa.get(e)}function Dn(e,t,n,i){let r=Nn(e.fields)??{},l="string"==typeof r.blockType?r.blockType:"",a=En(l),o=""===a?i:`${i} ${i}--${a}`;if(""!==l){let e=jn(l)??jn(a);if(e)return e(r,{renderChildren:t.renderChildren});t.onUnrenderedBlock?.(l,o,r)}return`<${n} class="${o}"></${n}>`}function Wn(e,t){return"number"==typeof t&&t>1?` ${e}="${String(t)}"`:""}function Bn(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 _n(e,t){let n=function(e){return eo.get(e)??Ya[e]}(e.type);return n?n(e,t):void 0!==e.children?t.renderChildren(e.children):""}function zn(e){if("string"==typeof e.text)return e.text;if("linebreak"===e.type)return"\\n";if(void 0===e.children)return"";let t="";for(let n of e.children)t+=zn(n);return t}function Vn(e="text"){let t=new WeakSet;return{name:e,render:L((e,n)=>{let i=e.element,r=function(e){return null==e?"":Bn(e)?function(e){return Bn(e)?e.root.children.map(zn).join("\\n").trim():""}(e):"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):JSON.stringify(e)}(n);if("INPUT"!==i.tagName&&"TEXTAREA"!==i.tagName){if(i.textContent.trim()!==r.trim()){if(function(e){return null!==e.querySelector(":scope > :not(br)")}(i)&&!i.hasAttribute(no))return function(e,t,n){e.has(t)||(e.add(t),Ri(`[live-preview] LP0402: Skipping text update for "${n}": <${t.tagName.toLowerCase()}> has structured children. Move data-payload-field to the value element, or add data-payload-text to replace them.`))}(t,i,e.fieldName),!1;if(r.includes("\\n")||r.includes("\\r")){i.innerHTML=Et(function(e){return Jt(e).replace(/\\r\\n|\\r|\\n/g,"<br>")}(r));return}i.textContent=r}}else i.value=r})}}function qn(e,t){let n=e.cloneNode(!1);n.innerHTML=Et(t);let i=function(e,t){let n=e.firstElementChild,i=1===t.children.length?t.firstElementChild:null;if(null!==n?.nextElementSibling||0===t.children.length||!ao.has(n.tagName)||n.hasAttribute(Er)||i?.tagName===n.tagName||!0===i?.matches(Za))return null;for(let e of t.children)if(e.tagName===n.tagName&&e.className===n.className)return null;return n}(e,n)??e,r=new Map,l=n.querySelectorAll(Za);if(l.length>0&&null!==i.firstElementChild){let e=[];Hn(i,n,e);for(let[t,n]of e)t.replaceWith(n),n.matches(Za)||r.set(t.className,!1);for(let e of l)null!==e.parentNode&&r.set(e.className,!0)}return i.replaceChildren(...n.childNodes),r}function Hn(e,t,n){let i=(e,t)=>{e.matches(Za)?n.push([e,t]):Hn(t,e,n)},r=e.firstElementChild,l=t.firstElementChild;if(e.children.length===t.children.length){for(;null!==r&&null!==l;r=r.nextElementSibling)i(l,r),l=l.nextElementSibling;return}let a=new Set;for(let e of t.children)e.matches(Za)||a.add(e.tagName);let o=(e,t)=>e.matches(Za)?!a.has(t.tagName):e.tagName===t.tagName,s=0;for(;null!==r&&null!==l&&o(l,r);s+=1)i(l,r),r=r.nextElementSibling,l=l.nextElementSibling;let u=Math.min(e.children.length,t.children.length);r=e.lastElementChild,l=t.lastElementChild;for(let e=s;e<u&&null!==r&&null!==l;e+=1){if(!o(l,r))return;i(l,r),r=r.previousElementSibling,l=l.previousElementSibling}}function Gn(e,t,n,i){i&&t.reportUnfaithful?.(e,`lost the markup the server drew for block "${n}"`);let r=i?ro:io;r.has(n)||(r.add(n),Ri(`[live-preview] ${i?`LP0413: no renderer for block "${n}", and the markup the server rendered for it is lost.`:`LP0410: no renderer for block "${n}"; keeping what the server rendered for it.`} Register one with registerBlockRenderer().`))}function Kn(e,t,n,i){if("string"!=typeof n||0===n.length)return{kind:"none"};let r=On(n,i);return M(r)?{kind:"safe",url:r}:(uo.has(e)||(uo.add(e),Ri(`[live-preview] LP0401: refused an unsafe URL for "${t}" on <${e.tagName.toLowerCase()}>; the attribute was cleared.`)),{kind:"unsafe"})}function Jn(e,t=e=>e){return{name:e,render(e,n,i){let r=e.element;if(nn(n)){!function(e){"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):e.value=""}(r);return}let l=tn(n);if("INPUT"!==r.tagName&&"TEXTAREA"!==r.tagName){if("A"===r.tagName){let n=e.hrefField,a=void 0===n||0===n.length?t(l):x(i.allFields,n,i.locale,void 0!==e.locale),o=Kn(r,e.fieldName,a);"safe"===o.kind?r.setAttribute("href",o.url):"unsafe"===o.kind&&r.removeAttribute("href")}r.textContent=l}else r.value=l}}}function Xn(e){for(let t of po)e.removeAttribute(t);Qn(e)}function Qn(e){if("PICTURE"===e.parentElement?.tagName)for(let t of e.parentElement.querySelectorAll("source"))t.remove()}function Zn(e,t,n,i){let r=function(e,t){let n=[];for(let[i,r]of Object.entries(e?.sizes??e?.variants??{})){if("string"!=typeof r.url||"number"!=typeof r.width)continue;let e=On(r.url,t);M(e)&&n.push({...r,name:i,url:e,width:r.width})}return n}(n,i),l=e.getAttribute("src"),a=r.find(t=>null!==l&&Yn(e,t.url,l))??r.find(t=>t.name===go.get(e));void 0===a?.name?go.delete(e):go.set(e,a.name),(null===l||!(Yn(e,t,l)||r.some(t=>Yn(e,t.url,l))))&&Qn(e),e.src=a?.url??t;let o=a??n,s=r.filter(e=>ei(e,o)),u=s.length>0?s:r.filter(e=>ei({...e,mimeType:void 0},o));if(0===u.length){e.removeAttribute("srcset"),e.removeAttribute("sizes");return}if("number"==typeof n?.width&&"string"==typeof n.url){let e=On(n.url,i),t={...n,url:e,width:n.width};M(e)&&ei(t,o)&&u.push(t)}let d=new Set,c=[];for(let e of u)d.has(e.width)||(d.add(e.width),c.push(`${ti(e.url)} ${String(e.width)}w`));let h=c.join(", ");e.setAttribute("srcset",h)}function Yn(e,t,n){try{return new URL(t,e.baseURI).href===new URL(n,e.baseURI).href}catch{return t===n}}function ei(e,t){if(void 0===t)return!0;if("string"==typeof e.mimeType&&"string"==typeof t.mimeType&&e.mimeType!==t.mimeType)return!1;let{width:n,height:i}=t;return"number"!=typeof n||"number"!=typeof i||"number"!=typeof e.width||"number"!=typeof e.height||Math.abs(e.width*i-e.height*n)<=Math.max(n,e.width)}function ti(e){return e.replace(/[\\s,]/g,encodeURIComponent)}function ni(e){"IMG"===e.tagName?Xn(e):e.style.backgroundImage=""}function ii(e){"IMG"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):Xn(e)}function ri(e){let t=Nn(e);return void 0===t?tn(e):Pn(t)??""}function li(e,t){let n=e??"";if(null==t)return n;let i=ai(t);return"{}"===i?n:`${n}|${i}`}function ai(e){if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(e=>ai(e)).join(",")}]`;let t=e,n=Object.keys(t).sort(),i=[];for(let e of n){let n=t[e];void 0!==n&&i.push(`${JSON.stringify(e)}:${ai(n)}`)}return`{${i.join(",")}}`}function oi(e){return{kind:"date",options:e}}function si(e){return{kind:"number",options:e}}function ui(e,t,n,i){if(void 0===t||""===t)return;let r=function(e){let t=e.indexOf(":"),n=-1===t?e:e.slice(0,t),i=-1===t?void 0:e.slice(t+1);switch(n){case"date":return void 0===i?oi({dateStyle:"medium"}):Co.has(i)?oi({dateStyle:i}):void 0;case"time":return void 0===i?oi({timeStyle:"short"}):Ro.has(i)?oi({timeStyle:i}):void 0;case"datetime":return void 0===i?oi({dateStyle:"medium",timeStyle:"short"}):Co.has(i)?oi({dateStyle:i,timeStyle:"short"===i?"short":"medium"}):void 0;case"number":return void 0===i?si({}):Fo.test(i)?si({minimumFractionDigits:Number(i),maximumFractionDigits:Number(i)}):void 0;case"currency":return void 0!==i&&$o.test(i)?si({style:"currency",currency:i.toUpperCase()}):void 0;case"percent":return void 0===i?si({style:"percent"}):void 0;default:return}}(t);if(void 0!==r)return r.kind===e?r.options:void 0;!function(e,t,n){No.has(e)||(No.add(e),Ri(`[live-preview] LP0408: data-payload-format="${n}" on "${t}" is not a known format; the default formatting was used. Known: date, time, datetime (each also :short|medium|long|full), number, number:0-4, currency:XXX, percent.`))}(n,i,t)}function di(e){return String(e).padStart(2,"0")}function ci(){let e=new WeakMap,t=new WeakSet,n=new WeakMap,i=new WeakMap;return{name:"structural-array",render:L((r,l,a)=>{let o=nn(l)?[]:l;if(!Array.isArray(o))return!1;let s=r.element,u=r.arrayTemplate;if(void 0===u||0===u.length)return function(e,t,n){e.has(t)||(e.add(t),Ri(`[live-preview] LP0403: Skipping structural update for "${n}": <${t.tagName.toLowerCase()} data-payload-structural> needs data-payload-array-template (for example "<li>{{label}}</li>").`))}(t,s,r.fieldName),!1;let d=e.get(s),c=hi(s),h=d?.values??function(e){return e.map((e,t)=>null===e?{__payloadDomPosition:t}:{id:e})}(c),f=F(h,o),p=function(e,t,n){return void 0===e||e.template!==t||!function(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}(e.domSnapshot,n)}(d,u,c);if(0===f.length&&!p)return e.set(s,{values:o.slice(),template:u,domSnapshot:c}),!1;!function(e,t,n,i,r){let l=r.map(fi),a=new Set,o=l.find(e=>!(void 0===e||!a.has(e)&&(a.add(e),1)));if(void 0!==o&&pi(e,t,n,o),l.some(e=>void 0===e)&&gi(e,t,"LP0404",`LP0404: an item of "${n}" has no id and pairs by position, so an insert re-renders every row after it. Give items a stable id.`),i?.length===r.length&&r.length>1){let r=new Set(i.map(fi).filter(e=>void 0!==e)),a=l.some(e=>void 0!==e&&r.has(e));r.size>0&&!a&&gi(e,t,"LP0406",`LP0406: every key of "${n}" changed at once; the source generates ids per message, so no item can be retained across updates.`)}}(n,s,r.fieldName,d?.values,o);let g=on({template:u,container:s,patches:f,nextItems:o,store:i,forceRender:p,sanitizerPolicy:a.sanitizerPolicy,onDuplicateKey:(e,t)=>{pi(n,e,r.fieldName,t)}});return null!==g&&(e.set(s,{values:o.slice(),template:u,domSnapshot:hi(s)}),!!g&&void 0)})}}function hi(e){return Array.from(e.children,e=>e.getAttribute(Fa))}function fi(e){if("object"!=typeof e||null===e)return;let t=e.id;return"string"==typeof t||"number"==typeof t?String(t):void 0}function pi(e,t,n,i){gi(e,t,"LP0405",`LP0405: two items of "${n}" share the key "${i}"; later ones pair by position. Make \\`id\\` unique per item.`)}function gi(e,t,n,i){let r=e.get(t);void 0===r&&(r=new Set,e.set(t,r)),!r.has(n)&&(r.add(n),Ri(`[live-preview] ${i}`))}function mi(){return typeof __LIVE_PREVIEW_CONFIG__>"u"?[]:__LIVE_PREVIEW_CONFIG__}var vi=Object.defineProperty,yi=e=>{throw TypeError(e)},bi=(e,t,n)=>((e,t,n)=>t in e?vi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),wi=(e,t,n)=>t.has(e)||yi("Cannot "+n),Si=(e,t,n)=>(wi(e,t,"read from private field"),n?n.call(e):t.get(e)),Ai=(e,t,n)=>t.has(e)?yi("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ki=(e,t,n,i)=>(wi(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),Ti=(e,t,n)=>(wi(e,t,"access private method"),n),Ci=t((...e)=>console.error(...e)),Ri=t((...e)=>console.warn(...e)),$i=t((...e)=>console.debug(...e)),Fi=class{constructor(){Ai(this,Oi);Ai(this,Ni,new Map);Ai(this,Mi,new Map)}on(e,t){return Ti(this,Oi,Li).call(this,Si(this,Ni),e,t)}once(e,t){return Ti(this,Oi,Li).call(this,Si(this,Mi),e,t)}off(e,t){Ti(this,Oi,Pi).call(this,Si(this,Ni),e,t),Ti(this,Oi,Pi).call(this,Si(this,Mi),e,t)}async emit(e,t){await Ti(this,Oi,Ei).call(this,e,t)}async emitWhile(e,t,n){return Ti(this,Oi,Ei).call(this,e,t,n)}listenerCount(e){return(Si(this,Ni).get(e)?.size??0)+(Si(this,Mi).get(e)?.size??0)}removeAllListeners(e){void 0!==e?(Si(this,Ni).delete(e),Si(this,Mi).delete(e)):(Si(this,Ni).clear(),Si(this,Mi).clear())}eventNames(){let e=new Set;for(let t of Si(this,Ni).keys())e.add(t);for(let t of Si(this,Mi).keys())e.add(t);return[...e]}},Ni=new WeakMap,Mi=new WeakMap,Oi=new WeakSet,Ei=async function(e,t,n){let i=()=>n?.()??!0;if(!i())return!1;let r=Si(this,Ni).get(e);if(r)for(let n of[...r])if(!i()||(await Ti(this,Oi,xi).call(this,n,t,e),!i()))return!1;if(!i())return!1;let l=Si(this,Mi).get(e);if(l&&l.size>0){let n=[...l];Si(this,Mi).delete(e);for(let r of n)if(!i()||(await Ti(this,Oi,xi).call(this,r,t,e),!i()))return!1}return i()},Li=function(e,t,n){let i=e.get(t);return i||(i=new Set,e.set(t,i)),i.add(n),()=>{Ti(this,Oi,Pi).call(this,e,t,n)}},Pi=function(e,t,n){let i=e.get(t);void 0!==i&&(i.delete(n),0===i.size&&e.delete(t))},xi=async function(e,t,n){try{await e(t)}catch(e){let t="string"==typeof n||"number"==typeof n?String(n):"<event>";Ci(`[live-preview] LP0601: handler for "${t}" threw:`,e)}},Ui=1e3,Ii=new Set(["date","number","checkbox","select","radio"]),ji=40,Di="payload-live-preview-a11y",Wi=new WeakMap,Bi=class{constructor(e,t){bi(this,"german");bi(this,"document");bi(this,"lease",null);let n=t??(typ','eof document>"u"?null:document),i=n?.documentElement.getAttribute("lang")??"";this.german=function(e){return/^de(?:[-_]|$)/i.test(e)}(e??(i.length>0?i:d())),this.document=n}mount(){let e=this.document;if(null==e?.body)return null;this.lease??(this.lease=function(e){let t=Wi.get(e);return void 0===t&&(t={element:null,owned:!1,messageNode:null,refs:0,timer:null},Wi.set(e,t)),t.refs+=1,t}(e));let t=this.lease,n=t.element;if(n?.isConnected&&n.ownerDocument===e)return n;if(null!==n){let e=t.owned;c(t),e&&n.remove()}let i=e.getElementById(Di);return t.owned=null===i,null===i&&(i=e.createElement("div"),i.id=Di,i.setAttribute("role","status"),i.setAttribute("aria-live","polite"),i.setAttribute("aria-atomic","true"),i.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0",e.body.appendChild(i)),t.element=i,i}announceConnected(){this.say(this.german?"Vorschau verbunden":"Live preview connected")}announceDisconnected(){this.say(this.german?"Vorschau getrennt":"Live preview disconnected")}announceUpdate(e){e<=0||this.say(this.german?`${String(e)} ${1===e?"\\xc4nderung":"\\xc4nderungen"} angewendet`:`${String(e)} ${1===e?"change":"changes"} applied`)}announcePartial(){this.say(this.german?"Vorschau teilweise aktualisiert":"Preview partly updated")}detach(){let e=this.lease,t=this.document;if(null===e||null===t||(this.lease=null,e.refs-=1,e.refs>0))return;let n=e.element;null!==n&&c(e),e.owned&&n?.remove(),e.element=null,Wi.delete(t)}say(e){let t=this.mount(),n=this.lease;if(null===t||null===n)return;let i=n.messageNode;i?.parentNode!==t?(i?.remove(),i=t.ownerDocument.createTextNode(t.hasChildNodes()?` ${e}`:e),n.messageNode=i,t.appendChild(i)):i.data=null===i.previousSibling?e:` ${e}`,null!==n.timer&&clearTimeout(n.timer);let r=setTimeout(()=>{n.timer===r&&n.element===t&&c(n)},1500);n.timer=r}},_i=["data","fieldSchemaJSON","globalSlug","collectionSlug","locale","ready","previewToken","protocolVersion"],zi={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"}},Vi=Object.keys(zi),qi=class{constructor(e,t){bi(this,"matcher");bi(this,"handlers");bi(this,"boundListener");bi(this,"attachedTarget");bi(this,"generation",0);bi(this,"revision",0);bi(this,"queueHead");bi(this,"queueTail");bi(this,"lastAccepted");bi(this,"replayedGeneration",0);bi(this,"latestAcceptedAttempt");this.matcher=e,this.handlers=t}attach(e=window){if(void 0!==this.attachedTarget)return;let t=!1,n=i=>{if(!t||this.boundListener!==n)return;let r=this.generation;try{this.receive(i,r,e)}catch{let e;try{e=i.origin}catch{e=""}this.reportInvalid("shape",e,r)}};this.generation+=1,this.resetQueue(),this.attachedTarget=e,this.boundListener=n;try{e.addEventListener("message",n)}catch(t){this.boundListener===n&&(this.attachedTarget=void 0,this.boundListener=void 0,this.resetQueue());try{e.removeEventListener("message",n)}catch{}throw t}if(this.boundListener===n)t=!0;else try{e.removeEventListener("message",n)}catch{}}detach(){let e=this.attachedTarget,t=this.boundListener;void 0===e||void 0===t||(this.attachedTarget=void 0,this.boundListener=void 0,this.resetQueue(),e.removeEventListener("message",t))}advanceGeneration(){return void 0!==this.attachedTarget&&(this.generation+=1,this.resetQueue(),!0)}replayLastAccepted(){let e=this.lastAccepted,t=this.generation,n=this.handlers.onReplay;if(void 0===n||void 0===e||e.generation>=t||this.replayedGeneration===t||!this.matchesOrigin(e.origin,t)||this.lastAccepted!==e)return!1;this.replayedGeneration=t;let i={generation:t,revision:this.revision+=1};return this.invokeHandler(t,n,structuredClone(e.message),e.origin,i),!0}forgetLastAccepted(){this.lastAccepted=void 0,this.replayedGeneration=0,this.latestAcceptedAttempt=void 0}static sendReady(e,t){let n={type:"payload-live-preview",ready:!0,protocolVersion:4};for(let i of e)for(let e of t)try{i.postMessage(n,e)}catch{}}receive(e,t,n){let i=e.origin;if(!this.matchesOrigin(i,t)){this.reportInvalid("origin",i,t);return}if(!this.matchesSource(e,n)){this.reportInvalid("source",i,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&&!b(t.data))&&y(t.fieldSchemaJSON,e=>Array.isArray(e))&&y(t.globalSlug,e=>"string"==typeof e)&&y(t.collectionSlug,e=>"string"==typeof e)&&y(t.locale,e=>"string"==typeof e)&&y(t.ready,e=>"boolean"==typeof e)&&y(t.previewToken,e=>"string"==typeof e)&&y(t.protocolVersion,e=>"number"==typeof e)}(r)){this.reportInvalid("shape",i,t);return}this.dispatchUpdate(function(e){let t={...e};for(let e of _i)null===Reflect.get(t,e)&&Reflect.deleteProperty(t,e);return Array.isArray(t.fieldSchemaJSON)?{...t,fieldSchemaJSON:p(t.fieldSchemaJSON)}:t}(r),i,t);return;case"payload-document-event":if(!function(e){let t=e;return v(t.action,e=>"updated"===e||"created"===e||"deleted"===e)&&v(t.slug,e=>"string"==typeof e)&&v(t.id,e=>"string"==typeof e||Number.isFinite(e))}(r)){this.reportInvalid("shape",i,t);return}this.invokeHandler(t,this.handlers.onDocumentEvent,r,i);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",i,t);return}this.invokeHandler(t,this.handlers.onFocusField,e,i);return}default:this.reportInvalid("type",i,t)}else this.reportInvalid("shape",i,t)}dispatchUpdate(e,t,n){let i=b(e.data);if(!this.isCurrentGeneration(n))return;let r=i?{generation:n,revision:this.revision+=1}:void 0,l=this.handlers.validateToken;if(!this.isCurrentGeneration(n))return;if(void 0===l){this.commitUpdate(e,t,n,r);return}if(!0===e.ready&&void 0===e.data){this.commitUpdate(e,t,n,void 0);return}let a={generation:n,message:e,origin:t,messageRevision:r,verdict:void 0,next:void 0};this.enqueue(a);let o;try{o=l(e.previewToken,t)}catch{this.settleValidation(a,!1);return}"boolean"!=typeof o?Promise.resolve(o).then(e=>{this.settleValidation(a,!0===e)},()=>{this.settleValidation(a,!1)}):this.settleValidation(a,o)}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,n,i){if(void 0===i)this.invokeHandler(n,this.handlers.onUpdate,e,t);else{let r={};this.latestAcceptedAttempt=r;let l=function(e){let t={...e};delete t.previewToken;try{return structuredClone(t)}catch{return null}}(e);if(this.latestAcceptedAttempt!==r||!this.isCurrentGeneration(n))return;this.lastAccepted=null===l?void 0:{generation:n,message:l,origin:t},this.invokeHandler(n,this.handlers.onUpdate,e,t,i)}}reportInvalid(e,t,n){this.invokeHandler(n,this.handlers.onInvalid,e,t)}matchesSource(e,t){if("parent-or-opener"!==this.handlers.sourcePolicy)return!0;try{let n=e.source;if("object"!=typeof n||null===n)return!1;let i=t.parent;return i!==t&&n===i||n===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,n,...i){if(void 0!==n&&this.isCurrentGeneration(t))try{e(n(...i))}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}},Hi=new Set(["tabs","row","collapsible"]),Gi={text:"text",textarea:"textarea",richText:"richText",email:"email",number:"number",checkbox:"checkbox",date:"date",select:"select",radio:"radio",array:"array",blocks:"blocks",group:"text",tabs:"text",row:"text",collapsible:"text",relationship:"relationship",upload:"upload",point:"text",json:"text",code:"text",ui:"text"},Ki=new Set(["http:","https:","mailto:","tel:"]),Ji=/^(?:\\.{1,2}\\/|[a-zA-Z0-9_-]+\\/?)/,Xi=/^[\\\\/]{2}/,Qi=/[\\t\\n\\r]/g,Zi=/[\\s\\u0000-\\u001f\\u180e\\u2000-\\u2029]/g,Yi=/^([a-z][a-z0-9+.-]*):/i,er=new Set(["style","srcdoc","formaction","form","id","name","is","srcset","imagesrcset"]),tr=new Set(["href","src","poster","cite","action","xlink:href","data"]),nr=new WeakSet,ir=class{constructor(){bi(this,"previous",null);bi(this,"lastFields");bi(this,"priorFields");bi(this,"keepValues",!1)}get previousFields(){return this.priorFields}get isBaseline(){return null===this.previous}diff(e,t,n=P){let r=this.previous,l=null===r,a=new Map,o=new Set,s=Object.entries(e);if(!n())return null;for(let[e,t]of s){let l=i(t);if(!n())return null;a.set(e,l),(null===r||void 0===l||r.get(e)!==l)&&o.add(e)}if(null!==r)for(let e of r.keys())a.has(e)||o.add(e);let u=new Set,d=Object.entries(t);if(!n())return null;for(let[e,t]of d)if(o.has(e))for(let e of t)if(u.add(e),!n())return null;return n()?(this.previous=a,this.priorFields=this.keepValues?this.lastFields:void 0,this.lastFields=this.keepValues?e:void 0,{changed:o,invalidated:u,baseline:l}):null}reset(){this.previous=null,this.lastFields=void 0,this.priorFields=void 0}},rr=new Set(["__proto__","prototype","constructor"]),lr="data-payload-fragment",ar="data-payload-fragment-key",or="data-payload-strategy",sr=8,ur=1024,dr=new Set(["id","_id","createdAt","updatedAt","createdBy","updatedBy","_status","globalType","collection","locale","localized"]),cr=new Set(["text","textarea","email","number","checkbox","date","select","radio","point","code","json","ui","html"]),hr=new Set(["root","paragraph","text","heading","quote","list","listitem","linebreak","tab","horizontalrule","code","code-highlight","table","tablerow","tablecell","link","autolink"]),fr={},pr=class{constructor(){bi(this,"rawChanges",new ir);bi(this,"resolved",null);bi(this,"resolvedLocale",null);bi(this,"trailing",null);bi(this,"openUntil",0);bi(this,"requestAttempt",0)}decide(e,t){let n=t.rawData;if(!function(e){let{cache:t,emitter:n}=e;if(t.islands.length>0||n.listenerCount("beforeUpdate")>0||n.listenerCount("afterUpdate")>0)return!0;for(let e of t.values())if(ae(e)||e.fieldName.includes(".")||ue(e.hrefField)||ue(e.srcField)||ue(e.altField))return!0;return void 0!==e.strategies.fragment&&null!==e.root.querySelector(`[${lr}]`)}(e)&&!function(e,t,n){for(let i of e.values()){if("text"!==i.fieldType||!0===i.explicitFieldType)continue;let e=I(t,i,i.fieldName,n);if(ve(e)&&oe(e.root))return!0}return!1}(e.cache,n,t.locale))return t.forceRender&&(this.resolvedLocale=null),{merge:!1,fields:n};let{changed:i}=this.rawChanges.diff(n,fr),r=this.resolvedLocale!==t.locale,l=this.resolved;if(null===l)return this.resolved=n,{merge:!0,fields:n};let a={...l};t.forceRender&&(this.resolvedLocale=null);let o=t.forceRender||r;for(let r of i){let i=n[r];if(dr.has(r)){a[r]=i;continue}let s=le(r,l[r],i,e.cache,t.schemaIndex);"own"!==s&&(o=!0,this.resolvedLocale=null),"keep"!==s&&(a[r]=i)}return this.resolved=a,{merge:o,fields:a}}request(e,t,n){let i=++this.requestAttempt,r=Date.now();if(r>=this.openUntil)return this.openUntil=r+t,this.dropQueued(),this.requestAttempt!==i?{leading:!0,result:Promise.resolve({status:"superseded"})}:{leading:!0,result:e.merge(n)};let l=this.trailing,a=l?.pending??function(){let e;return{promise:new Promise(t=>{e=t}),settle:e}}(),o={request:n,pending:a,timer:null};if(this.trailing=o,this.openUntil=r+t,null!==l&&null!==l.timer&&clearTimeout(l.timer),this.trailing!==o)return{leading:!1,result:a.promise};let s=setTimeout(()=>{this.flush(e,o)},t);return this.trailing===o?o.timer=s:clearTimeout(s),{leading:!1,result:a.promise}}recordMerged(e,t){this.resolved=e,this.resolvedLocale=t}resetRawChanges(){this.rawChanges.reset()}destroy(){this.requestAttempt+=1,this.openUntil=0,this.dropQueued()}dropQueued(){let e=this.trailing;this.trailing=null,null!==e&&(null!==e.timer&&clearTimeout(e.timer),e.pending.settle({status:"superseded"}))}flush(e,t){this.trailing===t&&(this.trailing=null,t.timer=null,e.merge(t.request).then(t.pending.settle))}},gr=class{constructor(){bi(this,"negotiation",w(void 0));bi(this,"observed",new Set)}observe(e,t,n){let i=e.filter(e=>!this.observed.has(e));if(0!==i.length){for(let e of i)this.observed.add(e);this.negotiation=w(this.negotiation.theirs,this.observed),t("protocol",`observed=${i.join(",")}`),i.includes("schema-json")&&ce()&&n("[payload-live-preview] This admin sends fieldSchemaJSON, which only Payload 2 does. Every 2.x release of this package supports Payload 2; 3.0 supports Payload 3 and 4.")}}applyVersion(e,t){let n=this.negotiation;if(n.theirs===e)return;let i=w(e,this.observed);this.negotiation=i,i.negotiated!==n.negotiated&&t("protocol","ours=4",`theirs=${e}`,`negotiated=${i.negotiated}`)}},mr=class{constructor(){bi(this,"lastIdentity")}inspect(e){let t=e.externallyUpdatedRelationship;if("object"!=typeof t||null===t)return null;let n=JSON.stringify([t.entitySlug,H(t),t.updatedAt]);return{identity:n,edit:n!==this.lastIdentity&&he(t,e)?t:null}}commit(e){let t=e.identity!==this.lastIdentity;return this.lastIdentity=e.identity,t?e.edit:null}},vr=class{constructor(){Ai(this,yr)}reveal(e,t,n){return e===Si(this,yr)?"skipped-same":(ki(this,yr,e),function(e,t){for(let t;t=e.closest?.("details:not([open])");)t.setAttribute("open","");return function(e,t){let n=e.getBoundingClientRect(),i=n.bottom>0&&n.top<t.innerHeight,r=n.right>0&&n.left<t.innerWidth;return i&&r}(e,t)?"already-visible":(e.scrollIntoView({behavior:pe(t)?"auto":"smooth",block:"center"}),"revealed")}(t,n))}reset(){ki(this,yr,void 0)}},yr=new WeakMap,br=class{constructor(){bi(this,"seen",new Map)}note(e,t,n){let r=i(n);if(void 0===r)return;let l=`${t.owner??""}\\0${t.locale??""}\\0${t.fieldName}`,a=this.seen.get(l);void 0!==a?a!==r&&(e.revealIdentities.push([l,r]),e.revealTarget??(e.revealTarget=t)):this.seen.set(l,r)}commit(e){for(let[t,n]of e.revealIdentities)this.seen.set(t,n);e.revealIdentities=[];let t=e.revealTarget;return e.revealTarget=void 0,t}},wr=()=>{},Sr=class{constructor(){bi(this,"host",{outstanding:()=>!1,report:wr,failed:wr});bi(this,"entry",null);bi(this,"ended")}begin(e,t){let n=this.entry,i=null===n?void 0:this.view(n);null!==n&&(n.key=void 0),this.ended=void 0,this.entry={key:e,revision:t,shortfalls:[],seen:new Set,deferred:0,awaiting:0,reported:void 0,queued:!1},null!==n&&void 0!==i&&this.publish(n,"pending"===i.state?{...i,state:"superseded"}:i)}end(){let e=this.entry;if(null!==e){this.entry=null;try{this.ended=this.view(e)}finally{e.key=void 0}}}snapshot(){return null!==this.entry?this.view(this.entry):void 0===this.ended?void 0:{...this.ended,shortfalls:[...this.ended.shortfalls]}}shortfall(e,t){let n=this.entry;if(n?.key!==e)return;let i=JSON.stringify(t);n.seen.has(i)||(n.seen.add(i),n.shortfalls.push(t),this.requestSettle(n.key))}deferred(e,t){this.entry?.key===e&&(this.entry.deferred=t)}handIsland(e){let t=this.entry;if(t?.key!==e)return wr;t.awaiting+=1;let n=!1;return()=>{n||this.entry!==t||(n=!0,t.awaiting-=1,this.settle(t))}}requestSettle(e){let t=this.entry;t?.key!==e||t.queued||(t.queued=!0,queueMicrotask(()=>{t.queued=!1;try{this.entry===t&&this.settle(t)}catch(e){this.host.failed(e)}}))}settle(e){let t=this.view(e);"pending"!==t.state&&this.publish(e,t)}publish(e,t){e.reported!==t.state&&(e.reported=t.state,this.host.report(t))}view(e){let t=void 0!==e.key&&this.host.outstanding(e.key)?"pending":e.shortfalls.length>0?"partial":e.awaiting>0?"unconfirmed":"current";return{revision:e.revision,state:t,shortfalls:[...e.shortfalls],deferred:e.deferred,awaitingIslands:e.awaiting}}},Ar=class{constructor(){bi(this,"started",!1);bi(this,"suspended",!1);bi(this,"deferredStart",null);bi(this,"hydration","idle");bi(this,"activeUpdate",null);bi(this,"locale");bi(this,"schema");bi(this,"schemaIndex");bi(this,"updateCount",0);bi(this,"supersededCount",0);bi(this,"completedCount",0);bi(this,"skippedUnchangedCount",0);bi(this,"lastFlush",null);bi(this,"absentFields",new Set);bi(this,"warnedOrphanFields",new Set);bi(this,"warnedStrategy",new WeakSet);bi(this,"warnedUnattributableMessage",!1);bi(this,"warnedVisibilityGate",!1);bi(this,"warnedFragmentFallback",!1);bi(this,"warnedIslandStart",!1);bi(this,"warnedEscalationUnavailable",!1);bi(this,"warnedProtocolShape",!1);bi(this,"reportedUnfaithful",new WeakMap);bi(this,"checkedServerFormat",new WeakSet);bi(this,"rowsOfBinding",new WeakMap);bi(this,"unfaithfulPatches",[]);bi(this,"unfaithfulCount",0);bi(this,"escalatedCount",0);bi(this,"unfaithfulFields",new Set);bi(this,"autoBindSearchMs");bi(this,"autoBindGuesses",null);bi(this,"warnedForeignSource",!1);bi(this,"lastAppliedIdentity",new WeakMap);bi(this,"navigationReplayPending",!1);bi(this,"navigationBindingReplay",!1);bi(this,"revealLedger",new br);bi(this,"display",new Sr);bi(this,"fragmentStats",{rendered:0,failed:0,superseded:0});bi(this,"routeStats",{refreshes:0,partial:0,failed:0,refused:0,loopStopped:0});bi(this,"fragmentControllers",new Map);bi(this,"routeController",null);bi(this,"routeRetry",null);bi(this,"routeRefreshOwed",!1);bi(this,"routeAwaitsSave",!1);bi(this,"fragmentsOwed",new Set);bi(this,"readyTimers",[]);bi(this,"revealer",new vr);bi(this,"changes",new ir);bi(this,"merges",new pr);bi(this,"protocol",new gr);bi(this,"relationships",new mr)}isRunning(){return this.started}isCurrent(e){return this.started&&this.activeUpdate===e}complete(e){this.display.requestSettle(e),!e.completed&&(e.completed=!0,e.countsAsUpdate&&(this.completedCount+=1))}forgetOwedWork(){this.routeRefreshOwed=!1,this.routeAwaitsSave=!1,this.fragmentsOwed.clear()}supersedeStrategies(){null!==this.routeRetry&&(clearTimeout(this.routeRetry),this.routeRetry=null,this.routeRefreshOwed=!0);for(let[e,t]of this.fragmentControllers){for(let e of t)this.fragmentsOwed.add(e);e.abort()}this.fragmentControllers.clear()}abortStrategies(){this.supersedeStrategies();let e=this.routeController;this.routeController=null,e?.abort()}},kr=class{constructor(e,t){bi(this,"deps",e);bi(this,"state",t);bi(this,"writing");bi(this,"instanceContext");this.instanceContext=function(e){let t={};for(let[n,i]of Object.entries(e))void 0!==i&&(t[n]=i);return t}({renderRichText:e.renderRichText,internalLinkPattern:e.internalLinkPattern,sanitizerPolicy:e.sanitizerPolicy,serverURL:e.serverURL,reportUnfaithful:(n,i)=>{l(e,t,n,i,this.writing)}})}apply(e){let{deps:t,state:n}=this,i=n.activeUpdate;if(null===i||void 0===e.revision||!S(i.revision,e.revision)||!n.isCurrent(i))return!1;let{target:r,value:a}=e,d=void 0!==i.schemaIndex?C(i.schemaIndex,r.fieldName):void 0,c=function(e,t){if(e.explicitFieldType)return e.fieldType;if(void 0!==t){let e=function(e){if(Object.prototype.hasOwnProperty.call(Gi,e))return Gi[e]}(t);if(void 0!==e)return e}return e.fieldType}(r,d?.type);"text"===c&&!0!==r.explicitFieldType&&ve(a)&&(c="richText");let h;try{h=t.resolveRenderer(c,r)}catch(e){return this.fail(i,r.fieldName,e)}if(!n.isCurrent(i))return!1;let f=t.emitter.listenerCount("elementUpdate")>0,p=f?function(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value:"IMG"===e.tagName?e.src:e.textContent}(r.element):void 0;if(!n.isCurrent(i))return!1;let g={allFields:e.allFields,locale:r.locale??i.locale,schema:d,...this.instanceContext};!0===r.hidesWhenEmpty&&r.element.toggleAttribute("hidden",function(e){return null==e||("string"==typeof e?0===e.trim().length:Array.isArray(e)&&0===e.length||ye(e))}(a));try{if(void 0!==r.targetAttribute){if("blocked"===function(e,t,n){let i=t.toLowerCase().trim();if(0===i.length||!E(i))return"blocked";if(null==n)return e.removeAttribute(i),"applied";if("string"!=typeof n&&"number"!=typeof n&&"boolean"!=typeof n)return"blocked";let r=String(n);return tr.has(i)&&!M(r)?"blocked":(e.setAttribute(i,r),"applied")}(r.element,r.targetAttribute,a))return t.warn(`[live-preview] LP0401: refused to write "${r.fieldName}" into attribute "${r.targetAttribute}"`),n.display.shortfall(i,{kind:"write",field:r.fieldName,code:"LP0401"}),!1}else{if(void 0===h)return t.log("no renderer for",c),l(t,n,r,`has no renderer for "${c}"`,a),!1;{let e=function(e,t,n,i){if("ignore"===e.onUnfaithfulPatch||void 0!==n.format||!Ii.has(i)||o(i)&&n.element.matches("select,input")||t.checkedServerFormat.has(n.element))return;t.checkedServerFormat.add(n.element);let r=s(n.element);return r.trim().length>0?r:void 0}(t,n,r,c);if(this.writing=a,!1===function(e,t,n,i){return e.render(t,n,i)}(h,r,a,g)&&function(e){return nr.has(e.render)}(h))return l(t,n,r,`is a value ${h.name} cannot render`,a),!1;void 0!==e&&function(e,t,n,i){let r=s(t.element);r!==n&&e.warn(`[live-preview] LP0412: "${t.fieldName}" showed ${u(n)}, the patch wrote ${u(r)} \\u2014 `+(o(i)?\'Payload sends the value of an option, not its label. Render the label in a data-payload-fragment boundary, or bind it with data-payload-strategy="route".\':"either an edit that arrived before the preview connected, or a template that formats this value differently. Set data-payload-format to match it."))}(t,r,e,c)}}}catch(e){return this.fail(i,r.fieldName,e)}if(!n.isCurrent(i))return!1;f&&t.emitter.emitWhile("elementUpdate",{element:r.element,fieldName:r.fieldName,previousValue:p,nextValue:a,revision:i.revision.revision,receivedAt:i.receivedAt,source:"patch"},()=>n.isCurrent(i));let m=n.isCurrent(i);return m&&(void 0!==e.valueIdentity?n.lastAppliedIdentity.set(r.element,e.valueIdentity):n.lastAppliedIdentity.delete(r.element)),m}fail(e,t,n){if(!this.state.isCurrent(e))return!1;this.state.display.shortfall(e,{kind:"write",field:t,code:"LP0603"});let i=n instanceof Error?n:new Error(String(n));return this.deps.emitter.emitWhile("error",{error:i,context:"renderer",code:"LP0603"},()=>this.state.isCurrent(e)),!1}},Tr="payload-live-preview:update",Cr="data-payload-island",Rr=`astro-island, [${Cr}]`,$r="data-payload-owned",Fr="data-payload-morph",Nr=["component-url","component-export","renderer-url","client","opts","before-hydration-url"],Mr=new WeakMap,Or=new WeakSet,Er="data-payload-field",Lr="data-payload-type",Pr="data-payload-attribute",xr="data-payload-href",Ur="data-payload-src",Ir="data-payload-alt",jr="data-payload-array-template",Dr="data-payload-array-separator",Wr="data-payload-locale",Br="data-payload-format",_r="data-payload-richtext",zr="data-payload-html",Vr="data-payload-array",qr="data-payload-structural",Hr="data-payload-owner",Gr="data-payload-depends",Kr="data-payload-strategy",Jr="data-payload-boundary",Xr="data-payload-guessed",Qr="data-payload-covers",Zr=[Er,Lr,Pr,xr,Ur,Ir,jr,Dr,Wr,Br,_r,zr,Vr,qr,Hr,Gr,Kr,Jr,"type"],Yr=`[${Er}]`,el=`[${Hr}]`,tl=`[${lr}], [${Kr}="route"]`,nl=/^[a-z][a-z0-9-]*:[a-z][a-z0-9-]*$/i,il=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"]),rl=class{constructor(e={}){bi(this,"entriesByField",new Map);bi(this,"entryByElement",new WeakMap);bi(this,"filter");bi(this,"count",0);bi(this,"dependencies",null);bi(this,"islandRoots",[]);bi(this,"ownersByIsland",new Map);bi(this,"navigationRoots",[]);bi(this,"coverDeclarations",[]);bi(this,"renderedDeclarations",[]);this.filter=e.filter??xe}dependencyMap(){if(null!==this.dependencies)return this.dependencies;let e=[];for(let t of this.values())void 0!==t.dependsOn&&e.push(Se(t.fieldName,t.dependsOn));return this.dependencies=we(...e),this.dependencies}get islands(){return this.islandRoots}get islandOwners(){return this.ownersByIsland}get covers(){return this.coverDeclarations}get rendered(){return this.renderedDeclarations}get navigationReplayRoots(){return this.navigationRoots}buildFromRoot(e){let t=performance.now();this.clear();let n=0;for(let t of e.querySelectorAll(Yr))void 0!==this.add(t)&&(n+=1);return this.islandRoots=function(e){let t=[];for(let n of e.querySelectorAll(Rr))ke(n)||t.push(n);return t}(e),this.ownersByIsland=new Map(this.islandRoots.map(e=>[e,Oe(e)])),this.navigationRoots=[...e.querySelectorAll(tl)].filter(e=>this.filter(e)&&(e.hasAttribute(lr)||0===(e.getAttribute(Er)??"").length)),this.coverDeclarations=[...e.querySelectorAll(`[${Qr}]`)].filter(e=>this.filter(e)).map(e=>({paths:be(e.getAttribute(Qr)),owner:Oe(e)})),this.renderedDeclarations=[...e.querySelectorAll(`[${Gr}]`)].filter(e=>this.filter(e)).flatMap(e=>{let t=function(e){if((e.getAttribute(lr)??"").length>0)return"fragment";let t=e.getAttribute(Kr);return null!==t?"route"===t?"route":void 0:e.hasAttribute(Er)&&null!==e.closest("head")?"route":void 0}(e);return void 0===t?[]:[{strategy:t,paths:be(e.getAttribute(Gr)),owner:Oe(e)}]}),{elementCount:n,fieldCount:this.entriesByField.size,durationMs:performance.now()-t}}add(e){let t=this.filter(e)?this.resolveBinding(e):void 0,n=this.entryByElement.get(e);if(this.dependencies=null,void 0!==t)return void 0!==n&&this.replaceEntry(n,t)?(this.entryByElement.set(e,t),t):(void 0!==n&&this.removeEntry(e,n),this.append(t),this.entryByElement.set(e,t),t);void 0!==n&&this.removeEntry(e,n)}remove(e){let t=this.entryByElement.get(e);return!!t&&(this.dependencies=null,this.removeEntry(e,t))}get(e){return this.entriesByField.get(e)}getByElement(e){return this.entryByElement.get(e)}get fieldCount(){return this.entriesByField.size}get elementCount(){return this.count}entries(){return this.entriesByField.entries()}*values(){for(let e of this.entriesByField.values())yield*e}has(e){return this.entryByElement.has(e)}clear(){this.entriesByField.clear(),this.entryByElement=new WeakMap,this.count=0,this.dependencies=null,this.islandRoots=[],this.ownersByIsland=new Map,this.navigationRoots=[],this.coverDeclarations=[],this.renderedDeclarations=[]}replaceEntry(e,t){if(e.fieldName!==t.fieldName)return!1;let n=this.entriesByField.get(e.fieldName),i=void 0===n?-1:n.indexOf(e);return!(void 0===n||i<0||(n[i]=t,0))}removeEntry(e,t){this.entryByElement.delete(e);let n=this.entriesByField.get(t.fieldName),i=void 0===n?-1:n.indexOf(t);return!(void 0===n||i<0||(n.splice(i,1),0===n.length&&this.entriesByField.delete(t.fieldName),this.count-=1,0))}append(e){let t=this.entriesByField.get(e.fieldName);t?t.push(e):this.entriesByField.set(e.fieldName,[e]),this.count+=1}resolveBinding(e){let t=e.getAttribute(Er);if(null===t||0===t.length)return;let n=e.getAttribute(Lr),i=e.getAttribute(Pr),r=e.getAttribute(xr),l=e.getAttribute(Ur),a=e.getAttribute(Ir),o=e.getAttribute(jr),s=e.getAttribute(Dr),u=e.getAttribute(Wr),d=e.getAttribute(Br),c=Oe(e),h=be(e.getAttribute(Gr)),f=e.getAttribute(Kr),p=e.getAttribute(Xr),g=D(e);return{element:e,fieldName:t,fieldType:Pe(e),explicitFieldType:null!==n&&Ee(n),strategyKind:B(e)??"unknown",...null!==g?{fragmentBoundary:g}:{},...null!==i&&i.length>0?{targetAttribute:i}:{},...null!==r&&r.length>0?{hrefField:r}:{},...null!==l&&l.length>0?{srcField:l}:{},...null!==a&&a.length>0?{altField:a}:{},...null!==o?{arrayTemplate:o}:{},...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(Jr)?{hidesWhenEmpty:!0}:{},...null!==p?{guessed:p}:{}}}},ll=64,al=1e4,ol=1e3,sl=64,ul=8192,dl=1048576,cl=1e4,hl=20,fl=new Set(["__proto__","constructor","prototype"]),pl=new Error,gl=class{constructor(e){bi(this,"serverURL");bi(this,"apiRoute");bi(this,"depth");bi(this,"fetchFn");bi(this,"log");bi(this,"timeoutMs");bi(this,"inflight",null);bi(this,"attempt",0);bi(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 i=e.apiRoute??"/api";this.apiRoute=i.startsWith("/")?i:`/${i}`,this.depth=e.depth??1,this.fetchFn=e.fetchFn,this.log=t(e.log??n);let r=e.timeoutMs??0;this.timeoutMs=r>0&&r<Number.POSITIVE_INFINITY?r:void 0}canMerge(e){try{let t=e.schema;return void 0!==t?(qe(e.data,t,this.serverURL,this.apiRoute,this.depth,e.locale),!0):null!==this.endpointOf(e)}catch{return!1}}endpointOf(e){try{let t=e.globalSlug;if(t)return Je(t)?{path:`globals/${encodeURIComponent(t)}`,field:"globalType",value:t}:null;let n=e.collectionSlug??"",i=e.data.id;return Je(n)&&Xe(i)?{path:`${encodeURIComponent(n)}/${encodeURIComponent(String(i))}`,field:"id",value:String(i)}:null}catch{return null}}async merge(e){if(this.destroyDepth>0)return{status:"superseded"};let t=this.attempt+=1,n=this.inflight;this.inflight=null;let i,r,l=null,a=!1,o=()=>this.attempt!==t,s=this.timeoutMs,u=!1,d=(e,t)=>void 0===s?e:(void 0===r&&(r=new Promise((e,n)=>{i=setTimeout(()=>{u=!0,t.abort(),n(pl)},s)}),r.catch(()=>{})),Promise.race([e,r]));try{if(n?.abort(),o())return{status:"superseded"};let t=e.schema;if(a=void 0!==t,void 0!==t){let n=qe(e.data,t,this.serverURL,this.apiRoute,this.depth,e.locale);if(o())return{status:"superseded"};if(0===n.requests.length)return{status:"merged",doc:n.doc};let i=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(o())return{status:"superseded"};if(void 0===i)return{status:"unavailable"};l=new AbortController,this.inflight=l;for(let e of n.requests){let t=await d(i(e.url,{method:"GET",credentials:"include",redirect:"error",signal:l.signal}),l);if(o())return{status:"superseded"};let n=t.ok;if(o())return{status:"superseded"};if(!n){let e=t.status;return o()?{status:"superseded"}:(l.abort(),o()?{status:"superseded"}:(this.log("merge HTTP",e),o()?{status:"superseded"}:{status:"unavailable"}))}let r=await d(He(t,l.signal,()=>!o()),l);if(o())return{status:"superseded"};if(Ge(e,r),o())return{status:"superseded"}}return{status:"merged",doc:n.doc}}let i=this.endpointOf(e);if(o())return{status:"superseded"};if(null===i)return{status:"unavailable"};let r=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(o())return{status:"superseded"};if(void 0===r)return{status:"unavailable"};let s=JSON.stringify({data:e.data,depth:this.depth,flattenLocales:!1,locale:e.locale});if(o())return{status:"superseded"};l=new AbortController,this.inflight=l;let u=`${this.serverURL}${this.apiRoute}/${i.path}`,c=await d(r(u,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","X-Payload-HTTP-Method-Override":"GET"},body:s,signal:l.signal}),l);if(o())return{status:"superseded"};let h=c.ok;if(o())return{status:"superseded"};if(!h){let e=c.status;return o()?{status:"superseded"}:(this.log("merge HTTP",e,u),o()?{status:"superseded"}:{status:"unavailable"})}let f=c.json.bind(c);if(o())return{status:"superseded"};let p=await d(f(),l);if(o())return{status:"superseded"};if(null===p||"object"!=typeof p||Array.isArray(p))return this.log("merge invalid",u),o()?{status:"superseded"}:{status:"unavailable"};let g=p,m=g[i.field],v=Object.hasOwn(g,i.field)&&("id"===i.field?!Xe(m)||String(m)!==i.value:m!==i.value);return o()?{status:"superseded"}:v?(this.log("merge invalid",u),o()?{status:"superseded"}:{status:"unavailable"}):{status:"merged",doc:g}}catch(e){return o()?{status:"superseded"}:u?(this.log("merge timeout",s),{status:"unavailable"}):a&&(l?.abort(),o())?{status:"superseded"}:(this.log("merge exception",a?new Error("legacy population could not be resolved"):e),o()?{status:"superseded"}:{status:"unavailable"})}finally{clearTimeout(i),this.inflight===l&&(this.inflight=null)}}destroy(){this.attempt+=1;let e=this.inflight;this.inflight=null,this.destroyDepth+=1;try{e?.abort()}finally{this.destroyDepth-=1}}},ml="2.3.1",vl={name:"payload-2",fieldTyping:"schema",populatesRelationships:"admin",documentEvents:!1},yl={name:"payload-3",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!0},bl={name:"unknown",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!1},wl="ssr",Sl=1,Al=[Er,Hr,Qr,Gr],kl=`[${Er}], [${Qr}], ${Rr}, ${tl}`,Tl=class{constructor(e,t={}){bi(this,"callbacks");bi(this,"debounceMs");bi(this,"rootMargin");bi(this,"visible",new Set);bi(this,"mutation",null);bi(this,"intersection",null);bi(this,"debounceTimer",null);bi(this,"generation",0);this.callbacks=e,this.debounceMs=t.mutationDebounceMs??100,this.rootMargin=t.intersectionRootMargin??"200px"}start(e){let t=this.generation;this.stop();let n=t+1;if(this.generation!==n)return;let i=null,r=null;try{i=new MutationObserver(e=>{this.handleMutations(e,n)}),r=new IntersectionObserver(e=>{this.handleIntersection(e,n)},{rootMargin:this.rootMargin,threshold:0}),i.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...Zr,Qr,Cr,wl]})}catch(e){throw i?.disconnect(),r?.disconnect(),e}this.generation===n?(this.mutation=i,this.intersection=r):(i.disconnect(),r.disconnect())}observeElement(e){this.intersection?.observe(e)}unobserveElement(e){this.intersection?.unobserve(e),this.visible.delete(e)}markVisible(e,t){t?this.visible.add(e):this.visible.delete(e)}isVisible(e){return this.visible.has(e)}stop(){this.generation+=1;let e=this.debounceTimer,t=this.mutation,n=this.intersection;this.debounceTimer=null,this.mutation=null,this.intersection=null,this.visible.clear(),null!==e&&clearTimeout(e);try{t?.disconnect()}finally{n?.disconnect()}}handleMutations(e,t){if(!this.isCurrentGeneration(t))return;for(let n of e){let e=Ze(n);if(null!==e&&(this.callbacks.onIslandHydrated?.(e),!this.isCurrentGeneration(t)))return}if(!function(e){for(let t of e){if("attributes"===t.type&&t.attributeName===Cr||"attributes"===t.type&&null!==t.attributeName&&(Al.includes(t.attributeName)||Zr.includes(t.attributeName)&&t.target.nodeType===Sl&&t.target.hasAttribute(Er)))return!0;for(let e of t.addedNodes)if(Ye(e))return!0;for(let e of t.removedNodes)if(Ye(e))return!0}return!1}(e))return;null!==this.debounceTimer&&clearTimeout(this.debounceTimer);let n=setTimeout(()=>{!this.isCurrentGeneration(t)||this.debounceTimer!==n||(this.debounceTimer=null,this.callbacks.onStructuralChange())},this.debounceMs);this.debounceTimer=n}handleIntersection(e,t){for(let n of e){if(!this.isCurrentGeneration(t))return;let{target:e}=n;if(n.isIntersecting){if(this.visible.has(e))continue;this.visible.add(e),this.callbacks.onVisibilityChange(e,!0)}else this.visible.has(e)&&(this.visible.delete(e),this.callbacks.onVisibilityChange(e,!1))}}isCurrentGeneration(e){return this.generation===e&&null!==this.intersection}},Cl=class{constructor(e){Ai(this,Nl);Ai(this,Rl,[]);Ai(this,$l);Ai(this,Fl,!1);ki(this,$l,e)}get closed(){return Si(this,Fl)}own(e){Si(this,Fl)?Ti(this,Nl,Ml).call(this,e):Si(this,Rl).push(e)}close(){if(Si(this,Fl))return;ki(this,Fl,!0);let e=Si(this,Rl).splice(0).reverse();for(let t of e)Ti(this,Nl,Ml).call(this,t)}},Rl=new WeakMap,$l=new WeakMap,Fl=new WeakMap,Nl=new WeakSet,Ml=function(e){try{e()}catch(e){Si(this,$l).call(this,"runtime cleanup failed:",e)}},Ol="__livePreviewHydration",El="[data-payload-field]",Ll="__vue_app__",Pl="__livePreviewVueHydration",xl="app:suspense:resolve",Ul="__livePreviewHydrated",Il={react:(e,t)=>function(e,t=5e3){tt();let n=et();if(void 0===n)return null;if(void 0===n.onCommit){let e=e=>{!n.committed&&function(e){let t=e;return null!=t&&function(e){let t=e;return 9===t?.nodeType||null!=t?.querySelector?.(El)}(t.containerInfo)&&!function(e){let t=[];for(null!==e.current&&void 0!==e.current&&t.push(e.current);t.length>0;){let e=t.pop();if(void 0===e)continue;let n=e.memoizedState;if((13===e.tag||31===e.tag)&&"object"==typeof n&&null!==n&&"dehydrated"in n&&"object"==typeof n.dehydrated&&null!==n.dehydrated&&"nodeType"in n.dehydrated&&8===n.dehydrated.nodeType)return!0;null!==e.sibling&&void 0!==e.sibling&&t.push(e.sibling),null!==e.child&&void 0!==e.child&&t.push(e.child)}return!1}(t)}(e)&&nt(n)};n.onCommit=e;for(let t of n.commits.splice(0))e(t)}return rt(n,e,t)}(t),vue:function(e,t,n=5e3){ot();let i=lt();return void 0===i?null:(!i.committed&&function(e){for(let t=e.querySelector(El);null!==t;t=t.parentElement)if(void 0!==at(t))return!0;return!1}(e)&&nt(i),rt(i,t,n))},sveltekit:function(e,t,n=5e3){let i=e.ownerDocument??e,r=()=>null!==i.querySelector("#svelte-announcer");if(r()||!Object.keys(window).some(e=>e.startsWith("__sveltekit_")))return null;let l={committed:!1,waiters:[]},a=new MutationObserver(()=>{!l.committed&&r()&&nt(l)});a.observe(i,{childList:!0,subtree:!0});let o=rt(l,e=>{a.disconnect(),t(e)},n);return()=>{a.disconnect(),o?.()}},manual:function(e,t,n=5e3){let i=function(){if(typ','eof window>"u")return;let e=window;return e[Ul]??(e[Ul]={committed:!1,waiters:[]})}();return void 0===i?null:rt(i,t,n)}},jl={react:"React commit",vue:"Vue mount",sveltekit:"SvelteKit mount",manual:"markHydrated() call"},Dl=class{constructor(e){bi(this,"timeoutMs");bi(this,"onTimeout");bi(this,"handle",null);bi(this,"lastKick",null);this.timeoutMs=e.timeoutMs??0,this.onTimeout=e.onTimeout}kick(){this.lastKick=Date.now(),!(this.timeoutMs<=0)&&(this.stop(),this.arm(this.timeoutMs))}resume(){if(this.timeoutMs<=0||null!==this.handle||null===this.lastKick)return!1;let e=Math.max(0,Date.now()-this.lastKick),t=this.timeoutMs-e;return t<=0?(this.lastKick=null,this.onTimeout(),!0):(this.arm(Math.min(t,this.timeoutMs)),!1)}arm(e){let t=setTimeout(()=>{this.handle===t&&(this.handle=null,this.lastKick=null,this.onTimeout())},e);this.handle=t}stop(){null!==this.handle&&(clearTimeout(this.handle),this.handle=null)}get lastKickAt(){return this.lastKick??0}get pending(){return null!==this.handle}},Wl=class{constructor(){bi(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)}},Bl="data-payload-no-bind",_l=13,zl=new Set(["true","false","yes","no","on","off"]),Vl=/^[\\d\\s.,:+/-]+$/u,ql=/^[a-z][a-z0-9_-]*$/u,Hl=/^[a-z]{2,3}(?:[-_][A-Za-z0-9]{2,8})*$/u,Gl=new Set(["SCRIPT","STYLE","TEMPLATE","TITLE","NOSCRIPT","TEXTAREA","SELECT","OPTION","INPUT","IFRAME"]),Kl="http://www.w3.org/1999/xhtml",Jl=class{constructor(e,t,n){bi(this,"deps",e);bi(this,"state",t);bi(this,"host",n);bi(this,"awaitingHydration",new WeakSet);bi(this,"delivered",new WeakMap);bi(this,"confirmations",new WeakMap)}reapplyBindings(e){let t=this.currentTransaction();void 0!==t?.renderData&&this.host.schedule(t,t.renderData,e)}reapplyIslands(e,t=!1){let n=t?e.filter(e=>this.awaitingHydration.delete(e)):e,i=this.state.activeUpdate,r=t&&null!==i&&this.state.isCurrent(i)?i:this.currentTransaction();void 0!==r?.renderData&&this.dispatchIslands(r,r.renderData,n)}dispatchIslands(e,t,n){let i=Rt(this.deps,this.state,e,t.fields),r=()=>!e.cancelled&&this.state.isCurrent(e);if(!r())return;let l=this.delivered.get(t);void 0===l&&(l=new WeakSet,this.delivered.set(t,l));for(let a of n){let n=Oe(a);if(!r())return;if(!1!==i&&!q(n,i)){this.awaitingHydration.delete(a);continue}let o=this.confirmation(a,e);if(Ce(a))this.awaitingHydration.add(a);else{if(this.awaitingHydration.delete(a),l.has(a))continue;l.add(a),$t(e,t,[a],r,o)}}}hasLateRouteBinding(e,t,n,i){for(let i of e){if((i.getAttribute(Er)??"").length>0||"route"!==i.getAttribute(Kr)||!1!==t&&!q(Oe(i),t))continue;let e=be(i.getAttribute(Gr));if(0===e.length||e.some(e=>n.touched.has(e)))return!0}for(let[r,l]of this.deps.cache.entries())for(let a of l){if(!e.has(a.element)||!1!==t&&!q(a.owner,t)||"route"!==(a.strategyKind??B(a.element)??"unknown"))continue;let l=I(i.fields,a,r,n.locale);if(!this.state.isCurrent(n))return!1;if(void 0!==l)return!0}return!1}fieldsForElements(e,t){let n=new Set(t);for(let[t,i]of this.deps.cache.entries())i.some(t=>e.has(t.element))&&n.add(t);return n}unrunFragmentPlan(e,t,n){if(null===t)return null;let i=t.boundaries.filter(t=>!e.fragmentBoundariesRun.has(t)&&(void 0===n||[...n].some(e=>e===t||t.contains(e))));return W(t.strategy,i,t.ownerKeys)}confirmation(e,t){let n=this.confirmations.get(e);if(n?.transaction===t)return n.displayed;let i=this.state.display.handIsland(t);return this.confirmations.set(e,{transaction:t,displayed:i}),i}currentTransaction(){let e=this.state.activeUpdate;return this.state.navigationBindingReplay&&null!==e&&this.state.isCurrent(e)?e:null}},Xl=" subfieldCoverage",Ql="payload-live-preview",Zl=Symbol.for("payload-live-preview.trusted-types"),Yl=new Set(["open","value","checked","selected"]),ea="__payloadLivePreviewDeprecationsWarned",ta=new Set,na="data-payload-",ia=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"]),ra=new Set(["input","button","textarea","select","option","label"]),la=new Set(["script","style","iframe","object","embed","link","meta","base","form","input","button","select","textarea","svg","math","template","frame","frameset","noframes","noscript"]),aa=new Set(["id","class","lang","dir","title","role","tabindex"]),oa="aria-",sa="data-",ua="data-payload-",da={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"])},ca=new Set(["href","src","cite","poster","action","formaction"]),ha=6,fa=1,pa=8,ga=(Error,new Set(["id","name","data-payload-key","data-payload-morph","data-payload-nested-key","data-payload-nested-template"])),ma="strict",va=(Object.freeze({allowedTags:ia,removeCompletely:la,globalAttributes:aa,attributesByTag:da,urlAttributes:ca}),Object.freeze({"&":"&amp;","<":"&lt;",">":"&gt;",\'"\':"&quot;","\'":"&#x27;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"})),ya=/[&<>"\'/`=]/g,ba=Object.freeze({"&":"&amp;","<":"&lt;",">":"&gt;",\'"\':"&quot;","\'":"&#x27;"}),wa=/[&<>"\']/g,Sa=/\\{\\{([\\s\\S]*?)\\}\\}/g,Aa="data-payload-",ka=["input","textarea","select","option","button","label","details","summary","dialog","video","audio","progress","meter"],Ta=["type","name","placeholder","open","disabled","readonly","required","checked","selected","value","min","max","step","rows","cols","for","controls","muted","loop","poster","src"],Ca=/<([a-z][a-z0-9]*(?:-[a-z0-9]+)+)\\b/gi,Ra=64,$a=new Map,Fa="data-payload-key",Na="data-payload-nested-key",Ma="data-payload-nested-template",Oa=class{constructor(e,t,n){bi(this,"deps",e);bi(this,"state",t);bi(this,"host",n)}planFragments(e,t){let{deps:n,state:i}=this,r=n.strategies.fragment;if(void 0===r)return null;let l=new Set(r.plan(n.root,e));for(let e of i.fragmentsOwed)n.root.contains(e)?l.add(e):i.fragmentsOwed.delete(e);return W(r,[...l].filter(e=>Sn(e,t)),t)}escalateUnfaithful(e,t,n,i){if(e.routeRefreshed){this.kept(e,n);return}let{fragment:r,route:l}=this.deps.strategies,a=void 0===r?void 0:function(e){let t=[];for(let n of e){let e=n.fragmentBoundary;if(void 0===e)return;t.includes(e)||t.push(e)}return t}(n),o=void 0===a||a.every(e=>Sn(e,i))?a:void 0;void 0===r||void 0===o?void 0!==l?(this.state.escalatedCount+=n.length,this.refreshRoute(e,t,l)):(wn(this.deps,this.state,n.length),this.kept(e,n)):(this.state.escalatedCount+=n.length,e.pendingFragments+=o.length,this.runFragments(e,t,W(r,o,i)))}kept(e,t){for(let n of t)this.state.display.shortfall(e,{kind:"unfaithful",field:n.fieldName})}hasUnboundChange(e,t){let{deps:n,state:i}=this;if(e.baseline||e.routeRefreshed)return!1;let r=function(e,t,n,i,r,l){let a=te(e,i,l),o=ie(e,n,i,a),s=[];for(let e of t){if(dr.has(e))continue;let t=o(e);if("none"===t&&s.push(e),"below"!==t||void 0===r)continue;let i=ne(e,n),{previous:l,next:u}=r;for(let{path:t}of ee(i,l[e],u[e],a))s.push(t)}return s}(n.cache,e.touched,e.locale,t,this.subfields(e),n.strategies),l=0;for(let e of r)a(i,e)&&(l+=1);let[o]=r;if(void 0===o)return!1;if("escalate"!==n.onUnfaithfulPatch||void 0===n.strategies.route){"escalate"===n.onUnfaithfulPatch&&wn(n,i,r.length);for(let t of r)i.display.shortfall(e,{kind:"unbound",field:t});return!1}return e.navigated?(i.routeAwaitsSave=!0,i.display.shortfall(e,{kind:"route-saved"}),!1):(n.log("route","LP0807",`field "${o}" has no binding; refreshing the route`),i.escalatedCount+=l,!0)}subfields(e){let{previousFields:t}=this.state.changes;return function(e,t,n){return"declared"===e&&void 0!==t&&void 0!==n?{previous:t,next:n}:void 0}(this.deps.subfieldCoverage,t,e.renderData?.fields)}plansRoute(e,t,n){let i=e=>!1===n||q(e,n),r=function(e,t,n){let i=e.rendered.flatMap(e=>"route"===e.strategy?e.paths:[]);for(let[t,n]of e.entries())n.some(e=>"route"===e.strategyKind)&&i.push(t);let r=new Set(t);for(let e of i){let[i=e]=e.split(".");t.has(i)&&(void 0===n||Y(e,n.previous,n.next))&&r.add(e)}return r}(this.deps.cache,t.touched,this.subfields(t));if(e.plan(this.deps.root,r,{inScope:e=>i(Oe(e))}))return!0;for(let[e,t]of this.deps.cache.entries())if(r.has(e)&&t.some(e=>"route"===e.strategyKind&&i(e.owner)))return!0;return!1}async runFragments(e,t,n){let{deps:i,state:r}=this,l=new AbortController,a=new Set(n.boundaries);for(let e of a)r.fragmentsOwed.delete(e);r.fragmentControllers.set(l,a);let o=t=>{a.delete(t)&&(e.pendingFragments-=1)},s=()=>r.isCurrent(e)&&!l.signal.aborted,u=e=>function(e,t,n){if(t.isConnected)return t;let i,r=t.getAttribute(lr),l=t.getAttribute(ar);for(let t of e.querySelectorAll(`[${lr}]`))if(t.getAttribute(lr)===r&&t.getAttribute(ar)===l&&n(t)){if(void 0!==i)return;i=t}return i}(i.root,e,e=>Sn(e,n.ownerKeys)),{emitter:d}=i,{message:c}=e,h=e.revision.revision,f=e.receivedAt,p={root:i.root,revision:h,receivedAt:f,fields:t.fields,locale:e.locale,collectionSlug:"string"==typeof c.collectionSlug?c.collectionSlug:void 0,globalSlug:"string"==typeof c.globalSlug?c.globalSlug:void 0,signal:l.signal,isCurrent:s,log:(e,t)=>{i.log("fragment",e,t)},morph:(e,t)=>{let n=s()?u(e):void 0;void 0!==n&&function(e,t,n){let i=e.ownerDocument.createElement("template");i.innerHTML=Et(t);let r=e.cloneNode(!1);r.append(i.content);let l=Ne(e);Pt(e,r,{keyAttributes:[Fa],boundary:Ae,retainBoundary:Fe}),function(e){for(let t of e)t.isConnected||Or.has(t)||(Or.add(t),t.dispatchEvent(new CustomEvent("astro:unmount")))}(l);let a=new Set(l);for(let t of Ne(e)){let e=a.has(t)?void 0:Me(t);void 0!==e&&n(t,e)}}(n,t,(e,t)=>{!function(e,t,n,i){if(t.warnedIslandStart)return;t.warnedIslandStart=!0;let r="element"===i?"<astro-island>":`client:${n.getAttribute("client")??""}`;e.warn(`[live-preview] LP0809: a fragment island cannot start: this page never loaded ${r}; render one on the page`)}(this.deps,this.state,e,t)})},patch:i=>{let r=u(i);void 0!==r&&(r!==i&&this.host.rebuildCache(),this.patchFallback(e,t,r,n.ownerKeys,s))},rendered:(e,t,n)=>{o(e);let i=u(e)??e;d.emitWhile("fragmentRender",{element:i,id:t,key:n,status:"rendered",revision:h,receivedAt:f},s)},failed:(t,n,l,a,c)=>{o(t);let p=u(t)??t;r.display.shortfall(e,{kind:"fragment",id:n,key:l,code:a});let g=`fragment "${n}" fell back to patch: ${c}`;i.log("fragment",a,g),d.emitWhile("error",{error:new Error(g),context:"fragment",code:a},s),d.emitWhile("fragmentRender",{element:p,id:n,key:l,status:"failed",code:a,revision:h,receivedAt:f},s)}},g={rendered:0,failed:0,superseded:0};try{g=await n.strategy.render(p,n.boundaries)}catch(t){if(i.log("fragment","LP0801",t),s()){for(let t of n.boundaries)p.patch(t),r.display.shortfall(e,me(t));g={rendered:0,failed:n.boundaries.length,superseded:0}}}r.fragmentStats.rendered+=g.rendered,r.fragmentStats.failed+=g.failed,r.fragmentStats.superseded+=g.superseded,r.fragmentControllers.delete(l);for(let e of a)o(e);s()&&(g.rendered>0&&this.host.restoreGuesses(e,t),0===e.pendingFragments&&0===i.scheduler.pendingCount&&r.complete(e),this.host.revealPending(e),s()&&(0===g.rendered||0===d.listenerCount("afterUpdate")||d.emitWhile("afterUpdate",{data:t,updatedCount:g.rendered,durationMs:Date.now()-f,revision:h,receivedAt:f,source:"fragment"},s)))}async refreshRoute(e,t,n){let{deps:i,state:r}=this;e.routeRefreshed?(r.routeStats.loopStopped+=1,i.log("route","LP0805",`revision ${String(e.revision.revision)} asked for a second refresh`)):(e.routeRefreshed=!0,await this.runRoute(e,t,n,!1).catch(e=>{this.routeFailed(e)}))}refreshAfterSave(){let{deps:e,state:t}=this,{route:n}=e.strategies,i=t.activeUpdate;!t.routeAwaitsSave||void 0===n||void 0===i?.renderData||(e.log("route","document saved; refreshing the route"),this.runRoute(i,i.renderData,n,!0).catch(e=>{this.routeFailed(e)}))}routeFailed(e){this.deps.log("route refresh failed:",e)}armRouteRetry(e,t,n,i,r){let{state:l}=this;null!==l.routeRetry&&clearTimeout(l.routeRetry),l.routeRetry=setTimeout(()=>{l.routeRetry=null,l.isCurrent(e)&&this.runRoute(e,t,n,r).catch(e=>{this.routeFailed(e)})},i)}async runRoute(e,t,n,i){let{deps:r,state:l}=this;if(r.routeAfterSave&&!i){l.routeAwaitsSave=!0,l.display.shortfall(e,{kind:"route-saved"});return}let a=l.routeStats,o=new AbortController;l.routeController?.abort(),l.routeController=o;let s,u=()=>!o.signal.aborted;try{s=await n.refresh({revision:e.revision.revision,receivedAt:e.receivedAt,signal:o.signal,isCurrent:u,log:(e,t)=>{r.log("route",e,t)},retryAfter:r=>{this.armRouteRetry(e,t,n,r,i)}})}catch(e){r.log("route","LP0801",e),s="failed"}if(!u())return;l.routeController=null;let d=l.activeUpdate;if(null===d)return;let c=d.renderData,h=()=>l.isCurrent(d);if("partial"===s?l.display.shortfall(d,{kind:"route-saved"}):("failed"===s||"superseded"===s||"refused"===s&&null===l.routeRetry)&&l.display.shortfall(d,{kind:"route-failed",outcome:s}),"refreshed"!==s&&"partial"!==s)"failed"===s?a.failed+=1:"refused"===s&&(a.refused+=1),void 0!==c&&this.host.reapply(d,c);else{if(a.refreshes+=1,"partial"===s&&(a.partial+=1),l.routeAwaitsSave="partial"===s&&!i,l.lastAppliedIdentity=new WeakMap,void 0!==c&&this.host.restoreGuesses(d,c),this.host.rebuildCache(),void 0===c||!h())return;this.host.reapply(d,c),r.emitter.listenerCount("afterUpdate")>0&&r.emitter.emitWhile("afterUpdate",{data:c,updatedCount:r.cache.elementCount,durationMs:Date.now()-d.receivedAt,revision:d.revision.revision,receivedAt:d.receivedAt,source:"route"},h)}}warnFragmentFallback(e){!function(e,t,n){t.warnedFragmentFallback||(t.warnedFragmentFallback=!0,e.warn(`[live-preview] LP0806: "${n.fieldName}" asks for the fragment strategy but no handler is configured; patching instead`))}(this.deps,this.state,e)}warnUnsupportedStrategy(e){!function(e,t,n){t.warnedStrategy.has(n.element)||(t.warnedStrategy.add(n.element),e.warn(`[live-preview] LP0407: "${n.fieldName}" asks for strategy "${String(n.strategy)}"; only patch, fragment and route exist`))}(this.deps,this.state,e)}patchFallback(e,t,n,i,r){if(r())for(let[l,a]of this.deps.cache.entries())for(let o of a){if(o.fragmentBoundary!==n||!1!==i&&!q(o.owner,i))continue;let a=I(t.fields,o,l,e.locale);void 0===a||!r()||this.deps.scheduler.schedule({target:o,value:this.host.transform(o,a,t.fields,r),allFields:t.fields,revision:e.revision,data:t})}}},Ea=new Set,La={kind:"merge"},Pa=class{constructor(e,t,n){bi(this,"deps",e);bi(this,"state",t);bi(this,"strategies");bi(this,"navigationReplay");t.changes.keepValues="declared"===e.subfieldCoverage,t.display.host=function(e,t){return{outstanding:n=>!n.completed||n.pendingFragments>0||null!==t.routeController||null!==t.routeRetry||e.scheduler.pendingCount>0,report:t=>{"partial"===t.state&&e.a11y?.announcePartial(),e.emitter.emit("revisionDisplay",t)},failed:t=>{e.log("revision display failed:",t)}}}(e,t),this.strategies=new Oa(e,t,{reapply:(e,t)=>{this.scheduleAllFields(e,t)},transform:(t,n,i,r)=>An(e,t,n,i,r),rebuildCache:n,restoreGuesses:(e,t)=>{this.restoreGuesses(e,t)},revealPending:e=>{this.revealPending(e)}}),this.navigationReplay=new Jl(e,t,{schedule:(e,t,n)=>{this.scheduleAllFields(e,t,n)}})}handleUpdate(e,t,n){let{deps:i,state:r}=this;i.heartbeat.kick(),r.protocol.observe(function(e){let t=[];return Array.isArray(e.fieldSchemaJSON)&&t.push("schema-json"),"string"==typeof e.locale&&t.push("locale"),"string"==typeof e.previewToken&&t.push("preview-token"),"object"==typeof e.externallyUpdatedRelationship&&null!==e.externallyUpdatedRelationship&&t.push("relationship-events"),t}(e),i.log,i.warn);let l=e.data;void 0!==l?void 0!==n&&this.acceptDataUpdate(e,l,t,n,!0):void 0!==e.protocolVersion&&r.protocol.applyVersion(e.protocolVersion,i.log)}handleReplay(e,t,n){let i=e.data;void 0!==i&&this.acceptDataUpdate(e,i,t,n,!1)}reapplyNavigationBindings(e){this.navigationReplay.reapplyBindings(e)}reapplyNavigationIslands(e,t=!1){this.navigationReplay.reapplyIslands(e,t)}acceptDataUpdate(e,t,n,i,r){let{deps:l,state:a}=this,o=r?a.relationships.inspect(e):null,s="string"==typeof e.locale?e.locale:a.locale,u=a.schema,d=a.schemaIndex;Array.isArray(e.fieldSchemaJSON)&&(u=e.fieldSchemaJSON,d=function(e,t=""){let n=new Map;return T(e,t,n,!1),T(e,t,n,!0),n}(e.fieldSchemaJSON));let c=a.activeUpdate;if(!a.isRunning()||null!==c&&c.revision.revision>i.revision)return;let h=null===o?null:a.relationships.commit(o),f=c,p={revision:i,message:e,rawData:t,locale:s,schema:u,schemaIndex:d,receivedAt:Date.now(),forceRender:null!==h||fe(f),countsAsUpdate:r,renderData:void 0,fragmentBoundariesRun:new WeakSet,touched:new Set,baseline:!1,navigated:!1,invalidated:new Set,revealTarget:void 0,revealIdentities:[],pendingFragments:0,routeRefreshed:!1,cancelled:!1,completed:!1};a.locale=s,a.schema=u,a.schemaIndex=d,null!==f&&!f.completed&&f.countsAsUpdate&&(a.supersededCount+=1),a.activeUpdate=p,r&&(a.updateCount+=1),a.display.begin(p,i.revision),a.isCurrent(p)&&(l.scheduler.acceptRevision(i),a.isCurrent(p)&&(a.supersedeStrategies(),a.isCurrent(p)&&(null!==h&&(l.emitter.emitWhile("relationshipUpdate",{detail:h,timestamp:Date.now()},()=>a.isCurrent(p)),!a.isCurrent(p))||r&&void 0!==e.protocolVersion&&(a.protocol.applyVersion(e.protocolVersion,l.log),!a.isCurrent(p))||r&&l.connection.markConnected()&&(l.a11y?.announceConnected(),l.emitter.emit("connect",{origin:n,timestamp:Date.now()}),!a.isCurrent(p)||(l.log("connection","disconnected","\\u2192","connected"),!a.isCurrent(p)))||this.processUpdate(p).catch(e=>{l.log("update failed:",e)}))))}async processUpdate(e){let{deps:t,state:n}=this,i=await this.resolveIncomingFields(e);if(null===i||!n.isCurrent(e))return;let r=this.dataFor(e,i);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&&n.isCurrent(e))||e.cancelled||!n.isCurrent(e))||this.applyFields(e,r,!1)}dataFor(e,t){let{message:n}=e;return{fields:t,...void 0!==e.schema?{schema:e.schema}:{},..."string"==typeof n.globalSlug?{globalSlug:n.globalSlug}:{},..."string"==typeof n.collectionSlug?{collectionSlug:n.collectionSlug}:{},...void 0!==e.locale?{locale:e.locale}:{}}}applyFields(e,t,n){let{deps:i,state:r}=this;if(!r.isCurrent(e))return;if(r.changes.isBaseline&&!n&&"off"!==i.autoBind){{let n=Rt(i,r,e,t.fields);!function(e,t,n,i,r,l){if(!l())return 0;let a=performance.now(),o=At(e.root),s=pt(n,i);if(!l())return 0;let u=null===o?[]:St(o,s);if(!l())return 0;let d=Tt(e,u,r,"on the first message",l);if(!l())return 0;let c=function(e,t){let n=new Set;for(let{fieldName:e,stamps:i}of t){n.add(e);for(let e of[xr,Ir]){let t=i[e];void 0!==t&&n.add(t)}}let i=new Map;for(let[t,r]of e)null!==r&&n.has(r.field)&&i.set(t,r);return{fields:n,values:i}}(s,d),h=performance.now()-a;l()&&(t.autoBindGuesses=c,t.autoBindSearchMs=h,d.length)}(i,r,t.fields,e.locale,n,()=>r.isCurrent(e))}if(!r.isCurrent(e))return}let l=we(i.dependencies,i.cache.dependencyMap());if(!r.isCurrent(e))return;let a=r.changes.diff(t.fields,l,()=>r.isCurrent(e));if(null===a)return;let o=!n&&r.navigationReplayPending;o&&(r.navigationReplayPending=!1,r.navigationBindingReplay=!0),e.baseline=a.baseline&&!o,e.navigated=o,e.invalidated=n?Ea:a.invalidated,e.touched=n?Ea:new Set([...a.changed,...a.invalidated]),e.renderData=t,this.scheduleAllFields(e,t)}async resolveIncomingFields(e){let{deps:t,state:n}=this,i=e.rawData;if(null===t.merger)return i;let r=n.merges.decide(t,e);if(!r.merge)return r.fields;let{message:l}=e,a=n.merges.request(t.merger,t.mergeWindowMs,{collectionSlug:l.collectionSlug,globalSlug:l.globalSlug,data:i,...void 0===e.schema?{}:{schema:e.schema},locale:e.locale});if(!a.leading)return this.applyMerged(e,a.result).catch(e=>{t.log("update failed:",e)}),r.fields;let o=await a.result;return n.isCurrent(e)?"merged"===o.status?(n.merges.recordMerged(o.doc,e.locale),o.doc):"superseded"===o.status?null:(n.display.shortfall(e,La),r.fields):null}async applyMerged(e,t){let{state:n}=this,i=await t;"unavailable"===i.status&&n.display.shortfall(e,La),"merged"===i.status&&n.isCurrent(e)&&(n.merges.recordMerged(i.doc,e.locale),this.applyFields(e,this.dataFor(e,i.doc),!0))}scheduleAllFields(e,t,n){let{deps:i,state:r}=this;if(!r.isCurrent(e))return;let l=void 0!==n,a=()=>r.isCurrent(e),o=Rt(i,r,e,t.fields);if(!a())return;let{touched:s}=e,u=i.strategies.route;if(l&&void 0!==u&&!e.routeRefreshed&&this.navigationReplay.hasLateRouteBinding(n,o,e,t)){a()&&this.strategies.refreshRoute(e,t,u);return}let d=!l&&this.strategies.hasUnboundChange(e,o),c=r.routeRefreshOwed;if(!l&&void 0!==u&&!e.routeRefreshed&&(d||c||this.strategies.plansRoute(u,e,o))&&a()){r.routeRefreshOwed=!1,this.strategies.refreshRoute(e,t,u);return}let h=l?this.navigationReplay.fieldsForElements(n,s):s,f=this.navigationReplay.unrunFragmentPlan(e,this.strategies.planFragments(h,o),n);if(!a())return;let p=i.skipUnchanged,g=0;for(let[s,u]of i.cache.entries()){if(!a())return;for(let d of u){if(void 0!==n&&!n.has(d.element)||!1!==o&&!q(d.owner,o))continue;if(!0===f?.covers(d)){if(i.revealEditedField){let n=I(t.fields,d,s,e.locale);r.revealLedger.note(e,d,n)}continue}let u=d.strategyKind??B(d.element)??"unknown";if("unknown"===u){this.strategies.warnUnsupportedStrategy(d);continue}"fragment"===u&&null===f&&this.strategies.warnFragmentFallback(d);let c=I(t.fields,d,s,e.locale);if(void 0===c){r.absentFields.add(s);continue}if(Ct(i,r,d,t.fields,e.navigated),!l&&i.revealEditedField&&r.revealLedger.note(e,d,c),!a())return;let h=An(i,d,c,t.fields,a);if(!a())return;let m=p?j(d,h,t.fields,e.locale):void 0,v=r.lastAppliedIdentity.get(d.element);if(!e.forceRender&&i.skipUnchanged&&void 0!==m&&v===m&&!e.invalidated.has(s)){r.skippedUnchangedCount+=1;continue}let y={target:d,value:h,allFields:t.fields,revision:e.revision,...l?{}:{data:t},valueIdentity:m};i.scheduler.schedule(y),g+=1}}if(l||function(e,t,n,i,r){let{cache:l,strategies:a}=e,o={cache:l,warned:t,warn:e.warn};if(0===l.fieldCount||!1!==r&&!function(e,t){for(let n of e.values())if(q(n.owner,t))return!0;return!1}(l,r))return;let s=function(e,t,n,i){let r=ie(e,t,n,te(e,n,i));return e=>"none"!==r(e)}(l,i,r,a);for(let[e,t]of Object.entries(n)){if(dr.has(e))continue;if(Nt(t)){Ft(o,s,e,i,t);continue}if(!Ot(t)||s(e)||Mt(t))continue;let n=ne(e,i);for(let[e,r]of Object.entries(t))!Nt(r)||dr.has(e)||Ft(o,s,`${n}.${e}`,i,r)}if("declared"!==e.subfieldCoverage){!function(e,t,n,i,r){if(!e.coverageByDefault||t.has(Xl)||!ce())return;t.add(Xl);let[l]=re(e.cache,n,i,r,e.strategies);void 0!==l&&e.warn(`[live-preview] LP0204: no binding names "${l.path}", and a binding elsewhere in its group covers it, so an edit there changes nothing on the page. 3.0 makes subfieldCoverage: \'declared\' the default, where it refreshes the route. Set the option to choose now.`)}(e,t,n,i,r);return}let u=re(l,n,i,r,a);for(let{path:e,value:t}of u)if(Nt(t)&&Ft(o,s,e,i,t),Ot(t)&&!Mt(t))for(let[n,r]of Object.entries(t))Nt(r)&&Ft(o,s,`${e}.${n}`,i,r)}(i,r.warnedOrphanFields,e.rawData,e.locale,o),a()){if(null!==f&&f.boundaries.length>0){for(let t of f.boundaries)e.fragmentBoundariesRun.add(t);e.pendingFragments+=f.boundaries.length,this.strategies.runFragments(e,t,f)}l||!a()||0===g&&(0===e.pendingFragments&&0===i.scheduler.pendingCount&&(r.complete(e),this.revealPending(e)),this.notifyIslands(e,t))}}notifyIslands(e,t){0!==e.touched.size&&this.navigationReplay.dispatchIslands(e,t,this.deps.cache.islands)}restoreGuesses(e,t){let{deps:n,state:i}=this;if("off"!==n.autoBind&&null!==i.autoBindGuesses){let r=Rt(n,i,e,t.fields);!function(e,t,n,i,r,l){if(!l())return 0;let a=t.autoBindGuesses,o=At(e.root);if(null===a||0===a.fields.size||null===o)return 0;let s=new Map(a.values);for(let[e,t]of pt(n,i)){if(null===t||!a.fields.has(t.field))continue;let n=s.get(e);void 0===n?s.set(e,t):n?.field!==t.field&&s.set(e,null)}if(!l())return 0;let u=St(o,s);l()&&Tt(e,u,r,"after a server render",l).length}(n,i,t.fields,e.locale,r,()=>i.isCurrent(e))}}onFlush(e){let{deps:t,state:n}=this;n.lastFlush=e,e.deferred>0&&!n.warnedVisibilityGate&&(n.warnedVisibilityGate=!0,t.warn(`[live-preview] LP0301: visibility gate held ${String(e.deferred)} off-screen update(s) until scrolled into view; see visibilityGateThreshold`));let{revision:i,data:r}=e;if(void 0===i)return;let l=n.activeUpdate;if(null===l||!n.isCurrent(l)||!S(l.revision,i))return;n.display.deferred(l,e.deferred),0===l.pendingFragments&&n.complete(l);let a=()=>n.isCurrent(l)&&S(l.revision,i),o=r??l.renderData;if(this.revealPending(l),!a())return;let s=n.unfaithfulPatches;if(s.length>0){if(n.unfaithfulPatches=[],void 0!==o){let e=Rt(t,n,l,o.fields);this.strategies.escalateUnfaithful(l,o,s,e)}if(!a())return}void 0!==r&&(e.applied>0&&t.a11y?.announceUpdate(e.applied),a()&&(this.notifyIslands(l,r),a()&&0!==e.applied&&0!==t.emitter.listenerCount("afterUpdate")&&t.emitter.emitWhile("afterUpdate",{data:r,updatedCount:e.applied,durationMs:e.durationMs,revision:i.revision,receivedAt:l.receivedAt,source:"patch"},a)))}revealPending(e){let t=this.state.revealLedger.commit(e);if(void 0!==t)try{ge(this.state.revealer,t)}catch(e){this.deps.log("reveal",e)}}revealField(e){let t=this.deps.cache.get(e)?.[0];return void 0===t?"no-element":ge(this.state.revealer,t)}documentSaved(){this.strategies.refreshAfterSave()}},xa=class{constructor(e,t){bi(this,"apply");bi(this,"debounceMs");bi(this,"maxWaitMs");bi(this,"isVisible");bi(this,"gateThresholdValue");bi(this,"gateDisabled");bi(this,"getCacheSize");bi(this,"onFlush");bi(this,"scheduleFrame");bi(this,"cancelFrame");bi(this,"pending",new Map);bi(this,"replay",new Map);bi(this,"activeFlushes",new Set);bi(this,"debounceTimer",null);bi(this,"debounceToken",0);bi(this,"deadlineTimer",null);bi(this,"frameHandle",null);bi(this,"frameFallback",null);bi(this,"frameToken",0);bi(this,"windowUntil",0);bi(this,"activeRevision",null);bi(this,"activeRevisionCancelled",!1);bi(this,"destroying",!1);this.apply=e,this.debounceMs=t.debounceMs??50,this.maxWaitMs=t.maxWaitMs??4*this.debounceMs,this.isVisible=t.isVisible,this.gateThresholdValue=t.visibilityGateThreshold??50,this.gateDisabled=t.disableVisibilityGate??!1,this.getCacheSize=t.getCacheSize,this.onFlush=t.onFlush,this.scheduleFrame=t.scheduleFrame??("function"==typeof requestAnimationFrame?requestAnimationFrame.bind(globalThis):e=>setTimeout(()=>{e(performance.now())},0)),this.cancelFrame=t.cancelFrame??("function"==typeof cancelAnimationFrame?cancelAnimationFrame.bind(globalThis):e=>{clearTimeout(e)})}schedule(e){if(this.destroying||void 0!==e.revision&&(this.activeRevisionCancelled||null===this.activeRevision||!S(e.revision,this.activeRevision)))return;let t=this.pending.get(e.target.element);t?(t.value=e.value,t.allFields=e.allFields,t.revision=e.revision,t.data=e.data,t.valueIdentity=e.valueIdentity):this.pending.set(e.target.element,{target:e.target,value:e.value,allFields:e.allFields,revision:e.revision,data:e.data,valueIdentity:e.valueIdentity}),this.armDebounce()}acceptRevision(e){this.destroying||null!==this.activeRevision&&S(e,this.activeRevision)||null!==this.activeRevision&&function(e,t){return e.generation!==t.generation?e.generation-t.generation:e.revision-t.revision}(e,this.activeRevision)<0||(this.clearWork(),this.activeRevision=e,this.activeRevisionCancelled=!1,this.cancelScheduledWork())}cancelRevision(e){null===this.activeRevision||!S(e,this.activeRevision)||(this.clearWork(),this.activeRevisionCancelled=!0,this.cancelScheduledWork())}flushNow(){return this.cancelScheduledWork(),this.flush()}notifyVisible(e){let t=this.replay.get(e);if(!t||(this.replay.delete(e),!this.isCurrent(t)))return;let n=performance.now(),i=this.didApply(t)?1:0;this.onFlush?.(this.statsFor(t,i,0,performance.now()-n,1===i?[t.target.fieldName]:[]))}retarget(e){this.retargetBuffer(this.pending,e),this.retargetBuffer(this.replay,e);for(let t of this.activeFlushes)this.retargetBuffer(t,e)}forget(e){this.pending.delete(e),this.replay.delete(e);for(let t of this.activeFlushes)t.delete(e)}destroy(){if(!this.destroying){this.destroying=!0;try{this.clearWork(),this.activeRevision=null,this.activeRevisionCancelled=!1,this.windowUntil=0,this.cancelScheduledWork()}finally{this.destroying=!1}}}get pendingCount(){return this.pending.size}get replayCount(){return this.replay.size}get gateThreshold(){return this.gateThresholdValue}get gateActive(){return!this.gateDisabled&&this.getCacheSize()>this.gateThresholdValue}armDebounce(){let e=Date.now(),t=e>=this.windowUntil;if(this.windowUntil=e+this.debounceMs,t){this.requestFrame();return}let n=this.debounceToken+=1,i=this.debounceTimer;if(this.debounceTimer=null,null!==i&&clearTimeout(i),this.debounceToken!==n)return;let r=setTimeout(()=>{this.debounceToken===n&&(this.debounceTimer=null,this.pending.size>0&&this.requestFrame())},this.debounceMs);this.debounceToken===n&&(this.debounceTimer=r),null===this.deadlineTimer&&this.maxWaitMs>this.debounceMs&&(this.deadlineTimer=setTimeout(()=>{this.deadlineTimer=null,this.pending.size>0&&this.requestFrame()},this.maxWaitMs))}requestFrame(){let e=this.frameToken+=1,t=this.frameHandle;if(this.frameHandle=null,this.clearFrameFallback(),null!==t&&this.cancelFrame(t),this.frameToken!==e)return;let n=!1,i=()=>{if(this.frameToken!==e||n)return;n=!0;let t=this.frameHandle;this.frameHandle=null,this.clearFrameFallback(),null!==t&&this.cancelFrame(t),this.flush()},r=this.scheduleFrame(i);n||this.frameToken!==e||(this.frameHandle=r,this.frameFallback=setTimeout(i,100))}clearFrameFallback(){clearTimeout(this.frameFallback??void 0),this.frameFallback=null}flush(){let e=performance.now();this.clearDeadline();let t=this.gateActive,n=this.pending;this.pending=new Map;let i,r=0,l=[],a=0;this.activeFlushes.add(n);try{for(let e of n.values()){if(!this.isCurrent(e))continue;let n=!t||this.isVisible(e.target.element)||kn(e.target);if(this.isCurrent(e)){if(i??(i=e),!n){this.replay.set(e.target.element,e),a+=1;continue}this.replay.delete(e.target.element),this.didApply(e)&&(r+=1,l.push(e.target.fieldName))}}}finally{this.activeFlushes.delete(n)}let o=this.statsFor(i,r,a,performance.now()-e,l);return this.onFlush?.(o),o}isCurrent(e){return void 0===e.revision||!this.activeRevisionCancelled&&null!==this.activeRevision&&S(e.revision,this.activeRevision)}didApply(e){return!1!==this.apply(e)||!function(e){return nr.has(e)}(this.apply)}retargetBuffer(e,t){let n=e.get(t.element);if(void 0!==n){if(!Le(n.target,t)){e.delete(t.element);return}n.target=t}}clearWork(){this.pending.clear(),this.replay.clear();for(let e of this.activeFlushes)e.clear()}statsFor(e,t,n,i,r){return{applied:t,appliedFields:r,deferred:n,durationMs:i,...void 0!==e?.revision?{revision:e.revision}:{},...void 0!==e?.data?{data:e.data}:{}}}clearDeadline(){null!==this.deadlineTimer&&(clearTimeout(this.deadlineTimer),this.deadlineTimer=null)}cancelScheduledWork(){let e=this.debounceTimer,t=this.frameHandle;this.debounceToken+=1,this.frameToken+=1,this.debounceTimer=null,this.frameHandle=null,this.clearDeadline(),this.clearFrameFallback(),null!==e&&clearTimeout(e),null!==t&&this.cancelFrame(t)}},Ua=[0,500,1e3,2e3],Ia=class{constructor(e){bi(this,"deps");bi(this,"state",new Ar);bi(this,"pipeline");bi(this,"writer");bi(this,"rootSentinel",null);bi(this,"scope",null);bi(this,"closingSession",!1);bi(this,"observedRoot",null);bi(this,"replayRetainedOnStart",!1);let{emitter:i,renderers:l}=e,a=void 0===e.log?n:t(e.log),o=void 0===e.warn?Ri: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 rl({filter:e=>!function(e){let t=e;for(;null!==t;){if(Te(t))return!0;t=t.parentElement}return!1}(e)}),d=new Tl({onStructuralChange:()=>{this.rebuildCache()},onIslandHydrated:e=>{this.pipeline.reapplyNavigationIslands([e],!0)},onVisibilityChange:(e,t)=>{t&&c.notifyVisible(e)}},void 0!==e.intersectionRootMargin?{intersectionRootMargin:e.intersectionRootMargin}:{}),c=new xa(L(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 qi(e.originMatcher,{onUpdate:(e,t,n)=>{this.pipeline.handleUpdate(e,t,n)},onReplay:(e,t,n)=>{this.pipeline.handleReplay(e,t,n)},onDocumentEvent:()=>{this.state.protocol.observe(["document-events"],a,o),i.emit("documentSave",{timestamp:Date.now()}),this.pipeline.documentSaved()},onFocusField:e=>{this.deps.revealEditedField&&this.pipeline.revealField(e)},onInvalid:(e,t)=>{if("token"===e){let e=new Error(`Preview token rejected (origin: ${t})`);i.emit("error",{error:e,context:"token",code:"LP0502"})}("shape"===e||"type"===e)&&!this.state.warnedProtocolShape&&(this.state.warnedProtocolShape=!0,o(`[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,o(`[live-preview] LP0501: a message from ${t} was ignored because it did not come from the window that framed or opened this page. \\`eventSourcePolicy\\` is \'parent-or-opener\' by default since 2.0, where 1.x accepted any window on a trusted origin. Set \\`eventSourcePolicy: \'any\'\\` if the admin posts from elsewhere.`)),a("LP0501 message rejected:",e,t)},...void 0!==e.validateToken?{validateToken:e.validateToken}:{},...void 0!==e.eventSourcePolicy?{sourcePolicy:e.eventSourcePolicy}:{}}),f=e.dataMerge;this.deps={emitter:i,cache:u,observers:d,scheduler:c,bus:h,connection:new Wl,heartbeat:new Dl({...void 0!==e.heartbeatMs?{timeoutMs:e.heartbeatMs}:{},onTimeout:()=>{this.onHeartbeatTimeout()}}),renderers:l,resolveRenderer:e.resolveRenderer??(e=>l[e]),transformValue:e.transformValue,renderRichText:e.renderRichText,internalLinkPattern:e.internalLinkPattern,routeAfterSave:!0===e.routeAfterSave,sanitizerPolicy:e.sanitizerPolicy,root:s,readyTargets:"function"==typeof e.readyTargets?e.readyTargets:(e=>()=>e)(e.readyTargets),sendReady:e.sendReady??k,onHeartbeatTimeout:e.onHeartbeatTimeout,log:a,warn:o,a11y:A(e),serverURL:f?.serverURL,merger:void 0===f?null:new gl({...f,log:a}),mergeWindowMs:e.debounceMs??50,scopeBindingsByOwner:!0===e.scopeBindingsByOwner,subfieldCoverage:e.subfieldCoverage??"descendant",coverageByDefault:void 0===e.subfieldCoverage,lockedOrigin:e.lockedOrigin??(()=>{}),skipUnchanged:!0===e.skipUnchanged,dependencies:e.dependencies??{},strategies:e.strategies??{},revealEditedField:!0===e.revealEditedField,onUnfaithfulPatch:r(e),autoBind:e.autoBind??"off",hydration:e.hydration},this.writer=new kr(this.deps,this.state),this.pipeline=new Pa(this.deps,this.state,()=>{this.rebuildCache()})}start(){let{state:e}=this;if(e.isRunning()||this.closingSession)return!1;e.suspended&&(this.replayRetainedOnStart=!0),e.started=!0,e.suspended=!1,this.openScope();try{return function(e){"react"===e.hydration?tt():"vue"===e.hydration&&ot();let{root:t}=e;if(!dt(t)||"loading"!==t.readyState){st(e);return}let n=()=>{e.isRunning()&&e.later(()=>{st(e)})};t.addEventListener("DOMContentLoaded",n,{once:!0}),e.defer(()=>{t.removeEventListener("DOMContentLoaded",n)})}(this.startupHost()),!0}catch(e){throw this.rollbackFailedStart(),e}}startupHost(){let{state:e,deps:t}=this;return{root:t.root,hydration:t.hydration,isRunning:()=>e.isRunning(),defer:t=>{e.deferredStart=t,this.scope?.own(()=>{e.deferredStart===t&&(e.deferredStart=null,t())})},later:t=>{e.deferredStart=null;try{t()}catch(e){this.rollbackFailedStart(),this.reportError(e,"startup","LP0605")}},hydrated:t=>{e.hydration=t},warn:t.warn,startNow:()=>{this.startNow()}}}startNow(){let{state:e,deps:t}=this;if(!e.isRunning())return;let n=dt(t.root)?ct(t.root):t.root;if(null===n)throw new Error("LivePreviewRuntime: document.body unavailable");if(t.observers.start(n),this.observedRoot=n,this.watchRootReplacement(),this.buildCacheAndObserve(),!e.isRunning()||(t.bus.attach(),t.emitter.emitWhile("init",{timestamp:Date.now()},()=>e.isRunning()),!e.isRunning()))return;let i=this.replayRetainedOnStart;this.replayRetainedOnStart=!1;let r=i&&t.heartbeat.resume();if(e.isRunning()&&(!i||r||(e.forgetOwedWork(),e.merges.resetRawChanges(),e.unfaithfulPatches=[],e.revealer.reset(),e.lastAppliedIdentity=new WeakMap,e.changes.reset(),e.navigationReplayPending=!0,t.bus.replayLastAccepted()||(e.navigationReplayPending=!1),e.isRunning())))for(let n of Ua){if(!e.isRunning())return;0===n?t.sendReady(t.readyTargets()):e.readyTimers.push(setTimeout(()=>{e.isRunning()&&this.sendReadyAfterStart()},n))}}suspend(){if(!this.state.isRunning())return!1;let e=this.release();return this.state.suspended=!0,e&&this.deps.emitter.emit("disconnect",{reason:"unload",timestamp:Date.now()}),!0}destroy(){let{state:e,deps:t}=this;if(!e.isRunning()&&!e.suspended)return;let n=!!e.isRunning()&&this.release();e.suspended=!1,this.replayRetainedOnStart=!1,t.bus.forgetLastAccepted(),n&&t.emitter.emit("disconnect",{reason:"destroy",timestamp:Date.now()}),t.a11y?.detach(),t.emitter.emit("destroy",{timestamp:Date.now()})}openScope(){let{state:e,deps:t}=this,n=new Cl(t.log);n.own(()=>{t.merger?.destroy(),e.merges.destroy()}),n.own(()=>{t.scheduler.destroy()}),n.own(()=>{t.observers.stop()}),n.own(()=>{this.rootSentinel?.disconnect(),this.rootSentinel=null,this.observedRoot=null}),n.own(()=>{e.abortStrategies()}),n.own(()=>{t.bus.detach()}),n.own(()=>{t.heartbeat.stop()}),n.own(()=>{for(let t of e.readyTimers)clearTimeout(t);e.readyTimers.length=0}),this.scope=n}release(){let{state:e,deps:t}=this;e.display.end(),e.activeUpdate=null,e.navigationBindingReplay=!1,e.started=!1;let n=this.scope;this.scope=null,this.closingSession=!0;try{n?.close()}finally{this.closingSession=!1}return t.cache.clear(),t.connection.markDisconnected()}rollbackFailedStart(){this.release();try{this.deps.a11y?.detach()}catch(e){this.deps.log("runtime cleanup failed:",e)}}refreshCache(){this.state.isRunning()&&(this.state.revealer.reset(),this.followReplacedRoot()||this.rebuildCache())}navigationCommit(){let{state:e,deps:t}=this;!e.isRunning()||null!==e.deferredStart||(this.cancelActiveUpdate(!0),t.merger?.destroy(),e.merges.destroy(),e.abortStrategies(),this.cancelActiveUpdate(!0),e.forgetOwedWork(),e.merges.resetRawChanges(),e.unfaithfulPatches=[],e.revealer.reset(),e.lastAppliedIdentity=new WeakMap,e.changes.reset(),e.isRunning()&&(t.bus.advanceGeneration(),e.navigationReplayPending=!0,this.followReplacedRoot()||this.rebuildCache(),e.isRunning()&&(t.bus.replayLastAccepted(),e.isRunning()&&this.sendReadyAfterStart())))}watchRootReplacement(){let{root:e}=this.deps;!dt(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()||!dt(e))return!1;let t=ct(e);return null!==t&&t!==this.observedRoot&&(this.observedRoot=t,this.deps.observers.start(t),this.rebuildCache(),!0)}get status(){return this.deps.connection.status}get cache(){return this.deps.cache}get updateCount(){return this.state.updateCount}get protocol(){return this.state.protocol.negotiation}inspect(){return function(e,t){let{cache:n,scheduler:i}=e,r=t.protocol.negotiation,l=t.activeUpdate,a=t.lastFlush,o=[],s=new Set,u=[];for(let[e,t]of n.entries()){o.push(e);for(let n of t)void 0!==n.owner&&s.add(n.owner),void 0!==n.guessed&&u.push({field:e,matched:n.guessed,attribute:n.targetAttribute??("IMG"===n.element.tagName?"src":void 0)})}return{version:ml,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:Qe(r.observed).name},revisions:{accepted:t.updateCount,superseded:t.supersededCount,completed:t.completedCount,skippedUnchanged:t.skippedUnchangedCount,active:null===l?void 0:l.revision.revision,display:t.display.snapshot()},bindings:{elements:n.elementCount,fields:n.fieldCount,fieldNames:o.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,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:l?.pendingFragments??0,...t.fragmentStats},scheduler:{pending:i.pendingCount,deferred:i.replayCount,visibilityGateThreshold:i.gateThreshold,visibilityGateActive:i.gateActive,lastFlush:null===a?void 0:{applied:a.applied,appliedFields:a.appliedFields,deferred:a.deferred,durationMs:a.durationMs}},plugins:[],renderers:Object.keys(e.renderers).sort()}}(this.deps,this.state)}buildCacheAndObserve(){let{state:e,deps:t}=this;if(!e.isRunning())return;let n=t.cache.buildFromRoot(t.root);if(t.log("cache",n),e.isRunning()&&(t.emitter.emitWhile("cacheRefresh",n,()=>e.isRunning()),e.isRunning()))for(let n of t.cache.values()){if(!e.isRunning())return;t.observers.observeElement(n.element)}}rebuildCache(){let{state:e,deps:t}=this;if(!e.isRunning())return;let n=new Map,i=t.cache.islandOwners,r=new Set(t.cache.navigationReplayRoots);for(let e of t.cache.values())n.set(e.element,e),t.observers.unobserveElement(e.element);if(this.buildCacheAndObserve(),!e.isRunning())return;let l=new Set(t.cache.navigationReplayRoots.filter(e=>!r.has(e)));for(let e of t.cache.values()){let i=n.get(e.element);void 0!==i&&Le(i,e)?t.scheduler.retarget(e):(t.scheduler.forget(e.element),l.add(e.element)),n.delete(e.element)}for(let e of n.values())t.scheduler.forget(e.element);l.size>0&&this.pipeline.reapplyNavigationBindings(l);let a=t.cache.islands.filter(e=>!i.has(e)||t.scopeBindingsByOwner&&i.get(e)!==t.cache.islandOwners.get(e));a.length>0&&this.pipeline.reapplyNavigationIslands(a)}onHeartbeatTimeout(){let{state:e,deps:t}=this;if(!e.isRunning()||(this.cancelActiveUpdate(!1),t.merger?.destroy(),e.merges.destroy(),e.abortStrategies(),this.cancelActiveUpdate(!1),!e.isRunning()))return;t.bus.advanceGeneration(),t.bus.forgetLastAccepted(),e.navigationBindingReplay=!1;let 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())}cancelActiveUpdate(e){let{state:t,deps:n}=this,i=t.activeUpdate;t.display.end(),t.activeUpdate=null,null!==i&&(i.cancelled=!0,n.scheduler.cancelRevision(i.revision),e&&!i.completed&&i.countsAsUpdate&&(t.supersededCount+=1))}sendReadyAfterStart(){try{this.deps.sendReady(this.deps.readyTargets())}catch(e){this.reportError(e,"ready","LP0606")}}reportError(e,t,n){let i=e instanceof Error?e:new Error(String(e));this.deps.emitter.emit("error",{error:i,context:t,code:n})}isIdleDisconnected(){return this.state.isRunning()&&"disconnected"===this.deps.connection.status&&null===this.state.activeUpdate}},ja=/^https?:\\/\\/(localhost|127\\.0\\.0\\.1)(?::\\d+)?$/i,Da=/^https?:\\/\\/[^/?#\\s]+$/i,Wa=[3e3,3001,3333,4e3,4321,5e3,5173,5174,8e3,8080,8888,9e3],Ba=class{constructor(e={}){Ai(this,_a);let t=new Set;for(let n of e.additionalOrigins??[]){let e=Tn(n);void 0!==e&&t.add(e)}let n;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&&(n=e)}catch{}}let i=(e.enableLocalhostMatching??!0)&&(e.forceDevMode??ce());ki(this,_a,[t,n,i,void 0!==n,void 0,typeof location>"u"?void 0:location.ancestorOrigins?.[0]])}matches(e){return 0!==e.length&&"null"!==e&&(void 0!==Si(this,_a)[4]?e===Si(this,_a)[4]:!!(Si(this,_a)[0].has(e)||0===Si(this,_a)[0].size&&void 0!==Si(this,_a)[1]&&e===Si(this,_a)[1]||Si(this,_a)[2]&&ja.test(e)))}lockOrigin(e){return!!this.matches(e)&&(Si(this,_a)[4]=e,!0)}unlockOrigin(){let e=Si(this,_a)[4];return Si(this,_a)[4]=void 0,e}get lockedOrigin(){return Si(this,_a)[4]}enumerate(){if(void 0!==Si(this,_a)[4])return[Si(this,_a)[4]];let e=new Set(Si(this,_a)[0]);0===Si(this,_a)[0].size&&void 0!==Si(this,_a)[1]&&e.add(Si(this,_a)[1]);let t=Si(this,_a)[5];if(Si(this,_a)[2]&&void 0!==t)ja.test(t)&&e.add(t);else if(Si(this,_a)[2])for(let t of Wa)e.add(`http://localhost:${String(t)}`),e.add(`http://127.0.0.1:${String(t)}`);return[...e]}get referrerWasAvailable(){return Si(this,_a)[3]}get isProductionUnconfigured(){return!(!de()||Si(this,_a)[0].size>0||Si(this,_a)[2]||void 0!==Si(this,_a)[1])}get isReferrerOnlyTrust(){return!(Si(this,_a)[0].size>0||Si(this,_a)[2])&&void 0!==Si(this,_a)[1]}},_a=new WeakMap,za="astro:page-load",Va="astro:after-swap",qa={1:"left",2:"center",3:"right",4:"justify"},Ha=new Set(["left","center","right","justify","start","end"]),Ga=new Set(["h1","h2","h3","h4","h5","h6"]),Ka=/\\{(slug|id|collection|locale)\\}/gu,Ja=\' target="_blank" rel="noopener noreferrer"\',Xa=(e,t)=>{let n=t.renderChildren(e.children??[]),i=Nn(e.fields),r=function(e,t,n){if("internal"===t?.linkType)return function(e,t){let n=Nn(e),i=Nn(n?.value),r=i?.url;if("string"==typeof r&&r.length>0)return r;let l=void 0===t.internalLinkPattern?void 0:function(e,t){let n=e=>{let n=t[e];return"string"==typeof n&&n.length>0||"number"==typeof n?encodeURIComponent(n):void 0};for(let[,t=""]of e.matchAll(Ka))if(void 0===n(t))return;return e.replace(Ka,(e,t)=>n(t)??"")}(t.internalLinkPattern,{slug:i?.slug,id:void 0===i?n?.value:i.id,collection:n?.relationTo,locale:t.locale});if(void 0!==l)return l;let a=i?.slug;return"string"==typeof a&&a.length>0?`/${a}`:void 0}(t.doc,n);let i=t?.url??e.url;return"string"==typeof i&&i.length>0?i:void 0}(e,i,t);if(void 0===r||!M(r))return n;let l="string"==typeof e.title?` title="${Jt(e.title)}"`:"";return`<a href="${Xt(r)}"${function(e,t,n){if(!0===t?.newTab||O(n))return Ja;let i="string"==typeof e.target?e.target:"";return""===i?"":"_blank"===i?Ja:` target="${Jt(i)}"`}(e,i,r)}${l}>${n}</a>`},Qa=new Map,Za=".lp-block:empty,.lp-inline-block:empty",Ya={text:e=>{let t=Jt("string"==typeof e.text?e.text:""),n="number"==typeof e.format?e.format:0;return!!(16&n)&&(t=`<code>${t}</code>`),!!(1&n)&&(t=`<strong>${t}</strong>`),!!(2&n)&&(t=`<em>${t}</em>`),!!(8&n)&&(t=`<u>${t}</u>`),!!(4&n)&&(t=`<s>${t}</s>`),!!(32&n)&&(t=`<sub>${t}</sub>`),!!(64&n)&&(t=`<sup>${t}</sup>`),!!(128&n)&&(t=`<mark>${t}</mark>`),t},paragraph:(e,t)=>{let n=t.renderChildren(e.children??[]);return`<p${$n(e)}${Fn(e)}>${n}</p>`},heading:(e,t)=>{let n="string"==typeof e.tag?e.tag.toLowerCase():"h2",i=Ga.has(n)?n:"h2",r=t.renderChildren(e.children??[]);return`<${i}${$n(e)}${Fn(e)}>${r}</${i}>`},list:(e,t)=>{let n="string"==typeof e.listType?e.listType:"bullet",i="number"===n?"ol":"ul",r="number"===n&&"number"==typeof e.start&&e.start>1?` start="${String(e.start)}"`:"",l="check"===n?\' role="list"\':"",a=t.renderChildren(e.children??[]);return`<${i}${$n(e)}${Fn(e)}${r}${l}>${a}</${i}>`},listitem:(e,t)=>{let n=t.renderChildren(e.children??[]);if("boolean"==typeof e.checked)return`<li role="checkbox" aria-checked="${e.checked?"true":"false"}"${Fn(e)}>${n}</li>`;let i="number"==typeof e.value?` value="${Jt(String(e.value))}"`:"";return`<li${$n(e)}${Fn(e)}${i}>${n}</li>`},link:Xa,autolink:Xa,quote:(e,t)=>{let n=t.renderChildren(e.children??[]);return`<blockquote${$n(e)}${Fn(e)}>${n}</blockquote>`},code:e=>{let t=En("string"==typeof e.language?e.language:"");return`<pre><code${""===t?"":` class="language-${t}"`}>${Jt(xn(e))}</code></pre>`},"code-highlight":e=>{let t="string"==typeof e.text?e.text:"";return`<span${"string"==typeof e.highlightType?` class="token-${En(e.highlightType)}"`:""}>${Jt(t)}</span>`},linebreak:()=>"<br>",horizontalrule:()=>"<hr>",tab:()=>"\\t",upload:e=>{let t=Mn(e.value);if(void 0===t)return"";let n=t.url;if("string"!=typeof n||!M(n))return"";let i="string"==typeof t.mimeType?t.mimeType:"";return i.startsWith("video/")?function(e,t){return`<video controls${Un(e)}><source src="${Xt(t)}"${In(e)}></video>`}(t,n):i.startsWith("audio/")?function(e,t){return`<audio controls><source src="${Xt(t)}"${In(e)}></audio>`}(t,n):""===i||i.startsWith("image/")?function(e,t){let n="string"==typeof e.alt?Jt(e.alt):"";return`<img src="${Xt(t)}" alt="${n}"${Un(e)} loading="lazy" decoding="async">`}(t,n):function(e,t){let n="string"==typeof e.filename?Jt(e.filename):Jt(t);return`<a href="${Xt(t)}" target="_blank" rel="noopener noreferrer">${n}</a>`}(t,n)},relationship:e=>{let t="string"==typeof e.relationTo?e.relationTo:"",n=Nn(e.value),i=Jt((n&&Pn(n))??`#${t}`),r=En(t),l=""===r?\' class="lp-relation"\':` class="lp-relation lp-relation--${r}"`,a=n?.url;return"string"==typeof a&&M(a)?`<a href="${Xt(a)}"${l}>${i}</a>`:`<span${l}>${i}</span>`},block:(e,t)=>Dn(e,t,"div","lp-block"),inlineBlock:(e,t)=>Dn(e,t,"span","lp-inline-block"),table:(e,t)=>`<table${$n(e)}><tbody>${t.renderChildren(e.children??[])}</tbody></table>`,tablerow:(e,t)=>`<tr>${t.renderChildren(e.children??[])}</tr>`,tablecell:(e,t)=>{let n="number"==typeof e.headerState?e.headerState:0,i=3&n?"th":"td";return`<${i}${1===n?\' scope="col"\':2===n?\' scope="row"\':""}${Wn("colspan",e.colSpan)}${Wn("rowspan",e.rowSpan)}>${t.renderChildren(e.children??[])}</${i}>`}},eo=new Map,to=!1,no="data-payload-text",io=new Set,ro=new Set,lo=new WeakMap,ao=new Set(["DIV","SECTION","ARTICLE"]),oo={name:"richText",render:L((e,t,n)=>{let i=e.element;if(nn(t)){i.textContent="";return}let r=n.sanitizerPolicy;if(void 0!==n.renderRichText){let l=n.renderRichText(t,{fieldName:e.fieldName,element:i,locale:n.locale});i.innerHTML=Et(_t(l,r));return}if(Bn(t)){if(ye(t)){i.textContent="";return}let l=new Map,a=[],o=qn(i,_t(function(e,t={}){if(!Bn(e))return"";let n=function(e){let t={renderChildren:e=>{let n="";for(let i of e)n+=_n(i,t);return n},resolveAlignment:Cn,resolveIndent:Rn,onUnrenderedBlock:e.onUnrenderedBlock,internalLinkPattern:e.internalLinkPattern,locale:e.locale};return t}(t).renderChildren(e.root.children);return!1===t.sanitize?n:void 0!==t.document?Bt(n,{document:t.document}):!0===t.requireDocument||void 0!==qt()?Bt(n):(function(){if(!to){to=!0;try{console.warn(\'[live-preview] lexicalToHtml() has no sanitizer document and returned unsanitised HTML; pass { document } (linkedom, jsdom) per call. 3.0 throws here instead: opt in now with { requireDocument: true }. See "HTML sanitization" in docs/security.md.\')}catch{}}}(),n)}(t,{sanitize:!1,internalLinkPattern:n.internalLinkPattern,locale:n.locale,onUnrenderedBlock:(e,t,n)=>{l.set(t,e),a.push(n)}}),r));for(let[t,i]of o){let r=l.get(t);void 0!==r&&Gn(e,n,r,i)}!function(e,t,n,i){let r=function(e){try{return JSON.stringify(e,(e,t)=>"object"==typeof t&&null!==t&&"id"in t&&"updatedAt"in t?t.id:t)}catch{return}}(n),l=lo.get(e.element);void 0===r?lo.delete(e.element):lo.set(e.element,r),void 0!==r&&void 0!==l&&r!==l&&[...i.values()].includes(!1)&&t.reportUnfaithful?.(e,"changed a block no renderer draws")}(e,n,a,o);return}if("string"!=typeof t)return!1;i.innerHTML=Et(_t(t,r))})},so={name:"html",render(e,t,n){if(nn(t)){e.element.textContent="";return}let i="string"==typeof t?t:tn(t);e.element.innerHTML=Et(_t(i,n.sanitizerPolicy))}},uo=new WeakSet,co=Jn("url"),ho=/^[a-zA-Z][a-zA-Z0-9+.-]*:/,fo=Jn("email",function(e){let t=e.trim();return ho.test(t)||!t.includes("@")?t:`mailto:${t}`}),po=["src","srcset","sizes"],go=new WeakMap,mo=/^(?:\\.{0,2}\\/|\\S*[/.:]\\S*$|.*\\.(?:avif|bmp|gif|ico|jpe?g|png|svg|tiff?|webp)$)/i,vo={name:"image",render:L((e,t,n)=>{let i=e.element;if("IMG"===i.tagName&&e.altField===e.fieldName&&void 0===e.srcField&&("string"==typeof t||nn(t))){i.alt=t??"";return}if(nn(t)){ni(i);return}let r=void 0!==e.locale,{media:l,candidate:a}=function(e,t,n,i){let r=void 0!==e.srcField&&e.srcField.length>0?x(n.allFields,e.srcField,n.locale,i):t,l=Mn(r);return{media:l,candidate:void 0===l?r:l.url}}(e,t,n,r);if(void 0===l&&"string"==typeof a&&!mo.test(a.trim()))return!1;let o=Kn(i,e.fieldName,a,void 0===l?void 0:n.serverURL);if("none"===o.kind)return!1;if("unsafe"!==o.kind){if("IMG"===i.tagName){let t=i;Zn(t,o.url,l,n.serverURL);let a=function(e,t,n,i,r){if(void 0!==t&&t.length>0){let e=x(n,t,i,r);return"string"==typeof e?e:void 0}return e?.alt}(l,e.altField,n.allFields,n.locale,r);void 0!==a&&(t.alt=a);return}i.style.backgroundImage=`url(\'${function(e){return e.replace(/[\'"()\\\\]/g,"\\\\$&")}(o.url)}\')`}else ni(i)})},yo={name:"upload",render:L((e,t,n)=>{let i=e.element;if(nn(t)){ii(i);return}let r=Mn(t);if(void 0===r)return!1;let l=Kn(i,e.fieldName,r.url,n.serverURL);if("none"===l.kind)return!1;if("unsafe"===l.kind){ii(i);return}let a=l.url;if("IMG"===i.tagName){let e=i;Zn(e,a,r,n.serverURL),void 0!==r.alt&&(e.alt=r.alt);return}if("A"===i.tagName){i.setAttribute("href",a),i.textContent=r.filename??a;return}let o=Jt(r.filename??a);i.innerHTML=Et(`<a href="${Xt(a)}">${o}</a>`)})},bo={name:"relationship",render(e,t){let n=e.element;if(nn(t))n.removeAttribute("href"),n.textContent="";else{if("A"===n.tagName&&!Array.isArray(t)){let i=Kn(n,e.fieldName,Nn(t)?.url);"safe"===i.kind?n.setAttribute("href",i.url):"unsafe"===i.kind&&n.removeAttribute("href")}n.textContent=Array.isArray(t)?t.map(ri).join(", "):ri(t)}}},wo={name:"select",render(e,t,n){let i=e.element,r=nn(t)?[]:function(e){return Array.isArray(e)?e.map(tn):[tn(e)]}(t);if("SELECT"!==i.tagName){if("INPUT"===i.tagName&&"radio"===i.type){let e=i;e.checked=r.includes(e.value);return}i.textContent=r.map(e=>function(e,t){let n=t.schema?.options;if(!Array.isArray(n))return e;for(let t of n){let n=Nn(t);if(void 0!==n&&tn(n.value)===e)return"string"==typeof n.label?n.label:e}return e}(e,n)).join(", ")}else!function(e,t){if(e.multiple)for(let n of Array.from(e.options))n.selected=t.includes(n.value);else e.value=t[0]??""}(i,r)}},So=new Set(["","false","0","off","no"]),Ao={name:"checkbox",render(e,t){let n=e.element,i=function(e){return"boolean"==typeof e?e:"string"==typeof e?!So.has(e.trim().toLowerCase()):"number"==typeof e?0!==e:null!=e}(t);"INPUT"!==n.tagName||"checkbox"!==n.type?n.hasAttribute("aria-checked")?n.setAttribute("aria-checked",i?"true":"false"):n.textContent=i?"true":"false":n.checked=i}},ko=new Map,To=new Map,Co=new Set(["short","medium","long","full"]),Ro=new Set(["short","medium","long","full"]),$o=/^[A-Za-z]{3}$/u,Fo=/^[0-4]$/u,No=new WeakSet,Mo={name:"date",render(e,t,n){let i=e.element;if(nn(t)){"INPUT"===i.tagName?i.value="":(i.removeAttribute("datetime"),i.textContent="");return}let r="number"==typeof t?t:tn(t),l=new Date(r),a=!Number.isNaN(l.getTime()),o=String(r);"INPUT"!==i.tagName?("TIME"===i.tagName&&i.setAttribute("datetime",a?l.toISOString():o),i.textContent=a?function(e,t,n){let i=t.locale??n.locale??d(),r=ui("date",t.format,t.element,t.fieldName)??Oo;try{return function(e,t){let n=li(e,t);return rn(To,n)??ln(To,n,new Intl.DateTimeFormat(e,t),64)}(i,r).format(e)}catch{return e.toISOString()}}(l,e,n):o):i.value=a?function(e,t){let n=`${String(t.getFullYear()).padStart(4,"0")}-${di(t.getMonth()+1)}-${di(t.getDate())}`,i=`${di(t.getHours())}:${di(t.getMinutes())}`;return"date"===e?n:"datetime-local"===e?`${n}T${i}`:"time"===e?i:t.toISOString()}(i.type,l):o}},Oo={dateStyle:"medium",timeStyle:"short"},Eo={name:"number",render(e,t,n){let i=e.element;if(nn(t)){"INPUT"===i.tagName?i.value="":i.textContent="";return}let r="number"==typeof t?t:Number(tn(t));Number.isNaN(r)?i.textContent=tn(t):"INPUT"!==i.tagName?i.textContent=function(e,t,n){let i=t.locale??n.locale??d(),r=ui("number",t.format,t.element,t.fieldName);try{return function(e,t){let n=li(e,t);return rn(ko,n)??ln(ko,n,new Intl.NumberFormat(e,t),64)}(i,r).format(e)}catch{return String(e)}}(r,e,n):i.value=String(r)}},Lo={name:"array",render:L((e,t,n)=>{let i=e.element;if(nn(t)){i.textContent="";return}if(!Array.isArray(t))return!1;let r=e.arrayTemplate;if(void 0!==r&&r.length>0){let e=function(e,t){let n=Qt(t),i="";for(let r=0;r<t.length;r+=1)i+=Zt(e,t[r],r,tn,n);return i}(r,t),l=n.sanitizerPolicy,a=an(r),o=Yt(i);i.innerHTML=Et(_t(e,l,a));for(let e of Array.from(i.children))en(e,o);return}i.textContent=t.map(tn).join(e.arraySeparator??", ")})},Po=new Map;!function(){if(typ','eof window>"u"||!de()&&(typ','eof window>"u"||null==window.opener))return;let e=window.__livePreview,t=JSON.stringify(mi());if(void 0!==e&&(void 0===e.configSignature||e.configSignature===t))return e.refresh(),e;let[n=[],i="",l="/api",a=1,o=!1,s=50,u=!0,d=0,c=!1,h=50,f="200px",p=!0,g=!1,m=!1,v=!0,y="parent-or-opener",b="strict",w,S=!1,A=!1,k,T,C="off",R,$,F=[],N,M,O]=mi(),E=function(e){let t=typeof __LIVE_PREVIEW_FRAGMENT__<"u"?__LIVE_PREVIEW_FRAGMENT__:void 0,n=t??(typeof __LIVE_PREVIEW_ROUTE__<"u"?__LIVE_PREVIEW_ROUTE__:void 0);if(void 0===n)return;let i=n.createRouteStrategy();return void 0===t||void 0===e||""===e?{route:i}:{fragment:t.createFragmentStrategy({endpoint:e}),route:i}}(w),L=new Ba({additionalOrigins:n,enableReferrerDetection:!p,enableLocalhostMatching:!g});L.isProductionUnconfigured?Ri("[live-preview] LP0101: No trusted origin. Pass allowedOrigins to generateInlineScript() (or to the adapter) \\u2014 the runtime reads no environment variable in the browser."):L.isReferrerOnlyTrust&&Ri("[live-preview] LP0102: document.referrer fallback trusts any framing site. Set allowedOrigins and a frame-ancestors CSP in production.");let P=new Fi,x=function(){let e=[oo,so,co,fo,vo,yo,bo,wo,{...wo,name:"radio"},Ao,Mo,Eo,Lo,{...Lo,name:"blocks"}];return function(e=[]){let t={};for(let n of e)t[n.name]=n;for(let[e,n]of Po)t[e]=n;return Object.freeze(t)}([Vn("text"),Vn("textarea"),...e,ci()])}(),U=new Ia({renderers:x,originMatcher:e=>L.matches(e),lockedOrigin:()=>L.lockedOrigin,readyTargets:()=>L.enumerate(),emitter:P,eventSourcePolicy:y,...""!==i?{dataMerge:{serverURL:i,apiRoute:l,depth:a,...void 0===M?{}:{timeoutMs:M}}}:{},...void 0===O?{}:{internalLinkPattern:O},..."after-save"===A?{routeAfterSave:!0}:{},debounceMs:s,heartbeatMs:d,intersectionRootMargin:f,disableVisibilityGate:c,visibilityGateThreshold:h,enableA11y:u,scopeBindingsByOwner:m,...void 0===N?{}:{subfieldCoverage:N},skipUnchanged:v,revealEditedField:S,onUnfaithfulPatch:r({onUnfaithfulPatch:T,onUnboundChange:k}),autoBind:C,...void 0!==R?{hydration:R}:{},sanitizerPolicy:b,...void 0!==E?{strategies:E}:{},onHeartbeatTimeout:()=>{L.unlockOrigin()},...o?{log:(...e)=>{$i("[live-preview]",...e)}}:{}});P.on("connect",e=>{L.lockOrigin(e.origin)}),U.start(),e?.destroy();let I=function(e,t={}){let n=t.windowTarget??globalThis.window,i=t.documentTarget??globalThis.document,r=[...new Set(t.softNavigationEvents??[])],l=()=>{e.suspend()},a=t=>{!0===t.persisted&&e.resume()},o=!1,s=()=>{o=!0},u=t=>{if(t.type===za){if(!o)return;o=!1}void 0===e.refreshAfterNavigation?e.refreshCache():e.refreshAfterNavigation()},d=!1;n?.addEventListener("pagehide",l),n?.addEventListener("pageshow",a);for(let e of r)i?.addEventListener(e,u);let c=r.includes(za);return c&&i?.addEventListener(Va,s),()=>{if(!d){d=!0,n?.removeEventListener("pagehide",l),n?.removeEventListener("pageshow",a);for(let e of r)i?.removeEventListener(e,u);c&&i?.removeEventListener(Va,s)}}}({suspend:()=>U.suspend(),resume:()=>U.start(),refreshCache:()=>{U.refreshCache()},refreshAfterNavigation:()=>{U.navigationCommit()}},{softNavigationEvents:F}),j=Object.freeze({version:ml,configSignature:t,destroy:()=>{I(),U.destroy();let e=window;e.__livePreview===j&&delete e.__livePreview},refresh:()=>{U.refreshCache()},refreshAfterNavigation:()=>{U.navigationCommit()},enumerateOrigins:()=>L.enumerate(),inspect:()=>U.inspect()});try{Object.defineProperty(window,"__livePreview",{value:j,writable:!1,configurable:!0})}catch(e){throw I(),U.destroy(),e}}()})();'].join(""),ea={generatedAt:"2026-11-02T21:15:49.000Z",size:153603},ta=/* @__PURE__ */['"use strict";var __LIVE_PREVIEW_FRAGMENT__=(()=>{var P=Object.defineProperty;var fe=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var ye=Object.prototype.hasOwnProperty;var pe=(e,t)=>{for(var n in t)P(e,n,{get:t[n],enumerable:!0})},ge=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of me(t))!ye.call(e,o)&&o!==n&&P(e,o,{get:()=>t[o],enumerable:!(a=fe(t,o))||a.enumerable});return e};var he=e=>ge(P({},"__esModule",{value:!0}),e);var Ye={};pe(Ye,{createFragmentStrategy:()=>ce,createRouteStrategy:()=>ue});function k(e,t){let n=new AbortController,a=!1,o=()=>{n.abort()};e.addEventListener("abort",o,{once:!0});let r=setTimeout(()=>{a=!0,n.abort()},t);return{signal:n.signal,timedOut:()=>a,dispose:()=>{clearTimeout(r),e.removeEventListener("abort",o)}}}function R(e){return e instanceof Error?e.message:String(e)}var D="data-payload-island",Qe=`astro-island, [${D}]`,w="data-payload-owned",be="data-payload-morph";function F(e){if(e.tagName.toLowerCase().includes("-")&&!e.hasAttribute(be)||z(e)||e.hasAttribute(w))return!0;let n=e.getAttribute("contenteditable");return n!==null&&n!=="false"}function Ee(e){return e.tagName.toLowerCase()==="astro-island"||e.hasAttribute(D)}function Se(e){return e.getAttribute(D)==="patch"}function z(e){return Ee(e)&&!Se(e)}function V(e){let t=e;for(;t!==null;){if(z(t))return!0;t=t.parentElement}return!1}var Re=["component-url","component-export","renderer-url","client","opts","before-hydration-url"],v=new WeakMap,G=new WeakSet;function W(e){return e.tagName.toLowerCase()==="astro-island"}function q(e){let t="";for(let n of e.querySelectorAll("astro-slot, template[data-astro-template]")){if(n.parentElement?.closest("astro-island")!==e)continue;let a=n.getAttribute("name")??n.getAttribute("data-astro-template")??"";t+=`${a}\\0${n.innerHTML}\\0`}return t}function Ae(e){let t=e.ownerDocument.defaultView?.customElements.get("astro-island");return t!==void 0&&e instanceof t&&Array.isArray(t.observedAttributes)&&t.observedAttributes.includes("props")}function j(e,t){if(!W(e)||!W(t))return!0;let n=q(t);if(!(Re.every(r=>e.getAttribute(r)===t.getAttribute(r))&&(v.get(e)??q(e))===n&&(e.getAttribute("props")===t.getAttribute("props")||Ae(e))))return v.set(t,n),!1;v.set(e,n);let o=t.getAttribute("props");return o!==e.getAttribute("props")&&(e.setAttribute("ssr",""),o===null?e.removeAttribute("props"):e.setAttribute("props",o)),!0}function Y(e){return Array.from(e.querySelectorAll("astro-island"))}function X(e){for(let t of e)t.isConnected||G.has(t)||(G.add(t),t.dispatchEvent(new CustomEvent("astro:unmount")))}function O(e){if(e==null)return[];let t=new Set,n=[];for(let a of e.split(/[\\s,]+/)){let o=a.trim();o.length===0||t.has(o)||(t.add(o),n.push(o))}return n}var A="data-payload-fragment",I="data-payload-fragment-key";var Te="data-payload-depends";function B(e){let t=e.getAttribute(A);if(t===null||t.length===0)return null;let n=e.getAttribute(I);return{element:e,id:t,key:n===null||n.length===0?void 0:n,dependsOn:O(e.getAttribute(Te))}}function J(e,t){let n=[];for(let a of e.querySelectorAll(`[${A}]`)){let o=B(a);o===null||V(a)||o.dependsOn.length>0&&!o.dependsOn.some(r=>t.has(r))||n.push(o)}return n}var Q="x-payload-fragment-version";function _(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Z(e){if(!_(e))return null;let{html:t,boundary:n,revision:a,metadata:o}=e;return typeof t!="string"||!_(n)||typeof n.id!="string"||n.key!==void 0&&typeof n.key!="string"||typeof a!="number"||!_(o)||typeof o.renderedAt!="string"||typeof o.renderer!="string"?null:e}function ee(e){let t={};for(let[n,a]of Object.entries(e))a!==void 0&&(t[n]=a);return t}function L(e){return e.reason instanceof Error?e.reason:new DOMException("The operation was aborted.","AbortError")}function C(e){return e?.aborted===!0}function te(e){let t=0,n=[],a=()=>{let o=n.shift();o===void 0?t-=1:o.resume()};return async(o,r)=>{if(r!==void 0&&C(r))throw L(r);if(t<e)t+=1;else if(await new Promise((d,m)=>{let l=()=>{},u={resume:()=>{l(),d()}};if(n.push(u),r!==void 0){let s=()=>{let c=n.indexOf(u);c!==-1&&(n.splice(c,1),l(),m(L(r)))};l=()=>{r.removeEventListener("abort",s)},r.addEventListener("abort",s,{once:!0}),C(r)&&s()}}),r!==void 0&&C(r))throw a(),L(r);try{return await o()}finally{a()}}}var xe=5e3,ke=4,Fe=512*1024,T={status:"superseded"};function b(e,t){return{status:"failed",code:e,reason:t}}function Oe(e){let t=()=>{throw new TypeError(\'createFragmentStrategy: endpoint must be a same-origin path starting with "/"\')};if((typeof e!="string"||!e.startsWith("/")||e.startsWith("//")||e.includes("\\\\"))&&t(),typeof location<"u"){let n;try{n=new URL(e,location.href)}catch{n=void 0}n?.origin!==location.origin&&t()}return e}function Ie(e){return typeof e=="object"&&e!==null&&typeof e.getReader=="function"}async function Ne(e,t,n){let a=e.body;if(!Ie(a)){let u=await e.text();return new TextEncoder().encode(u).byteLength>t?null:u}let o=a.getReader(),r=()=>{o.cancel().catch(()=>{})};n.addEventListener("abort",r,{once:!0});let d=new TextDecoder,m="",l=0;try{for(;;){let{done:u,value:s}=await o.read();if(u)break;if(l+=s.byteLength,l>t)return r(),null;m+=d.decode(s,{stream:!0})}}finally{n.removeEventListener("abort",r),o.releaseLock()}return m+d.decode()}function ne(e){let t=Oe(e.endpoint),n=e.timeoutMs??xe,a=e.maxResponseBytes??Fe,o=te(Math.max(1,e.maxConcurrent??ke)),r=new Map,d=new WeakMap,m=0,l=s=>{let c=d.get(s);return c!==void 0?c:(m+=1,d.set(s,m),m)};async function u(s,c){let i=()=>s.signal.aborted;if(i())return T;let h=e.location??location,p=ee({fragment:c.id,key:c.key,route:h.pathname,search:h.search,revision:s.revision,locale:s.locale,collectionSlug:s.collectionSlug,globalSlug:s.globalSlug,fields:s.fields}),f=k(s.signal,n),y=E=>i()?T:f.timedOut()?b("LP0801",`timeout after ${String(n)} ms`):b("LP0801",R(E)),g,x=!1;try{try{g=await(e.fetch??fetch)(t,{method:"POST",credentials:"same-origin",headers:{...e.headers,accept:"application/json","content-type":"application/json",[Q]:String(1)},body:JSON.stringify(p),signal:f.signal})}catch(M){return y(M)}if(i())return T;if(g.status===401||g.status===403)return b("LP0803",`endpoint refused the preview (${String(g.status)})`);if(!g.ok)return b("LP0801",`endpoint answered ${String(g.status)}`);let E=g.headers.get("content-type")??"";if(!E.toLowerCase().startsWith("application/json"))return b("LP0802",`unexpected content type "${E}"`);if(Number(g.headers.get("content-length")??"0")>a)return b("LP0802","response exceeds the size limit");if(f.signal.aborted)return y(f.signal.reason);let N;try{x=!0,N=await Ne(g,a,f.signal)}catch(M){return y(M)}if(i())return T;if(f.timedOut())return b("LP0801",`timeout after ${String(n)} ms`);if(N===null)return b("LP0802","response exceeds the size limit");let $;try{$=JSON.parse(N)}catch{return b("LP0802","response is not JSON")}let S=Z($);return S===null?b("LP0802","response has the wrong shape"):S.boundary.id!==c.id||S.boundary.key!==c.key?b("LP0802","response is for another boundary"):S.revision!==s.revision?T:{status:"rendered",html:S.html,metadata:S.metadata}}finally{if(f.dispose(),g!==void 0&&!x)try{g.body?.cancel().catch(()=>{})}catch{}}}return(s,c)=>{let i=JSON.stringify([l(s.signal),c.id,c.key,s.revision]),h=r.get(i);if(h!==void 0)return h;let p=!1,f=o(()=>(p=!0,u(s,c)),s.signal).catch(g=>{if(!p&&s.signal.aborted)return T;throw g});r.set(i,f);let y=()=>{r.get(i)===f&&r.delete(i)};return f.then(y,y),f}}var Me=new Set(["open","value","checked","selected"]);function oe(e,t){for(let n of t.keyAttributes){let a=e.getAttribute(n);if(a!==null&&a.length>0)return`${n}=${a}`}}function H(e,t,n){if(!U(e,t))return t;let a=n.boundary??F,o=a(e),r=a(t);if(o||r)return!o||!r?t:n.retainBoundary?.(e,t)??!0?e:t;let d=_e(e);return Pe(e,t),n.retainChildrenOf?.(e,t)!==!0&&ve(e,t,n),Le(d),e}function Pe(e,t){for(let n of Array.from(e.attributes))t.hasAttribute(n.name)||Me.has(n.name.toLowerCase())||e.removeAttribute(n.name);for(let n of Array.from(t.attributes))e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value)}function ve(e,t,n){let a=Be(e,n),o=new Set(a.values()),r=Array.from(e.childNodes).filter(c=>!o.has(c)),d=new Set,m=new Set,l=Array.from(t.childNodes),u=e.firstChild,s=0;for(let c=0;c<l.length;c+=1){let i=l[c],h=null,p=i instanceof Element?oe(i,n):void 0;if(p!==void 0&&m.has(p)&&(p=void 0),p!==void 0){m.add(p);let y=a.get(p);if(y!==void 0&&!d.has(y)&&(h=re(y,i,n)===y?y:null,h===null)){y.replaceWith(i),d.add(i),u=i.nextSibling;continue}}else{for(;s<r.length;){let y=r[s];if(s+=1,!d.has(y)){if(U(y,i)){h=re(y,i,n)===y?y:null,h===null&&(e.replaceChild(i,y),d.add(i),u=i.nextSibling);break}if(y instanceof Element){let g=l[c+1];if(!(i instanceof Element)||g!==void 0&&U(y,g)){s-=1;break}e.replaceChild(i,y),d.add(i),u=i.nextSibling;break}if(!(i instanceof Element)){e.replaceChild(i,y),d.add(i),u=i.nextSibling;break}}}if(h===null&&d.has(i))continue}let f=h??i;for(d.add(f);u!==null&&u!==f&&!d.has(u)&&De(u);)u=u.nextSibling;f!==u&&e.insertBefore(f,u),u=f.nextSibling}for(let c of Array.from(e.childNodes))d.has(c)||c.remove()}function re(e,t,n){return e instanceof Element&&t instanceof Element?H(e,t,n):(e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e)}function De(e){return e.nodeType===Node.TEXT_NODE&&(e.nodeValue??"").trim().length===0}function U(e,t){return e.nodeType!==t.nodeType?!1:e instanceof Element&&t instanceof Element?e.tagName===t.tagName&&e.namespaceURI===t.namespaceURI:!0}function Be(e,t){let n=new Map,a;for(let o of Array.from(e.children)){let r=oe(o,t);if(r!==void 0){if(n.has(r)){a??(a=r.slice(r.indexOf("=")+1));continue}n.set(r,o)}}return a!==void 0&&t.onDuplicateKey?.(e,a),n}function _e(e){let t=e.ownerDocument.activeElement;if(!(t instanceof HTMLElement)||!e.contains(t))return null;let n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?[t.selectionStart,t.selectionEnd]:null;return{element:t,selection:n}}function Le(e){if(e===null)return;let{element:t,selection:n}=e;if(!(t.ownerDocument.activeElement===t||!t.isConnected))try{t.focus({preventScroll:!0});let[a,o]=n??[null,null];a!==null&&o!==null&&t.setSelectionRange(a,o)}catch{}}var ae="data-payload-key";var Ce="__livePreviewRouteRefresh";function Ue(){return typ','eof window>"u"?void 0:window}function ie(){return Ue()?.[Ce]}var le="data-payload-strategy",de="data-payload-field",He="data-payload-depends",Ke="x-payload-live-preview",$e=8e3,Ge="route refresh returned no promise; re-applied before the host committed (see LivePreviewRouteRefresh)",We=1e3;function qe(e){let t=e.getAttribute(le);return t!==null?t==="route":e.closest("head")!==null}function ze(e){let t=e.getAttribute(de),n=O(e.getAttribute(He));return t===null||t.length===0?n:[t,...n]}function se(e){return e.hasAttribute(w)?!1:e.tagName==="META"?e.hasAttribute("name")||e.hasAttribute("property"):e.tagName==="LINK"&&e.getAttribute("rel")==="canonical"}function Ve(e,t){let n=Array.from(e.head.children).find(l=>l.tagName==="TITLE"),a=Array.from(t.head.children).find(l=>l.tagName==="TITLE");!n?.hasAttribute(w)&&!a?.hasAttribute(w)&&t.title!==e.title&&(e.title=t.title);let o=Array.from(e.head.children).filter(se),r=Array.from(t.head.children).filter(se),d=Math.min(o.length,r.length);o.slice(0,d).forEach((l,u)=>{let s=r[u];if(s===void 0)return;if(l.tagName===s.tagName){for(let i of Array.from(l.attributes))s.hasAttribute(i.name)||l.removeAttribute(i.name);for(let i of Array.from(s.attributes))l.getAttribute(i.name)!==i.value&&l.setAttribute(i.name,i.value);return}let c=e.importNode(s,!0);l.replaceWith(c),o[u]=c});let m=o.at(-1);for(let l of r.slice(o.length)){let u=e.importNode(l,!0);m===void 0?e.head.append(u):m.after(u),m=u}for(let l of o.slice(r.length))l.remove()}function ue(e={}){let t=e.timeoutMs??$e,n=e.minIntervalMs??We,a=-1/0,o=!1;return{plan(r,d,m){for(let l of r.querySelectorAll(`[${de}], [${le}="route"]`)){if(!qe(l)||m?.inScope(l)===!1)continue;let u=ze(l);if(u.length===0||u.some(s=>d.has(s)))return!0}return!1},async refresh(r){let d=Date.now(),m=n-(d-a);if(m>0)return r.retryAfter?.(m),r.log("LP0805",`route refresh for revision ${String(r.revision)} refused: the previous one was ${String(d-a)} ms ago`),"refused";a=d;let l=e.document??document,u=e.location??location,s=e.window??window,c=k(r.signal,t),i=h=>{if(r.signal.aborted)return"superseded";let p=c.timedOut()?`route refresh timed out after ${String(t)} ms`:R(h);return r.log("LP0801",p),"failed"};try{let h=ie();if(h!==void 0){try{let f=h();typeof f?.then!="function"&&!o&&(o=!0,r.log("LP0810",Ge)),await f}catch(f){return i(f)}return r.isCurrent()?"partial":"superseded"}let p;try{p=await(e.fetch??fetch)(u.href,{method:"GET",credentials:"same-origin",cache:"no-store",headers:{accept:"text/html",[Ke]:"route"},signal:c.signal})}catch(f){return i(f)}if(r.signal.aborted)return"superseded";if(!p.ok||!(p.headers.get("content-type")??"").includes("text/html"))return r.log("LP0802",`route answered ${String(p.status)} ${p.headers.get("content-type")??""}`),"failed";try{let f=await p.text();if(!r.isCurrent())return"superseded";let y=new DOMParser().parseFromString(f,"text/html"),g=s.scrollX,x=s.scrollY;Ve(l,y);let E=Y(l.body);return H(l.body,y.body,{boundary:F,retainBoundary:j,keyAttributes:[ae,I,A],retainChildrenOf:K=>K.hasAttribute(A)}),X(E),s.scrollTo(g,x),"partial"}catch(f){return i(f)}}finally{c.dispose()}}}}function je(e){return{plan:(t,n)=>J(t,n).map(a=>a.element),async render(t,n){let a={rendered:0,failed:0,superseded:0},o={revision:t.revision,receivedAt:t.receivedAt,fields:t.fields,locale:t.locale,collectionSlug:t.collectionSlug,globalSlug:t.globalSlug,signal:t.signal};return await Promise.all(n.map(async r=>{let d=B(r);if(d===null)return;let m;try{m=await e(o,d)}catch(l){m={status:"failed",code:"LP0801",reason:R(l)}}if(!t.isCurrent()||m.status==="superseded"){a.superseded+=1,t.log("LP0804",`fragment "${d.id}" for revision ${String(o.revision)} discarded as superseded`);return}if(m.status==="rendered"){t.morph(r,m.html),t.rendered(r,d.id,d.key),a.rendered+=1;return}t.failed(r,d.id,d.key,m.code,m.reason),t.isCurrent()&&t.patch(r),a.failed+=1})),a}}}function ce(e){return je(ne(e))}return he(Ye);})();'].join(""),na=/* @__PURE__ */['"use strict";var __LIVE_PREVIEW_ROUTE__=(()=>{var S=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var X=(e,t)=>{for(var n in t)S(e,n,{get:t[n],enumerable:!0})},J=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of V(t))!j.call(e,r)&&r!==n&&S(e,r,{get:()=>t[r],enumerable:!(a=G(t,r))||a.enumerable});return e};var Q=e=>J(S({},"__esModule",{value:!0}),e);var Re={};X(Re,{createRouteStrategy:()=>W});var T="data-payload-island",xe=`astro-island, [${T}]`,E="data-payload-owned",Z="data-payload-morph";function b(e){if(e.tagName.toLowerCase().includes("-")&&!e.hasAttribute(Z)||ne(e)||e.hasAttribute(E))return!0;let n=e.getAttribute("contenteditable");return n!==null&&n!=="false"}function ee(e){return e.tagName.toLowerCase()==="astro-island"||e.hasAttribute(T)}function te(e){return e.getAttribute(T)==="patch"}function ne(e){return ee(e)&&!te(e)}var re=["component-url","component-export","renderer-url","client","opts","before-hydration-url"],R=new WeakMap,I=new WeakSet;function N(e){return e.tagName.toLowerCase()==="astro-island"}function M(e){let t="";for(let n of e.querySelectorAll("astro-slot, template[data-astro-template]")){if(n.parentElement?.closest("astro-island")!==e)continue;let a=n.getAttribute("name")??n.getAttribute("data-astro-template")??"";t+=`${a}\\0${n.innerHTML}\\0`}return t}function oe(e){let t=e.ownerDocument.defaultView?.customElements.get("astro-island");return t!==void 0&&e instanceof t&&Array.isArray(t.observedAttributes)&&t.observedAttributes.includes("props")}function v(e,t){if(!N(e)||!N(t))return!0;let n=M(t);if(!(re.every(o=>e.getAttribute(o)===t.getAttribute(o))&&(R.get(e)??M(e))===n&&(e.getAttribute("props")===t.getAttribute("props")||oe(e))))return R.set(t,n),!1;R.set(e,n);let r=t.getAttribute("props");return r!==e.getAttribute("props")&&(e.setAttribute("ssr",""),r===null?e.removeAttribute("props"):e.setAttribute("props",r)),!0}function P(e){return Array.from(e.querySelectorAll("astro-island"))}function D(e){for(let t of e)t.isConnected||I.has(t)||(I.add(t),t.dispatchEvent(new CustomEvent("astro:unmount")))}var ae=new Set(["open","value","checked","selected"]);function C(e,t){for(let n of t.keyAttributes){let a=e.getAttribute(n);if(a!==null&&a.length>0)return`${n}=${a}`}}function w(e,t,n){if(!x(e,t))return t;let a=n.boundary??b,r=a(e),o=a(t);if(r||o)return!r||!o?t:n.retainBoundary?.(e,t)??!0?e:t;let d=ue(e);return ie(e,t),n.retainChildrenOf?.(e,t)!==!0&&le(e,t,n),ce(d),e}function ie(e,t){for(let n of Array.from(e.attributes))t.hasAttribute(n.name)||ae.has(n.name.toLowerCase())||e.removeAttribute(n.name);for(let n of Array.from(t.attributes))e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value)}function le(e,t,n){let a=de(e,n),r=new Set(a.values()),o=Array.from(e.childNodes).filter(f=>!r.has(f)),d=new Set,p=new Set,l=Array.from(t.childNodes),s=e.firstChild,c=0;for(let f=0;f<l.length;f+=1){let i=l[f],g=null,y=i instanceof Element?C(i,n):void 0;if(y!==void 0&&p.has(y)&&(y=void 0),y!==void 0){p.add(y);let u=a.get(y);if(u!==void 0&&!d.has(u)&&(g=B(u,i,n)===u?u:null,g===null)){u.replaceWith(i),d.add(i),s=i.nextSibling;continue}}else{for(;c<o.length;){let u=o[c];if(c+=1,!d.has(u)){if(x(u,i)){g=B(u,i,n)===u?u:null,g===null&&(e.replaceChild(i,u),d.add(i),s=i.nextSibling);break}if(u instanceof Element){let h=l[f+1];if(!(i instanceof Element)||h!==void 0&&x(u,h)){c-=1;break}e.replaceChild(i,u),d.add(i),s=i.nextSibling;break}if(!(i instanceof Element)){e.replaceChild(i,u),d.add(i),s=i.nextSibling;break}}}if(g===null&&d.has(i))continue}let m=g??i;for(d.add(m);s!==null&&s!==m&&!d.has(s)&&se(s);)s=s.nextSibling;m!==s&&e.insertBefore(m,s),s=m.nextSibling}for(let f of Array.from(e.childNodes))d.has(f)||f.remove()}function B(e,t,n){return e instanceof Element&&t instanceof Element?w(e,t,n):(e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e)}function se(e){return e.nodeType===Node.TEXT_NODE&&(e.nodeValue??"").trim().length===0}function x(e,t){return e.nodeType!==t.nodeType?!1:e instanceof Element&&t instanceof Element?e.tagName===t.tagName&&e.namespaceURI===t.namespaceURI:!0}function de(e,t){let n=new Map,a;for(let r of Array.from(e.children)){let o=C(r,t);if(o!==void 0){if(n.has(o)){a??(a=o.slice(o.indexOf("=")+1));continue}n.set(o,r)}}return a!==void 0&&t.onDuplicateKey?.(e,a),n}function ue(e){let t=e.ownerDocument.activeElement;if(!(t instanceof HTMLElement)||!e.contains(t))return null;let n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?[t.selectionStart,t.selectionEnd]:null;return{element:t,selection:n}}function ce(e){if(e===null)return;let{element:t,selection:n}=e;if(!(t.ownerDocument.activeElement===t||!t.isConnected))try{t.focus({preventScroll:!0});let[a,r]=n??[null,null];a!==null&&r!==null&&t.setSelectionRange(a,r)}catch{}}var O="data-payload-key";function F(e){if(e==null)return[];let t=new Set,n=[];for(let a of e.split(/[\\s,]+/)){let r=a.trim();r.length===0||t.has(r)||(t.add(r),n.push(r))}return n}var fe="__livePreviewRouteRefresh";function me(){return typ','eof window>"u"?void 0:window}function _(){return me()?.[fe]}var A="data-payload-fragment",k="data-payload-fragment-key";function L(e,t){let n=new AbortController,a=!1,r=()=>{n.abort()};e.addEventListener("abort",r,{once:!0});let o=setTimeout(()=>{a=!0,n.abort()},t);return{signal:n.signal,timedOut:()=>a,dispose:()=>{clearTimeout(o),e.removeEventListener("abort",r)}}}function U(e){return e instanceof Error?e.message:String(e)}var H="data-payload-strategy",$="data-payload-field",ye="data-payload-depends",pe="x-payload-live-preview",ge=8e3,Ee="route refresh returned no promise; re-applied before the host committed (see LivePreviewRouteRefresh)",he=1e3;function be(e){let t=e.getAttribute(H);return t!==null?t==="route":e.closest("head")!==null}function Ae(e){let t=e.getAttribute($),n=F(e.getAttribute(ye));return t===null||t.length===0?n:[t,...n]}function K(e){return e.hasAttribute(E)?!1:e.tagName==="META"?e.hasAttribute("name")||e.hasAttribute("property"):e.tagName==="LINK"&&e.getAttribute("rel")==="canonical"}function Se(e,t){let n=Array.from(e.head.children).find(l=>l.tagName==="TITLE"),a=Array.from(t.head.children).find(l=>l.tagName==="TITLE");!n?.hasAttribute(E)&&!a?.hasAttribute(E)&&t.title!==e.title&&(e.title=t.title);let r=Array.from(e.head.children).filter(K),o=Array.from(t.head.children).filter(K),d=Math.min(r.length,o.length);r.slice(0,d).forEach((l,s)=>{let c=o[s];if(c===void 0)return;if(l.tagName===c.tagName){for(let i of Array.from(l.attributes))c.hasAttribute(i.name)||l.removeAttribute(i.name);for(let i of Array.from(c.attributes))l.getAttribute(i.name)!==i.value&&l.setAttribute(i.name,i.value);return}let f=e.importNode(c,!0);l.replaceWith(f),r[s]=f});let p=r.at(-1);for(let l of o.slice(r.length)){let s=e.importNode(l,!0);p===void 0?e.head.append(s):p.after(s),p=s}for(let l of r.slice(o.length))l.remove()}function W(e={}){let t=e.timeoutMs??ge,n=e.minIntervalMs??he,a=-1/0,r=!1;return{plan(o,d,p){for(let l of o.querySelectorAll(`[${$}], [${H}="route"]`)){if(!be(l)||p?.inScope(l)===!1)continue;let s=Ae(l);if(s.length===0||s.some(c=>d.has(c)))return!0}return!1},async refresh(o){let d=Date.now(),p=n-(d-a);if(p>0)return o.retryAfter?.(p),o.log("LP0805",`route refresh for revision ${String(o.revision)} refused: the previous one was ${String(d-a)} ms ago`),"refused";a=d;let l=e.document??document,s=e.location??location,c=e.window??window,f=L(o.signal,t),i=g=>{if(o.signal.aborted)return"superseded";let y=f.timedOut()?`route refresh timed out after ${String(t)} ms`:U(g);return o.log("LP0801",y),"failed"};try{let g=_();if(g!==void 0){try{let m=g();typeof m?.then!="function"&&!r&&(r=!0,o.log("LP0810",Ee)),await m}catch(m){return i(m)}return o.isCurrent()?"partial":"superseded"}let y;try{y=await(e.fetch??fetch)(s.href,{method:"GET",credentials:"same-origin",cache:"no-store",headers:{accept:"text/html",[pe]:"route"},signal:f.signal})}catch(m){return i(m)}if(o.signal.aborted)return"superseded";if(!y.ok||!(y.headers.get("content-type")??"").includes("text/html"))return o.log("LP0802",`route answered ${String(y.status)} ${y.headers.get("content-type")??""}`),"failed";try{let m=await y.text();if(!o.isCurrent())return"superseded";let u=new DOMParser().parseFromString(m,"text/html"),h=c.scrollX,q=c.scrollY;Se(l,u);let z=P(l.body);return w(l.body,u.body,{boundary:b,retainBoundary:v,keyAttributes:[O,k,A],retainChildrenOf:Y=>Y.hasAttribute(A)}),D(z),c.scrollTo(h,q),"partial"}catch(m){return i(m)}}finally{f.dispose()}}}}return Q(Re);})();'].join(""),ra=["allowedOrigins","serverURL","apiRoute","mergeDepth","debug","debounceMs","enableA11y","heartbeatMs","disableVisibilityGate","visibilityGateThreshold","intersectionRootMargin","disableReferrerDetection","disableLocalhostMatching","scopeBindingsByOwner","skipUnchanged","eventSourcePolicy","sanitizerPolicy","fragmentEndpoint","revealEditedField","routeStrategy","onUnboundChange","onUnfaithfulPatch","autoBind","hydration","defaults","softNavigationEvents","subfieldCoverage","mergeTimeoutMs","internalLinkPattern"];function ia(e,t){if(0===e.length)throw new Error(`[live-preview] ${t} is empty. Run \`npm run build:runtime\` before bundling.`)}function oa(e){return!0===e.routeStrategy||"after-save"===e.routeStrategy}function sa(e){return null!=e.fragmentEndpoint?(ia(ta,"fragment.generated.ts"),[ta]):oa(e)?(ia(na,"route.generated.ts"),[na]):[]}function aa(e){return`var __LIVE_PREVIEW_CONFIG__=${function(e){t(e);const n=function(e){const t=e.defaults??"v2";return"v1"===t?{...Vs,defaults:t}:{defaults:t}}(e),r=ra.map(t=>{const r=e[t]??n[t];return function(e,t){if("number"!=typeof t||Number.isFinite(t))return;const n="visibilityGateThreshold"===e?" To never defer, set `disableVisibilityGate: true`.":"";throw new Error(`[live-preview] \`${e}\` is ${String(t)}, which the inline configuration writes as null, so the runtime would never see it. Pass a finite number.${n}`)}(t,r),r});for(;void 0===r.at(-1);)r.pop();return`[${r.map(e=>void 0===e?"":JSON.stringify(e)).join(",")}]`.replace(/</g,"\\u003C")}(e)};`}var la,ua=/[\t\n\f\r ]+/;function da(e,t){const n=e.charCodeAt(t);return 9===n||10===n||12===n||13===n||32===n}function ca(e){let t=0,n=e.length;for(;t<n&&da(e,t);)t+=1;for(;n>t&&da(e,n-1);)n-=1;return 0===t&&n===e.length?e:e.slice(t,n)}function fa(e){return e.replace(/[A-Z]/g,e=>e.toLowerCase())}var ha=/* @__PURE__ */new Map([["child-src",["default-src"]],["connect-src",["default-src"]],["font-src",["default-src"]],["frame-src",["child-src","default-src"]],["img-src",["default-src"]],["manifest-src",["default-src"]],["media-src",["default-src"]],["object-src",["default-src"]],["script-src",["default-src"]],["script-src-elem",["script-src","default-src"]],["script-src-attr",["script-src","default-src"]],["style-src",["default-src"]],["style-src-elem",["style-src","default-src"]],["style-src-attr",["style-src","default-src"]],["worker-src",["child-src","script-src","default-src"]]]);function pa(e,t){const n=ha.get(e);if(void 0!==n)for(const e of n){const n=t.get(e);if(void 0!==n)return n}}function ga(e,t){const n=/* @__PURE__ */new Map;for(const t of e.split(";")){const e=ca(t);if(0===e.length)continue;const r=e.search(ua),i=fa(r<0?e:e.slice(0,r));if(n.has(i))continue;const o=r<0?"":ca(e.slice(r));n.set(i,o)}for(const[e,r]of Object.entries(t)){const t=fa(e),i="string"==typeof r?{value:r}:r,o=i.mode??"union",s=n.get(t)??pa(t,n);if("replace"===o||void 0===s||0===s.length){n.set(t,i.value);continue}const a=/* @__PURE__ */new Set,l=[];for(const e of[...s.split(ua),...i.value.split(ua)])0===e.length||a.has(e)||(a.add(e),l.push(e));const u=l.filter(e=>"'none'"!==e);n.set(t,(u.length>0?u:l).join(" "))}const r=[];for(const[e,t]of n)r.push(0===t.length?e:`${e} ${t}`);return r.join("; ")}var ma="payload-live-preview.authorized-preview-context",va=Symbol.for(ma);function isAuthorizedPreviewContext(e){return"object"==typeof e&&null!==e&&!0===e[va]&&Object.isFrozen(e)}function ya(e){const t={...e,scope:Object.freeze({...e.scope,...void 0===e.scope.payload?{}:{payload:Object.freeze({...e.scope.payload,document:Object.freeze({...e.scope.payload.document})})}}),payloadHeaders:Object.freeze({...e.payloadHeaders}),[va]:!0,[ma]:!0};return Object.defineProperty(t,"payloadHeaders",{enumerable:!1}),Object.freeze(t)}var ba=class extends Error{name="PreviewConfigurationError"};function wa(e){return{authorized:!1,outcome:e,context:null}}var Sa="users",Aa=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,ka=/^[A-Za-z0-9._~-]+$/,Ta=/* @__PURE__ */new WeakMap;function Ca(e,t){let n;try{n=new URL(e)}catch{throw new ba(`payload-live-preview: ${t} "${e}" is not an absolute URL`)}if("https:"!==n.protocol&&"http:"!==n.protocol)throw new ba(`payload-live-preview: ${t} must be http(s), got "${n.protocol}"`);return n.origin}var Ra,$a="live-preview",La=36e5,Na="v1";function Pa(){return Ra??=new TextEncoder,Ra}function xa(e){const t="string"==typeof e?Pa().encode(e):e;if(t.byteLength<32)throw new ba(`payload-live-preview: the preview token secret must be at least ${String(32)} bytes`);return t}function Ea(e){if(void 0!==e)return e;const t=globalThis.crypto;return"object"==typeof t?.subtle?t:void 0}async function Ma(e,t){return e.subtle.importKey("raw",t,{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"])}function Oa(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Fa(e){if(!/^[A-Za-z0-9_-]*$/.test(e))return;const t=e.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-e.length%4)%4);try{const e=atob(t),n=new Uint8Array(e.length);for(let t=0;t<e.length;t+=1)n[t]=e.charCodeAt(t);return n}catch{return}}function Ua(e){return"string"==typeof e&&e.length>0&&"."!==e&&".."!==e&&!/[\s\p{Cc}\p{Cs}/\\?#%]/u.test(e)}var Ia=["preview","draft","livePreview"];function _a(e,t={}){const n=new Set(t.signals??["query","fetch-dest","referer"]),r=t.queryParams??Ia;if(n.has("query")){let t;try{t=new URL(e.url)}catch{t=void 0}if(void 0!==t)for(const e of r){const n=t.searchParams.getAll(e).at(-1);if("true"===n||"1"===n)return!0}}if(n.has("fetch-dest")&&"iframe"===e.headers.get("sec-fetch-dest"))return!0;const i=t.adminOrigins;void 0!==i&&Ir("admin-origins","`hasPreviewIntent({ adminOrigins })` is removed in 3.0: name the option `allowedOrigins`; `pll migrate` renames it (ADR 0026).");const o=t.allowedOrigins??i??[],s=n.has("referer")?o:[];if(s.length>0){const t=e.headers.get("referer");if(null!==t)try{const e=new URL(t).origin;for(const t of s)try{if(new URL(t).origin===e)return!0}catch{}}catch{}}return!1}var Da="payload-live-preview-highlight",ja=/* @__PURE__ */new WeakMap,Ba=/* @__PURE__ */new WeakMap,za={name:"highlight",version:"1.0.0",init:e=>{if("undefined"==typeof document||"undefined"==typeof window)return;const t="function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,n=function(e,t){let n=ja.get(e);void 0===n||n.connected()||(ja.delete(e),n=void 0),void 0===n&&(n=function(e,t){const n=e.getElementById(Da);if(n instanceof HTMLStyleElement)return{pluginOwned:!1,connected:()=>n.isConnected,remove:()=>{},owners:0};const r=function(e,t){try{if(!Array.isArray(e.adoptedStyleSheets)||"function"!=typeof CSSStyleSheet)return;const n=new CSSStyleSheet;if("function"!=typeof n.replaceSync)return;return n.replaceSync(t),e.adoptedStyleSheets=[...e.adoptedStyleSheets,n],n}catch{return}}(e,t);if(void 0!==r)return{pluginOwned:!0,connected:()=>e.adoptedStyleSheets.includes(r),remove:()=>{e.adoptedStyleSheets=e.adoptedStyleSheets.filter(e=>e!==r)},owners:0};const i=e.createElement("style");return i.id=Da,i.textContent=t,e.head.appendChild(i),{pluginOwned:!0,connected:()=>i.isConnected,remove:()=>{i.remove()},owners:0}}(e,t?".lp-highlight{outline:2px solid rgba(0,102,204,0.85);outline-offset:2px;}":"@keyframes lp-highlight{0%{outline:2px solid rgba(0,102,204,0.85);outline-offset:2px}100%{outline:2px solid transparent;outline-offset:2px}}.lp-highlight{animation:lp-highlight 0.6s ease-out;}"),ja.set(e,n));const r=n;r.owners+=1;let i=!0;return()=>{i&&(i=!1,r.owners-=1,r.owners>0||(ja.get(e)===r&&ja.delete(e),r.pluginOwned&&r.remove()))}}(document,t),r=t?1e3:600,i=/* @__PURE__ */new WeakMap,o=/* @__PURE__ */new Set;e.registerCleanup?.(()=>{for(const e of[...o])e();n()}),e.events.on("elementUpdate",e=>{const t=e.element;i.get(t)?.();const n=function(e){let t=Ba.get(e);void 0===t&&(t={owners:0,pluginAdded:!e.classList.contains("lp-highlight")},Ba.set(e,t));const n=t;n.owners+=1,e.classList.add("lp-highlight");let r=!0;return()=>{r&&(r=!1,n.owners-=1,n.owners>0||(Ba.delete(e),n.pluginAdded&&e.classList.remove("lp-highlight")))}}(t);let s=!1;const a=()=>{s||(s=!0,window.clearTimeout(l),i.get(t)===a&&i.delete(t),o.delete(a),n())},l=window.setTimeout(a,r);o.add(a),i.set(t,a)})}},Wa={name:"debug",version:"1.0.0",init:e=>{e.events.on("init",()=>{e.log("init")}),e.events.on("connect",t=>{e.log("connect ←",t.origin)}),e.events.on("disconnect",t=>{e.log("disconnect (",t.reason,")")}),e.events.on("cacheRefresh",t=>{e.log("cacheRefresh",t.elementCount,"elements,",t.fieldCount,"fields")}),e.events.on("beforeUpdate",t=>{e.log("beforeUpdate",Object.keys(t.data.fields).length,"fields")}),e.events.on("afterUpdate",t=>{e.log("afterUpdate",t.updatedCount,"in",t.durationMs.toFixed(2),"ms")}),e.events.on("error",t=>{e.log("error in",t.context,":",t.error.message)})}},Ha="payload-live-preview:scroll";function qa(){"undefined"!=typeof window&&(function(){if("undefined"!=typeof window)try{sessionStorage.setItem(Ha,JSON.stringify({href:window.location.href,x:window.scrollX,y:window.scrollY}))}catch{}}(),window.location.reload())}function bind(e,t){return Va(e,t)}function bindByPath(e,t){const n=function(e){const t=[],n=new Proxy({},{get(e,r){if("symbol"!=typeof r)return/^\d+$/.test(r)||t.push(r),n}});try{e(n)}catch{}return t}(e);if(0===n.length)throw new Error("bindByPath: the picker did not read any field — return data.<field> instead of a constant");return Va(n.join("."),t)}function Va(e,t){if(0===e.length)throw new Error("bind: field name must be a non-empty string");const n={"data-payload-field":e};return void 0!==t?.attribute&&(n["data-payload-attribute"]=t.attribute),void 0!==t?.type&&(n["data-payload-type"]=t.type),!0===t?.richtext&&(n["data-payload-richtext"]=""),!0===t?.html&&(n["data-payload-html"]=""),void 0!==t?.locale&&(n["data-payload-locale"]=t.locale),void 0!==t?.alt&&(n["data-payload-alt"]=t.alt),void 0!==t?.href&&(n["data-payload-href"]=t.href),void 0!==t?.arrayTemplate&&(n["data-payload-array-template"]=t.arrayTemplate),void 0!==t?.format&&(n["data-payload-format"]=t.format),!0===t?.text&&(n["data-payload-text"]=""),void 0!==t?.strategy&&(n["data-payload-strategy"]=t.strategy),void 0!==t?.dependsOn&&t.dependsOn.length>0&&(n["data-payload-depends"]=t.dependsOn.join(",")),!0===t?.anchor&&(n["data-payload-boundary"]=""),n}var Ga=/^[a-z][a-z0-9-]{0,63}$/u,Ja=Object.freeze({});function createPreviewBindings(e){const t=isAuthorizedPreviewContext(e.authorization),n=void 0!==e.owner&&e.owner.length>0?e.owner:void 0;return Object.freeze({authorized:t,bind:(e,n)=>t?bind(e,n):Ja,bindByPath:(e,n)=>t?bindByPath(e,n):Ja,owner:()=>t&&void 0!==n?{"data-payload-owner":n}:Ja,boundary:(e,n={})=>{const r=function(e,t){if(!Ga.test(e))throw new RangeError(`createPreviewBindings().boundary(): "${e}" is not a registry id — lowercase, starting with a letter, then letters, digits or hyphens (max 64). The runtime would post it and the endpoint would refuse it.`);const n=t.key;if(void 0!==n&&(0===n.length||n.length>128))throw new RangeError(`createPreviewBindings().boundary(): the key for "${e}" must be 1 to ${String(128)} characters.`);const r=t.dependsOn??[];return{"data-payload-fragment":e,...void 0!==n?{"data-payload-fragment-key":n}:{},...r.length>0?{"data-payload-depends":r.join(",")}:{}}}(e,n);return t?r:Ja},covers:(...e)=>{const n=function(e){for(const t of e)if(0===t.length||/[\s,]/u.test(t))throw new RangeError(`createPreviewBindings().covers(): "${t}" is not a field path — a name or a dotted path without spaces or commas.`);return{"data-payload-covers":e.join(" ")}}(e);return t&&e.length>0?n:Ja}})}exports.AUTHORIZED_PREVIEW_BRAND_KEY=ma,exports.CAPABILITY_DECLARATIONS=g,exports.CAPABILITY_DOCUMENTATION={basic:{gates:"data updates are applied to bound elements",fallback:"none — every peer has it"},"schema-json":{gates:"field typing from fieldSchemaJSON (Payload 2.x) and the payload-2 profile",fallback:"field types come from DOM heuristics and Lexical auto-detection"},locale:{gates:"locale-aware field resolution (`title_de` before `title`) and the locale on island events",fallback:"bindings resolve the unsuffixed field value"},"preview-token":{gates:"per-message token validation (library extension)",fallback:"messages carry no token; validateToken cannot be satisfied"},"nested-arrays":{gates:"keyed array diffs below the top level",fallback:"array updates replace the whole array"},"recursive-diffs":{gates:"recursive object diffs",fallback:"nested objects re-render as a unit"},"document-events":{gates:"the `documentSave` runtime event, the document-save plugin and the payload-3 profile",fallback:"no documentSave event; a save is not distinguishable from an edit"},"relationship-events":{gates:"the `relationshipUpdate` runtime event and an unconditional re-render of the update that carries it",fallback:"a related document edited in a drawer shows up on the next data update only"}},exports.DIAGNOSTIC_CODES=Zs,exports.EventEmitter=EventEmitter,exports.ISLAND_EVENT=lt,exports.LIBRARY_PROTOCOL_VERSION=4,exports.LivePreviewClient=LivePreviewClient,exports.OriginDetector=OriginDetector,exports.PROTOCOL_CAPABILITIES=m,exports.TRUSTED_TYPES_POLICY_NAME=Cr,exports.VERSION=e,exports.authorizePreviewRequest=async function(e,t){switch(t.type){case"payload-session":return async function(e,t){const n=function(e){const t=e??"payload-token";if(!Aa.test(t))throw new ba(`payload-live-preview: cookie name "${t}" is not a valid cookie-name token`);return t}(t.cookieName),r=Ca(t.serverURL,"serverURL"),i=void 0===t.origin?void 0:Ca(t.origin,"origin"),o=function(e,t,n=4096){if(null===e||0===e.length)return null;const r=`${t}=`,i=[];for(const t of e.split(";")){const e=t.trim();e.startsWith(r)&&i.push(e.slice(r.length))}if(1!==i.length)return null;const o=i[0]??"";return 0===o.length||o.length>n||!ka.test(o)?null:o}(e.headers.get("cookie"),n,t.maxCookieLength??4096);if(null===o)return wa("missing-credential");const s=t.now??Date.now,a=Math.max(250,t.timeoutMs??3e3);if(!Number.isSafeInteger(a))return wa("unavailable");const l=t.fetch??globalThis.fetch,u=`${r}/api/${encodeURIComponent(t.usersSlug??Sa)}/me?depth=0`,d=Ta.get(l)??/* @__PURE__ */new Map,c=`${n}=${o}`;let f={cookie:c};void 0!==i?f.origin=i:d.has(u)&&(f.origin=r);const h=new AbortController,p=()=>{h.abort(e.signal?.reason)},g=()=>h.signal.aborted;let m,v;e.signal?.addEventListener("abort",p,{once:!0}),!0===e.signal?.aborted&&p();try{if(g())return wa("unavailable");m=setTimeout(()=>{h.abort(new DOMException("The operation timed out","TimeoutError"))},a);for(let e=0;e<2;e++){const t=await l(u,{headers:{...f,accept:"application/json"},signal:h.signal});if(g())return wa("unavailable");if(!t.ok)return wa(401===t.status?"invalid":"unavailable");if(v=await t.json(),g())return wa("unavailable");const n="object"==typeof v&&null!==v?v.user:void 0;if(0!==e){if("object"!=typeof n||null===n||Array.isArray(n))break;void 0===f.origin?d.delete(u):(Ta.set(l,d),d.set(u,s()));break}if(void 0!==i||null!==n)break;if(void 0!==f.origin){if(s()-(d.get(u)??0)<6e4)break;d.set(u,s()),f={cookie:c}}else f={cookie:c,origin:r}}}catch{return wa("unavailable")}finally{void 0!==m&&clearTimeout(m),e.signal?.removeEventListener("abort",p)}const y=function(e,t){if("object"!=typeof e||null===e||Array.isArray(e))return null;const n=e.user;if("object"!=typeof n||null===n||Array.isArray(n))return null;const r=e.collection??n.collection;if(void 0!==r&&r!==t)return null;const i=n.id;return"string"==typeof i&&i.length>0?i:"number"==typeof i&&Number.isFinite(i)?String(i):null}(v,t.usersSlug??Sa);if(null===y)return wa("invalid");const b=function(e){const t=e.exp;return"number"!=typeof t||!Number.isFinite(t)||t<=0?void 0:t<1e11?1e3*t:t}(v);return void 0!==b&&b<=s()?wa("expired"):{authorized:!0,outcome:"authorized",context:ya({strategy:"payload-session",subject:y,authorizedAt:s(),expiresAt:b,scope:{},payloadHeaders:f})}}(e,t);case"signed-token":return async function(e,t){const n=xa(t.secret),r=Ea(t.crypto);if(void 0===r)return wa("unavailable");const i=function(e,t){if("header"===t?.kind)return e.headers.get(t.name??"x-preview-token");let n;try{n=new URL(e.url)}catch{return null}const r=n.searchParams.getAll(t?.param??"previewToken");return 1===r.length?r[0]??null:null}(e,t.transport);if(null===i||0===i.length)return wa("missing-credential");if(i.length>4096)return wa("invalid");const o=i.split(".");if(3!==o.length||o[0]!==Na)return wa("invalid");const s=o[1]??"",a=Fa(s),l=Fa(o[2]??"");if(void 0===a||32!==l?.byteLength)return wa("invalid");let u;try{const e=await Ma(r,n);u=await r.subtle.verify("HMAC",e,l,Pa().encode(`${Na}.${s}`))}catch{return wa("unavailable")}if(!u)return wa("invalid");const d=function(e){let t;try{t=JSON.parse((new TextDecoder).decode(e))}catch{return}if("object"!=typeof t||null===t)return;const n=t,r=e=>void 0===n[e]||"string"==typeof n[e];return 1===n.v&&"string"==typeof n.aud&&"string"==typeof n.pur&&"number"==typeof n.iat&&"number"==typeof n.exp&&"string"==typeof n.jti&&r("pth")&&r("loc")&&r("sub")?n:void 0}(a);if(void 0===d)return wa("invalid");const c=(t.now??Date.now)();if(d.exp<=c||d.iat>d.exp)return wa("expired");if(d.exp-d.iat>La)return wa("invalid");if(d.aud!==t.audience)return wa("wrong-audience");if(d.pur!==(t.purpose??$a))return wa("wrong-purpose");if(void 0!==d.pth){let t;try{t=new URL(e.url).pathname}catch{return wa("invalid")}if(d.pth!==t)return wa("wrong-path")}if(void 0!==d.loc){const n=t.locale?.(e);if(n!==d.loc)return wa("wrong-locale")}if(void 0!==t.replay){let e;try{e=await async function(e,t,n){return"consume"in e?!0===await e.consume(t,n):(Ir("replay-is-used","A `signed-token` replay store with `isUsed` and `markUsed` is removed in 3.0: implement `consume(id, expiresAt)`, which checks and records in one step (ADR 0026)."),!await e.isUsed(t)&&(await e.markUsed(t,n),!0))}(t.replay,d.jti,d.exp)}catch{return wa("unavailable")}if(!e)return wa("replayed")}return{authorized:!0,outcome:"authorized",context:ya({strategy:"signed-token",subject:d.sub,authorizedAt:c,expiresAt:d.exp,scope:{audience:d.aud,...void 0!==d.pth?{path:d.pth}:{},...void 0!==d.loc?{locale:d.loc}:{}},payloadHeaders:{}})}}(e,t);case"verifier":return async function(e,t){let n;try{n=await t.verify(e)}catch{return wa("unavailable")}if(null===n)return wa("invalid");if(!(void 0===n.scope?.payload||function(e){if("object"!=typeof e||null===e)return!1;const t=e,n=t.document;return!(null===function(e,t="/api"){if("string"!=typeof e||"string"!=typeof t)return null;try{const n=new URL(e);if(!["http:","https:"].includes(n.protocol)||n.username||n.password||n.search||n.hash)return null;const r=e.replace(/^[a-z]+:\/\/[^/]+/iu,"").replace(/\/+$/,""),i=t.replace(/^\//,"").replace(/\/$/,"");return""!==r&&!r.slice(1).split("/").every(Ua)||!i.split("/").every(Ua)?null:`${n.origin}${n.pathname.replace(/\/+$/,"")}/${i}`}catch{return null}}(t.serverURL,t.apiRoute)||"number"!=typeof t.maxDepth||!Number.isSafeInteger(t.maxDepth)||t.maxDepth<0||"object"!=typeof n||null===n||!Ua(n.slug))&&("global"===n.kind||"collection"===n.kind&&function(e){return"number"==typeof e?Number.isSafeInteger(e):Ua(e)}(n.id))}(n.scope.payload)&&Number.isFinite(n.expiresAt)))return wa("invalid");const r=(t.now??Date.now)();return void 0!==n.expiresAt&&n.expiresAt<=r?wa("expired"):{authorized:!0,outcome:"authorized",context:ya({strategy:"verifier",subject:n.subject,authorizedAt:r,expiresAt:n.expiresAt,scope:n.scope??{},payloadHeaders:n.payloadHeaders??{}})}}(e,t)}},exports.bind=bind,exports.bindByPath=bindByPath,exports.bindNavigationLifecycle=function(e,t={}){const n=t.windowTarget??globalThis.window,r=t.documentTarget??globalThis.document,i=[...new Set(t.softNavigationEvents??[])],o=()=>{e.suspend()},s=t=>{!0===t.persisted&&e.resume()};let a=!1;const l=()=>{a=!0},u=t=>{if(t.type===Ks){if(!a)return;a=!1}void 0===e.refreshAfterNavigation?e.refreshCache():e.refreshAfterNavigation()};let d=!1;n?.addEventListener("pagehide",o),n?.addEventListener("pageshow",s);for(const e of i)r?.addEventListener(e,u);const c=i.includes(Ks);return c&&r?.addEventListener(Xs,l),()=>{if(!d){d=!0,n?.removeEventListener("pagehide",o),n?.removeEventListener("pageshow",s);for(const e of i)r?.removeEventListener(e,u);c&&r?.removeEventListener(Xs,l)}}},exports.buildBuiltinRenderers=Hs,exports.buildFrameAncestors=function buildFrameAncestors(e={}){const{self:t=!0,origins:n=[],allowNone:r=!1}=e,i=/* @__PURE__ */new Set,o=[];if(r&&!t&&0===n.length)return"'none'";t&&(o.push("'self'"),i.add("'self'"));for(const e of n){const t=e.trim();0===t.length||i.has(t)||(i.add(t),o.push(t))}return o.length>0?o.join(" "):"'none'"},exports.buildScriptSrcWithNonce=function buildScriptSrcWithNonce(e,t={}){if(0===e.length)throw new RangeError("buildScriptSrcWithNonce: nonce is empty");const{self:n=!0,extra:r=[],strictDynamic:i=!1}=t,o=[];n&&o.push("'self'"),o.push(`'nonce-${e}'`),i&&o.push("'strict-dynamic'");for(const e of r){const t=e.trim();t.length>0&&o.push(t)}return o.join(" ")},exports.createAnalyticsPlugin=function(){let e=0,t=0,n=0;return{name:"analytics",version:"1.0.0",init:r=>{r.events.on("afterUpdate",r=>{e+=1,t+=r.updatedCount,n+=r.durationMs})},getStats:()=>({updateCount:e,totalElements:t,totalDurationMs:n,averageDurationMs:0===e?0:n/e})}},exports.createPreviewBindings=createPreviewBindings,exports.createPreviewFocusReporter=function(e,t){return n=>{const r=e();null!=r&&Js(r,n,t)}},exports.debugPlugin=Wa,exports.detectInitialLocale=detectInitialLocale,exports.detectProtocolProfile=detectProtocolProfile,exports.documentSavePlugin=function(e={}){const t=e.strategy??"silent";return{name:"document-save",version:"1.1.0",init:n=>{let r=!0;const i=/* @__PURE__ */new Set;n.registerCleanup?.(()=>{r=!1;for(const e of i)e.abort();i.clear()}),function(){if("undefined"!=typeof window)try{const e=sessionStorage.getItem(Ha);if(null===e)return;sessionStorage.removeItem(Ha);const t=JSON.parse(e);if(t.href!==window.location.href)return;window.scrollTo(t.x??0,t.y??0)}catch{}}(),n.events.on("documentSave",()=>{if(!r)return;if("silent"===t)return;if("reload"===t)return void qa();const o=new AbortController;i.add(o);const s="fetch"===t?async function(e,t,n){if(e.handler)try{await e.handler(n)}catch(e){if(!r||n.aborted)return;t("document-save handler threw:",e)}else t("document-save: fetch strategy selected but no handler supplied")}(e,n.log,o.signal):async function(e,t,n,r){if("undefined"==typeof fetch)return void t("document-save: revalidate strategy needs fetch — not available");const i=e.revalidateUrl??"/api/revalidate";let o=!1;try{const s=await fetch(i,{method:"POST",signal:n,headers:{"Content-Type":"application/json",...e.revalidateHeaders??{}},body:JSON.stringify({source:"payload-live-preview"})});if(!r()||n.aborted)return;o=s.ok,o||t("document-save revalidate non-2xx:",s.status)}catch(e){if(!r()||n.aborted)return;t("document-save revalidate failed:",e)}o||"reload"!==e.onRevalidateFailure||qa()}(e,n.log,o.signal,()=>r);s.finally(()=>{i.delete(o)})})}}},exports.escapeHtml=escapeHtml,exports.escapeHtmlAttribute=escapeHtmlAttribute,exports.generateCspNonce=function generateCspNonce(e=16){if(!Number.isInteger(e)||e<8)throw new RangeError(`generateCspNonce: bytes must be an integer >= 8, got ${String(e)}`);const t=function(){if(la?.getRandomValues)return la;const e=globalThis.crypto;return e?.getRandomValues?e:void 0}();if(!t)throw new Error("generateCspNonce: Web Crypto is unavailable. On Node 18 call setCspCrypto(webcrypto) once at startup, or run with --experimental-global-webcrypto. We won't fabricate a predictable nonce — that would silently defeat the entire CSP.");const n=new Uint8Array(e);return t.getRandomValues(n),function(e){let t="";for(const n of e)t+=String.fromCharCode(n);return("function"==typeof btoa?btoa(t):Buffer.from(e).toString("base64")).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}(n)},exports.generateInlineScript=function generateInlineScript(e={}){var t;"v1"===(t={defaults:e.defaults,onUnboundChange:e.onUnboundChange}).defaults&&Ir("defaults-v1","`defaults: 'v1'` is removed in 3.0: `pll migrate` writes the 1.x rows it stands for into your options, where they keep working (ADR 0026)."),void 0!==t.onUnboundChange&&Ir("on-unbound-change","`onUnboundChange` is removed in 3.0: name it `onUnfaithfulPatch`, where 'route' is 'escalate'; `pll migrate` renames it (ADR 0026).");const n=function(e){const t=e.runtime;if(void 0===t)return ia(Ys,"runtime.generated.ts"),Ys;if(ia(t.source,`the ${t.profile} runtime`),null!=e.fragmentEndpoint||oa(e))throw new Error(`[live-preview] the ${t.profile} runtime and the fragment or route strategy exclude each other: it carries no strategy runner, so the prelude would have nothing to talk to. Drop the runtime option, or drop \`fragmentEndpoint\`/\`routeStrategy\`.`);return t.source}(e);return[aa(e),...sa(e),n].join("\n")},exports.hasCapability=function hasCapability(e,t){return e.capabilities.has(t)},exports.hasPreviewIntent=_a,exports.highlightPlugin=za,exports.initLivePreview=function initLivePreview(e={}){const t=new LivePreviewClient({...e,autoStart:!1});return t.start()?t:null},exports.isAuthorizedPreviewContext=isAuthorizedPreviewContext,exports.isDevMode=isDevMode,exports.isExternalHttpUrl=isExternalHttpUrl,exports.isInIframe=isInIframe,exports.isInPopup=isInPopup,exports.isInPreviewContext=isInPreviewContext,exports.isInsideIsland=isInsideIsland,exports.isLexicalContent=Uo,exports.isPreviewRequest=(e,t)=>(Ir("is-preview-request","`isPreviewRequest()` is removed in 3.0: call `hasPreviewIntent()`, which takes the same arguments; `pll migrate` renames it (ADR 0026)."),_a(e,t)),exports.isSafeUrl=isSafeUrl,exports.issuePreviewToken=async function(e,t){const n=Ea(t.crypto);if(void 0===n)throw new Error("payload-live-preview: no Web Crypto implementation available to sign tokens");const r=xa(t.secret),i=(t.now??Date.now)(),o=Math.min(La,Math.max(1,e.ttlMs??6e5)),s=new Uint8Array(16);n.getRandomValues(s);const a={v:1,aud:e.audience,...void 0!==e.path?{pth:e.path}:{},...void 0!==e.locale?{loc:e.locale}:{},...void 0!==e.subject?{sub:e.subject}:{},pur:e.purpose??$a,iat:i,exp:i+o,jti:Oa(s)},l=Oa(Pa().encode(JSON.stringify(a))),u=`${Na}.${l}`,d=await Ma(n,r);return`${u}.${Oa(new Uint8Array(await n.subtle.sign("HMAC",d,Pa().encode(u))))}`},exports.lexicalToHtml=Io,exports.lexicalToPlainText=_o,exports.markHydrated=function(){const e=Wn();void 0!==e&&Un(e)},exports.mergeCspHeader=function(e,t){const n=e.split(",").filter(e=>e.trim().length>0);return 0===n.length?ga("",t):n.map(e=>ga(e,t)).join(", ")},exports.negotiateProtocol=negotiateProtocol,exports.previewBindingsFromLocals=function(e,t={}){return createPreviewBindings({authorization:("object"==typeof e&&null!==e?e.livePreviewAuthorization:void 0)??null,...void 0!==t.owner?{owner:t.owner}:{}})},exports.registerBlockRenderer=function(e,t){Lo.set(e,t)},exports.registerBuiltinRenderer=function(e){zs.set(e.name,e)},exports.registerRouteRefresh=function registerRouteRefresh(e){const t="undefined"==typeof window?void 0:window;return void 0===t?()=>{}:(t[Qs]=e,()=>{t[Qs]===e&&(t[Qs]=void 0)})},exports.reportPreviewFocus=Js,exports.runtimeBuildInfo=function(){return ea},exports.sanitizeHtml=sanitizeHtml,exports.setCspCrypto=function setCspCrypto(e){la=e??void 0},exports.setSanitizerDocument=function setSanitizerDocument(e){Ir("set-sanitizer-document","`setSanitizerDocument()` is removed in 3.0: pass the document per call, `sanitizeHtml(html, { document })` or `lexicalToHtml(content, { document })` (ADR 0026)."),globalThis[Qr]=e??void 0},exports.setSanitizerPolicy=function(e){Xr=e},exports.setTrustedTypesPolicy=function(e){$r().override=e},exports.trustedHtml=Lr,exports.wrapWithScriptTag=function(e,t={}){return`<script${void 0!==t.nonce?` nonce="${function(e){if(!/^[A-Za-z0-9+/=_-]+$/.test(e))throw new RangeError("nonce contains characters CSP does not allow");return e}(t.nonce)}"`:""}>${e}<\/script>`};
1
+ "use strict";var e="2.3.2";function t(e){if("v1"!==e.defaults&&""!==(e.serverURL??"")&&null==e.mergeDepth)throw new Error("payload-live-preview: `serverURL` needs an explicit `mergeDepth` under the 2.0 defaults — choose the population depth deliberately (0 for none), or pass `defaults: 'v1'` to keep the 1.x default of 1 while migrating (ADR 0007, entry 10).")}function detectInitialLocale(){return function(){if("undefined"==typeof document)return;const e=document.documentElement.getAttribute("lang");return null===e||0===e.length?void 0:e}()??function(){if("undefined"==typeof navigator)return;const e=navigator.language;return"string"==typeof e&&e.length>0?e:void 0}()??"en"}var n="payload-live-preview-a11y",r=/* @__PURE__ */new WeakMap;function i(e){null!==e.timer&&(clearTimeout(e.timer),e.timer=null),e.messageNode?.remove(),e.messageNode=null}var o=class{german;document;lease=null;constructor(e,t){const n=t??("undefined"==typeof document?null:document),r=n?.documentElement.getAttribute("lang")??"";this.german=function(e){return/^de(?:[-_]|$)/i.test(e)}(e??(r.length>0?r:detectInitialLocale())),this.document=n}mount(){const e=this.document;if(null==e?.body)return null;this.lease??=function(e){let t=r.get(e);return void 0===t&&(t={element:null,owned:!1,messageNode:null,refs:0,timer:null},r.set(e,t)),t.refs+=1,t}(e);const t=this.lease,o=t.element;if(o?.isConnected&&o.ownerDocument===e)return o;if(null!==o){const e=t.owned;i(t),e&&o.remove()}let s=e.getElementById(n);return t.owned=null===s,null===s&&(s=e.createElement("div"),s.id=n,s.setAttribute("role","status"),s.setAttribute("aria-live","polite"),s.setAttribute("aria-atomic","true"),s.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0",e.body.appendChild(s)),t.element=s,s}announceConnected(){this.say(this.german?"Vorschau verbunden":"Live preview connected")}announceDisconnected(){this.say(this.german?"Vorschau getrennt":"Live preview disconnected")}announceUpdate(e){e<=0||this.say(this.german?`${String(e)} ${1===e?"Änderung":"Änderungen"} angewendet`:`${String(e)} ${1===e?"change":"changes"} applied`)}announcePartial(){this.say(this.german?"Vorschau teilweise aktualisiert":"Preview partly updated")}detach(){const e=this.lease,t=this.document;if(null===e||null===t)return;if(this.lease=null,e.refs-=1,e.refs>0)return;const n=e.element;null!==n&&i(e),e.owned&&n?.remove(),e.element=null,r.delete(t)}say(e){const t=this.mount(),n=this.lease;if(null===t||null===n)return;let r=n.messageNode;r?.parentNode!==t?(r?.remove(),r=t.ownerDocument.createTextNode(t.hasChildNodes()?` ${e}`:e),n.messageNode=r,t.appendChild(r)):r.data=null===r.previousSibling?e:` ${e}`,null!==n.timer&&clearTimeout(n.timer);const o=setTimeout(()=>{n.timer===o&&n.element===t&&i(n)},1500);n.timer=o}};function s(e){if(++e.nodes>1e4)throw new Error("invalid or oversized field schema")}function a(e,t,n){if(s(t),n>64||t.active.has(e))throw new Error("invalid or oversized field schema");t.active.add(e)}function l(e){try{return u(e,{nodes:0,active:/* @__PURE__ */new WeakSet},0)}catch{return[]}}function u(e,t,n){if(!Array.isArray(e))return[];a(e,t,n);const r=[];for(const i of e){const e=d(i,t,n);e&&r.push(e)}return t.active.delete(e),r}function d(e,t,n){if(s(t),"object"!=typeof e||null===e)return;const r=e,i=r.name,o=r.type;if("string"!=typeof i||0===i.length)return;if("string"!=typeof o||0===o.length)return;const l=u(r.fields,t,n+1),d=function(e,t,n){if("object"==typeof e&&null!==e&&!Array.isArray(e)){a(e,t,n);const r=[];for(const i in e){if(!Object.hasOwn(e,i))continue;s(t);const o=Reflect.get(e,i);"object"!=typeof o||null===o||["__proto__","constructor","prototype"].includes(i)||r.push({...o,slug:i,fields:u(o.fields,t,n+1)})}return t.active.delete(e),r}if(!Array.isArray(e))return[];a(e,t,n);const r=[];for(const i of e){if(s(t),"object"!=typeof i||null===i)continue;const e=i,o=e.slug;if("string"!=typeof o||0===o.length)continue;const a=u(e.fields,t,n+1);r.push({...e,slug:o,fields:a})}return t.active.delete(e),r}(r.blocks,t,n+1),c={...r,name:i,type:o},f=r.relationTo;if(Array.isArray(f)){const e=[];for(const n of f)s(t),e.push(n);c.relationTo=e}return l.length>0?c.fields=l:delete c.fields,d.length>0?c.blocks=d:delete c.blocks,c}function c(e,t){return void 0===e||t(e)}function f(e,t){return null==e||t(e)}function h(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}var p=["data","fieldSchemaJSON","globalSlug","collectionSlug","locale","ready","previewToken","protocolVersion"],g={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"}},m=Object.keys(g);function negotiateProtocol(e,t=[]){const n="number"==typeof e&&Number.isFinite(e)&&e>=1?Math.floor(e):void 0,r=n??1,i=Math.min(4,r),o=new Set(t),s=/* @__PURE__ */new Set;for(const e of m)(i>=g[e].since||o.has(e))&&s.add(e);return{ours:4,...void 0!==n?{theirs:n}:{theirs:void 0},negotiated:i,capabilities:s,observed:o}}function v(e){return("object"==typeof e&&null!==e||"function"==typeof e)&&"function"==typeof e.then&&(Promise.resolve(e).catch(()=>{}),!0)}function y(e,t){return e.generation===t.generation&&e.revision===t.revision}var b=class{matcher;handlers;boundListener=void 0;attachedTarget=void 0;generation=0;revision=0;queueHead=void 0;queueTail=void 0;lastAccepted=void 0;replayedGeneration=0;latestAcceptedAttempt=void 0;constructor(e,t){this.matcher=e,this.handlers=t}attach(e=window){if(void 0!==this.attachedTarget)return;let t=!1;const n=r=>{if(!t||this.boundListener!==n)return;const i=this.generation;try{this.receive(r,i,e)}catch{let e;try{e=r.origin}catch{e=""}this.reportInvalid("shape",e,i)}};this.generation+=1,this.resetQueue(),this.attachedTarget=e,this.boundListener=n;try{e.addEventListener("message",n)}catch(t){this.boundListener===n&&(this.attachedTarget=void 0,this.boundListener=void 0,this.resetQueue());try{e.removeEventListener("message",n)}catch{}throw t}if(this.boundListener===n)t=!0;else try{e.removeEventListener("message",n)}catch{}}detach(){const e=this.attachedTarget,t=this.boundListener;void 0!==e&&void 0!==t&&(this.attachedTarget=void 0,this.boundListener=void 0,this.resetQueue(),e.removeEventListener("message",t))}advanceGeneration(){return void 0!==this.attachedTarget&&(this.generation+=1,this.resetQueue(),!0)}replayLastAccepted(){const e=this.lastAccepted,t=this.generation,n=this.handlers.onReplay;if(void 0===n||void 0===e||e.generation>=t||this.replayedGeneration===t)return!1;if(!this.matchesOrigin(e.origin,t)||this.lastAccepted!==e)return!1;this.replayedGeneration=t;const r={generation:t,revision:this.revision+=1};return this.invokeHandler(t,n,structuredClone(e.message),e.origin,r),!0}forgetLastAccepted(){this.lastAccepted=void 0,this.replayedGeneration=0,this.latestAcceptedAttempt=void 0}static sendReady(e,t){const n={type:"payload-live-preview",ready:!0,protocolVersion:4};for(const r of e)for(const e of t)try{r.postMessage(n,e)}catch{}}receive(e,t,n){const r=e.origin;if(!this.matchesOrigin(r,t))return void this.reportInvalid("origin",r,t);if(!this.matchesSource(e,n))return void this.reportInvalid("source",r,t);const i=e.data;var o;if("object"==typeof(o=i)&&null!==o&&"type"in o&&"string"==typeof o.type)switch(i.type){case"payload-live-preview":return function(e){const t=e;return!(void 0!==t.data&&null!==t.data&&!h(t.data))&&f(t.fieldSchemaJSON,e=>Array.isArray(e))&&f(t.globalSlug,e=>"string"==typeof e)&&f(t.collectionSlug,e=>"string"==typeof e)&&f(t.locale,e=>"string"==typeof e)&&f(t.ready,e=>"boolean"==typeof e)&&f(t.previewToken,e=>"string"==typeof e)&&f(t.protocolVersion,e=>"number"==typeof e)}(i)?void this.dispatchUpdate(function(e){const t={...e};for(const e of p)null===Reflect.get(t,e)&&Reflect.deleteProperty(t,e);return Array.isArray(t.fieldSchemaJSON)?{...t,fieldSchemaJSON:l(t.fieldSchemaJSON)}:t}(i),r,t):void this.reportInvalid("shape",r,t);case"payload-document-event":return function(e){const 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))}(i)?void this.invokeHandler(t,this.handlers.onDocumentEvent,i,r):void this.reportInvalid("shape",r,t);case"payload-live-preview-focus":{const e=function(e){const t=e.field;return"string"==typeof t&&t.length>0?t:void 0}(i);return void 0===e?void this.reportInvalid("shape",r,t):void this.invokeHandler(t,this.handlers.onFocusField,e,r)}default:this.reportInvalid("type",r,t)}else this.reportInvalid("shape",r,t)}dispatchUpdate(e,t,n){const r=h(e.data);if(!this.isCurrentGeneration(n))return;const i=r?{generation:n,revision:this.revision+=1}:void 0,o=this.handlers.validateToken;if(!this.isCurrentGeneration(n))return;if(void 0===o)return void this.commitUpdate(e,t,n,i);if(!0===e.ready&&void 0===e.data)return void this.commitUpdate(e,t,n,void 0);const s={generation:n,message:e,origin:t,messageRevision:i,verdict:void 0,next:void 0};let a;this.enqueue(s);try{a=o(e.previewToken,t)}catch{return void this.settleValidation(s,!1)}"boolean"!=typeof a?Promise.resolve(a).then(e=>{this.settleValidation(s,!0===e)},()=>{this.settleValidation(s,!1)}):this.settleValidation(s,a)}settleValidation(e,t){e.verdict=t,this.drainQueue(e.generation)}drainQueue(e){for(;this.isCurrentGeneration(e);){const 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,n,r){if(void 0===r)this.invokeHandler(n,this.handlers.onUpdate,e,t);else{const i={};this.latestAcceptedAttempt=i;const o=function(e){const t={...e};delete t.previewToken;try{return structuredClone(t)}catch{return null}}(e);if(this.latestAcceptedAttempt!==i||!this.isCurrentGeneration(n))return;this.lastAccepted=null===o?void 0:{generation:n,message:o,origin:t},this.invokeHandler(n,this.handlers.onUpdate,e,t,r)}}reportInvalid(e,t,n){this.invokeHandler(n,this.handlers.onInvalid,e,t)}matchesSource(e,t){if("parent-or-opener"!==this.handlers.sourcePolicy)return!0;try{const n=e.source;if("object"!=typeof n||null===n)return!1;const r=t.parent;return r!==t&&n===r||n===t.opener}catch{return!1}}matchesOrigin(e,t){try{return!0===(this.isCurrentGeneration(t)&&this.matcher(e))&&this.isCurrentGeneration(t)}catch{return!1}}invokeHandler(e,t,...n){if(void 0!==t&&this.isCurrentGeneration(e))try{v(t(...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}};function w(e){return(...t)=>{try{v(e(...t))}catch{}}}function S(){}var A=w((...e)=>console.error(...e)),k=w((...e)=>console.warn(...e)),T=w((...e)=>console.debug(...e)),C={"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'"},R=/* @__PURE__ */new Set;function $(e){R.has(e)||(R.add(e),k(`[live-preview] LP0104: this page carries the lean runtime, which leaves out ${e} (${C[e]}). The elements are left as the server rendered them. Remove \`runtime: LEAN_RUNTIME\` to get the full runtime.`))}function L(e){return"undefined"!=typeof __LEAN_BUILD__&&__LEAN_BUILD__?function(e){return!1!==e.enableA11y&&$("screen-reader announcements"),null}(e):function(e){if(!1===e.enableA11y)return null;const t=e.root,n=void 0===t?void 0:function(e){return 9===e.nodeType}(t)?t:t.ownerDocument;return new o(e.a11yLocale,n)}(e)}function N(e){if("undefined"==typeof window)return;const t=[];window.parent!==window&&t.push(window.parent),window.opener instanceof Window&&t.push(window.opener),b.sendReady(t,e)}function P(e){const t={};for(const[n,r]of Object.entries(e))void 0!==r&&(t[n]=r);return t}var x=/* @__PURE__ */new Set(["tabs","row","collapsible"]);function E(e,t,n,r){for(const i of e){if(x.has(i.type)){const e=i.fields;e&&E(e,r&&"tabs"===i.type?""===t?i.name:`${t}.${i.name}`:t,n,r);continue}const e=""===t?i.name:`${t}.${i.name}`;if(n.set(e,i),"group"===i.type)i.fields&&E(i.fields,e,n,r);else if("array"===i.type&&i.fields)E(i.fields,`${e}.*`,n,r);else if("blocks"===i.type&&i.blocks)for(const t of i.blocks)E(t.fields,`${e}.*.${t.slug}`,n,r)}}function M(e,t){if(e.has(t))return e.get(t);const n=t.replace(/\.\d+(?=\.|$)/g,".*");return e.has(n)?e.get(n):void 0}function O(e){if("object"!=typeof e||null===e)return;const t=e.id;return"string"==typeof t||"number"==typeof t?t:void 0}function F(e){if("object"!=typeof e||null===e)return;const t=e.blockType;return"string"==typeof t?t:void 0}function U(e,t){return t.every(e=>void 0!==O(e))?function(e,t){const n=[],r=/* @__PURE__ */new Map;for(let t=0;t<e.length;t+=1){const n=O(e[t]);void 0!==n&&r.set(n,t)}const i=/* @__PURE__ */new Set;for(let o=0;o<t.length;o+=1){const s=t[o],a=O(s);if(void 0===a){n.push({kind:"insert",index:o,value:s});continue}const l=r.get(a);if(void 0===l){n.push({kind:"insert",index:o,value:s});continue}i.add(l);const u=e[l];F(u)===F(s)?(l!==o&&n.push({kind:"move",from:l,to:o,value:s}),I(u,s)||n.push({kind:"update",index:o,value:s})):n.push({kind:"replace",index:o,oldValue:u,value:s})}for(let t=0;t<e.length;t+=1)i.has(t)||n.push({kind:"remove",index:t,value:e[t]});return n}(e,t):function(e,t){const n=[],r=Math.min(e.length,t.length);for(let i=0;i<r;i+=1)I(e[i],t[i])||n.push({kind:"update",index:i,value:t[i]});if(t.length>e.length)for(let r=e.length;r<t.length;r+=1)n.push({kind:"insert",index:r,value:t[r]});if(e.length>t.length)for(let r=t.length;r<e.length;r+=1)n.push({kind:"remove",index:r,value:e[r]});return n}(e,t)}function I(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;const n=e,r=t,i=Object.keys(n),o=Object.keys(r);if(i.length!==o.length)return!1;for(const e of i)if(!Object.is(n[e],r[e]))return!1;return!0}var _={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"},D=/* @__PURE__ */new Set(["http:","https:","mailto:","tel:"]),j=/^(?:\.{1,2}\/|[a-zA-Z0-9_-]+\/?)/,B=/^[\\/]{2}/,z=/[\t\n\r]/g,W=/[\s\u0000-\u001f\u180e\u2000-\u2029]/g,H=/^([a-z][a-z0-9+.-]*):/i;function isSafeUrl(e){if("string"!=typeof e)return!1;const t=e.trim().replace(z,"");if(0===t.length)return!1;if(t.startsWith("#")||t.startsWith("?"))return!0;if(B.test(t))return!0;if(t.startsWith("/"))return!0;try{const e=new URL(t);return D.has(e.protocol)}catch{return j.test(t)&&!function(e){const t=H.exec(e.replace(W,""))?.[1];return void 0!==t&&!D.has(`${t.toLowerCase()}:`)}(t)}}function isExternalHttpUrl(e){const t=e.trim().replace(z,"");return/^https?:\/\//i.test(t)||B.test(t)}var q=/* @__PURE__ */new Set(["style","srcdoc","formaction","form","id","name","is","srcset","imagesrcset"]),V=/* @__PURE__ */new Set(["href","src","poster","cite","action","xlink:href","data"]);function G(e){return!e.startsWith("on")&&!q.has(e)}function J(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 K(e){return e.onUnfaithfulPatch??("ignore"===e.onUnboundChange?"ignore":"escalate")}function X(e,t,n,r,i){const o=e.onUnfaithfulPatch,s=t.reportedUnfaithful.get(n.element),a=J(i),l=Date.now(),u=void 0!==s&&("escalate"!==o||void 0===a||a===s.identity||l-s.at<1e3);if((u||"escalate"!==o)&&t.display.shortfall(t.activeUpdate,{kind:"unfaithful",field:n.fieldName}),!u){if(t.reportedUnfaithful.set(n.element,{identity:a,at:l}),void 0===s){if(t.unfaithfulCount+=1,t.unfaithfulFields.add(n.fieldName),"ignore"===o)return;if("warn"===o)return void e.warn(`[live-preview] LP0411: "${n.fieldName}" ${r}`)}e.log("LP0411",n.fieldName,r),t.unfaithfulPatches.push(n)}}function Q(e,t){return!e.unfaithfulFields.has(t)&&(e.unfaithfulFields.add(t),e.unfaithfulCount+=1,!0)}var Z=/* @__PURE__ */new Set(["date","number","checkbox","select","radio"]);function Y(e){return"select"===e||"radio"===e}function ee(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value:e.textContent}function te(e){const t=e.trim();return JSON.stringify(t.length>40?`${t.slice(0,40)}…`:t)}var ne=/* @__PURE__ */new WeakSet;function re(e){return ne.add(e),e}var ie=class{previous=null;lastFields;priorFields;keepValues=!1;get previousFields(){return this.priorFields}get isBaseline(){return null===this.previous}diff(e,t,n=oe){const r=this.previous,i=null===r,o=/* @__PURE__ */new Map,s=/* @__PURE__ */new Set,a=Object.entries(e);if(!n())return null;for(const[e,t]of a){const i=J(t);if(!n())return null;o.set(e,i),null!==r&&void 0!==i&&r.get(e)===i||s.add(e)}if(null!==r)for(const e of r.keys())o.has(e)||s.add(e);const l=/* @__PURE__ */new Set,u=Object.entries(t);if(!n())return null;for(const[e,t]of u)if(s.has(e))for(const e of t)if(l.add(e),!n())return null;return n()?(this.previous=o,this.priorFields=this.keepValues?this.lastFields:void 0,this.lastFields=this.keepValues?e:void 0,{changed:s,invalidated:l,baseline:i}):null}reset(){this.previous=null,this.lastFields=void 0,this.priorFields=void 0}};function oe(){return!0}var se=/* @__PURE__ */new Set(["__proto__","prototype","constructor"]);function ae(e,t,n,r=!1){if(r&&void 0!==n){const r=le(e,`${t}_${n}`);if(void 0!==r)return r}const i=le(e,t);if(void 0!==i)return i;if(t.includes(".")){let n=e,r=!0;for(const e of t.split(".")){if(se.has(e)||null===n||"object"!=typeof n){r=!1;break}if(n=le(n,e),void 0===n){r=!1;break}}if(r)return n}return void 0===n?void 0:le(e,`${t}_${n}`)}function le(e,t){if(!se.has(t)&&Object.prototype.hasOwnProperty.call(e,t))return e[t]}function ue(e,t,n,r){return ae(e,n,t.locale??r,void 0!==t.locale)}function de(e,t,n,r){const i=J(t);if(void 0===i)return;const o=[e.hrefField,e.srcField,e.altField];let s=JSON.stringify([e.format,e.locale??r])+i;for(const t of o){if(void 0===t||0===t.length)continue;const i=J(ue(n,e,t,r));if(void 0===i)return;s+=`|${t}=${i}`}return s}var ce="data-payload-fragment",fe="data-payload-fragment-key";function he(e){return e.closest(`[${ce}]`)}function pe(e,t,n){const r=new Set(t);return{boundaries:t,strategy:e,ownerKeys:n,covers:e=>void 0!==e.fragmentBoundary&&r.has(e.fragmentBoundary)}}function ge(e){const t=e.getAttribute("data-payload-strategy");return null!==t&&t.length>0?"patch"===t||"fragment"===t||"route"===t?t:void 0:null!==he(e)?"fragment":null!==e.closest("head")?"route":"patch"}function me(e,t){return void 0===t||""===t?`collection:${e}`:`collection:${e}:${t}`}function ve(e){return"string"==typeof e&&e.length>0}function ye(e,t){return null!==t&&void 0!==e&&t.includes(e)}function be(e){const t=e.id;return"string"==typeof t&&t.length>0?t:"number"==typeof t&&Number.isFinite(t)?String(t):void 0}function we(e){return"object"==typeof e&&null!==e}function Se(e){return Array.isArray(e)?"array":we(e)?"object":"scalar"}function Ae(e,t){return we(e)?e[t]:void 0}function ke(e,t){return("string"==typeof t||"number"==typeof t)&&we(e)&&!Array.isArray(e)&&e.id===t}function Te(e,t){if(!we(e)||!we(t))return ke(e,t)||ke(t,e)||J(e)===J(t);if(Array.isArray(e)!==Array.isArray(t))return!1;const n=Object.keys(t);return n.length===Object.keys(e).length&&n.every(n=>Object.hasOwn(e,n)&&Te(Ae(e,n),Ae(t,n)))}function Ce(e,t){const n=J(t),r=J(e);return void 0!==n&&n===r||!(!ke(e,t)&&!ke(t,e))||void 0!==n&&void 0!==r&&Te(e,t)}function Re(e,t,n){let r=t,i=n;for(const t of e.split("."))r=Ae(r,t),i=Ae(i,t);return!Ce(r,i)}function $e(e,t,n,r){const i=[];let o=0;const s=(e,t,n,a)=>{if(o+=1,r.covers(e)||Ce(t,n))return;if(!((void 0===t||Se(t)===Se(n))&&we(n)&&r.reachesBelow(e)&&a<8))return void i.push({path:e,value:n});const l=function(e,t){const n=new Set(Object.keys(t));if(we(e))for(const t of Object.keys(e))n.add(t);return[...n]}(t,n);0===l.length&&i.push({path:e,value:n});for(const r of l){if(o>=1024)return void i.push({path:e,value:n});s(`${e}.${r}`,Ae(t,r),Ae(n,r),a+1)}};return s(e,t,n,0),i}var Le=/* @__PURE__ */new Set(["id","_id","createdAt","updatedAt","createdBy","updatedBy","_status","globalType","collection","locale","localized"]);function Ne(e,t,n={}){const r=e=>!1===t||ye(e,t),i=[];for(const[t,n]of e.entries())n.some(e=>r(e.owner))&&i.push(t);const o=e.rendered.filter(e=>void 0!==n[e.strategy]);return function(e,t){const n=new Set(e),r=[...t],i=(e,t)=>{const n=`${t}.`;for(const t of e)if(t.startsWith(n))return!0;return!1};return{covers:e=>n.has(e)||r.some(t=>t===e||e.startsWith(`${t}.`)),reachesBelow:e=>i(n,e)||i(r,e)}}(i,[...e.covers,...o].filter(e=>r(e.owner)).flatMap(e=>e.paths))}function Pe(e,t){if(void 0===t||0===t.length)return e;const n=`_${t}`;return e.endsWith(n)?e.slice(0,-n.length):e}function xe(e,t,n,r=Ne(e,n)){let i;const o=r.covers,s=r.reachesBelow;return r=>{const a=Pe(r,t);return o(r)||a!==r&&o(a)?"whole":(i??=function(e,t){const n=/* @__PURE__ */new Set;for(const[r,i]of e.entries())for(const e of i)(!1===t||ye(e.owner,t))&&void 0!==e.locale&&n.add(`${r}_${e.locale}`);return n}(e,n),i.has(r)?"whole":s(r)||a!==r&&s(a)?"below":"none")}}function Ee(e,t,n,r,i){const o=Ne(e,r,i),s=xe(e,n,r,o),a=[];for(const[e,r]of Object.entries(t)){if(Le.has(e)||"below"!==s(e))continue;const t=Pe(e,n);a.push(...$e(t,void 0,r,o))}return a}function Me(e,t,n){return"declared"===e&&void 0!==t&&void 0!==n?{previous:t,next:n}:void 0}function Oe(e,t,n,r,i,o){const s=Ne(e,r,o),a=xe(e,n,r,s),l=[];for(const e of t){if(Le.has(e))continue;const t=a(e);if("none"===t&&l.push(e),"below"!==t||void 0===i)continue;const r=Pe(e,n),{previous:o,next:u}=i;for(const{path:t}of $e(r,o[e],u[e],s))l.push(t)}return l}var Fe=/* @__PURE__ */new Set(["text","textarea","email","number","checkbox","date","select","radio","point","code","json","ui","html"]),Ue=/* @__PURE__ */new Set(["root","paragraph","text","heading","quote","list","listitem","linebreak","tab","horizontalrule","code","code-highlight","table","tablerow","tablecell","link","autolink"]),Ie={},_e=class{rawChanges=new ie;resolved=null;resolvedLocale=null;trailing=null;openUntil=0;requestAttempt=0;decide(e,t){const n=t.rawData;if(!function(e){const{cache:t,emitter:n}=e;if(t.islands.length>0)return!0;if(n.listenerCount("beforeUpdate")>0||n.listenerCount("afterUpdate")>0)return!0;for(const e of t.values()){if(je(e)||e.fieldName.includes("."))return!0;if(We(e.hrefField)||We(e.srcField)||We(e.altField))return!0}return void 0!==e.strategies.fragment&&null!==e.root.querySelector(`[${ce}]`)}(e)&&!function(e,t,n){for(const r of e.values()){if("text"!==r.fieldType||!0===r.explicitFieldType)continue;const e=ue(t,r,r.fieldName,n);if(rt(e)&&Be(e.root))return!0}return!1}(e.cache,n,t.locale))return t.forceRender&&(this.resolvedLocale=null),{merge:!1,fields:n};const{changed:r}=this.rawChanges.diff(n,Ie),i=this.resolvedLocale!==t.locale,o=this.resolved;if(null===o)return this.resolved=n,{merge:!0,fields:n};const s={...o};t.forceRender&&(this.resolvedLocale=null);let a=t.forceRender||i;for(const i of r){const r=n[i];if(Le.has(i)){s[i]=r;continue}const l=De(i,o[i],r,e.cache,t.schemaIndex);"own"!==l&&(a=!0,this.resolvedLocale=null),"keep"!==l&&(s[i]=r)}return this.resolved=s,{merge:a,fields:s}}request(e,t,n){const r=++this.requestAttempt,i=Date.now();if(i>=this.openUntil)return this.openUntil=i+t,this.dropQueued(),this.requestAttempt!==r?{leading:!0,result:Promise.resolve({status:"superseded"})}:{leading:!0,result:e.merge(n)};const o=this.trailing,s=o?.pending??function(){let e;return{promise:new Promise(t=>{e=t}),settle:e}}(),a={request:n,pending:s,timer:null};if(this.trailing=a,this.openUntil=i+t,null!==o&&null!==o.timer&&clearTimeout(o.timer),this.trailing!==a)return{leading:!1,result:s.promise};const l=setTimeout(()=>{this.flush(e,a)},t);return this.trailing===a?a.timer=l:clearTimeout(l),{leading:!1,result:s.promise}}recordMerged(e,t){this.resolved=e,this.resolvedLocale=t}resetRawChanges(){this.rawChanges.reset()}destroy(){this.requestAttempt+=1,this.openUntil=0,this.dropQueued()}dropQueued(){const e=this.trailing;this.trailing=null,null!==e&&(null!==e.timer&&clearTimeout(e.timer),e.pending.settle({status:"superseded"}))}flush(e,t){this.trailing===t&&(this.trailing=null,t.timer=null,e.merge(t.request).then(t.pending.settle))}};function De(e,t,n,r,i){return ze(n)?!ze(t)||function(e,t,n){const r=void 0===n?void 0:M(n,e);return void 0!==r&&!Fe.has(r.type)||!0===t.get(e)?.some(je)||function(e,t){const n=`${t}.`;for(const[t,r]of e.entries())if(t.startsWith(n))return!0;return!1}(t,e)}(e,r,i)?"keep":null==t?"ask":"own":"ask"}function je(e){return!Fe.has(e.fieldType)}function Be(e){const t=[e],n=/* @__PURE__ */new Set;for(let e=t.pop();void 0!==e;e=t.pop()){if("object"!=typeof e||null===e||n.has(e))continue;n.add(e);const{type:r,fields:i,children:o}=e;if(!Ue.has(r))return!0;if("internal"===i?.linkType)return!0;if(Array.isArray(o))for(const e of o)t.push(e)}return!1}function ze(e){return null===e||"object"!=typeof e&&"function"!=typeof e}function We(e){return!0===e?.includes(".")}function isInIframe(){if("undefined"==typeof window)return!1;try{return window.self!==window.top}catch{return!0}}function isInPopup(){return"undefined"!=typeof window&&null!=window.opener}function isInPreviewContext(){return isInIframe()||isInPopup()}function isDevMode(){const e=function(){if("undefined"==typeof process)return;const e=process.env.NODE_ENV;return"string"==typeof e?e:void 0}();if(void 0!==e)return"production"!==e;if("undefined"!=typeof window){const e=window.location.hostname;return"localhost"===e||"127.0.0.1"===e}return!1}var He=class{negotiation=negotiateProtocol(void 0);observed=/* @__PURE__ */new Set;observe(e,t,n){const r=e.filter(e=>!this.observed.has(e));if(0!==r.length){for(const e of r)this.observed.add(e);this.negotiation=negotiateProtocol(this.negotiation.theirs,this.observed),t("protocol",`observed=${r.join(",")}`),"undefined"!=typeof __LEAN_BUILD__&&__LEAN_BUILD__||!r.includes("schema-json")||!isDevMode()||n("[payload-live-preview] This admin sends fieldSchemaJSON, which only Payload 2 does. Every 2.x release of this package supports Payload 2; 3.0 supports Payload 3 and 4.")}}applyVersion(e,t){const n=this.negotiation;if(n.theirs===e)return;const r=negotiateProtocol(e,this.observed);this.negotiation=r,r.negotiated!==n.negotiated&&t("protocol","ours=4",`theirs=${e}`,`negotiated=${r.negotiated}`)}};function qe(e,t){const n=t.globalSlug??t.collectionSlug;if("string"!=typeof n||e.entitySlug!==n)return!0;const r=be(e),i=be(t.data??{});return void 0!==r&&void 0!==i&&r!==i}function Ve(e){return null!==e&&e.forceRender&&!e.completed}var Ge=class{lastIdentity=void 0;inspect(e){const t=e.externallyUpdatedRelationship;if("object"!=typeof t||null===t)return null;const n=JSON.stringify([t.entitySlug,be(t),t.updatedAt]);return{identity:n,edit:n!==this.lastIdentity&&qe(t,e)?t:null}}commit(e){const t=e.identity!==this.lastIdentity;return this.lastIdentity=e.identity,t?e.edit:null}};function Je(e){try{return!0===e.matchMedia?.("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var Ke=class{#e;reveal(e,t,n){return e===this.#e?"skipped-same":(this.#e=e,function(e,t){for(let t;t=e.closest?.("details:not([open])");)t.setAttribute("open","");return function(e,t){const n=e.getBoundingClientRect(),r=n.bottom>0&&n.top<t.innerHeight,i=n.right>0&&n.left<t.innerWidth;return r&&i}(e,t)?"already-visible":(e.scrollIntoView({behavior:Je(t)?"auto":"smooth",block:"center"}),"revealed")}(t,n))}reset(){this.#e=void 0}};function Xe(e,t){const n=t.element.ownerDocument.defaultView;return null===n?"no-element":e.reveal(`${t.owner??""} ${t.fieldName}`,t.element,n)}var Qe=class{seen=/* @__PURE__ */new Map;note(e,t,n){const r=J(n);if(void 0===r)return;const i=`${t.owner??""}\0${t.locale??""}\0${t.fieldName}`,o=this.seen.get(i);void 0!==o?o!==r&&(e.revealIdentities.push([i,r]),e.revealTarget??=t):this.seen.set(i,r)}commit(e){for(const[t,n]of e.revealIdentities)this.seen.set(t,n);e.revealIdentities=[];const t=e.revealTarget;return e.revealTarget=void 0,t}},Ze=()=>{},Ye=class{host={outstanding:()=>!1,report:Ze,failed:Ze};entry=null;ended;begin(e,t){const n=this.entry,r=null===n?void 0:this.view(n);null!==n&&(n.key=void 0),this.ended=void 0,this.entry={key:e,revision:t,shortfalls:[],seen:/* @__PURE__ */new Set,deferred:0,awaiting:0,reported:void 0,queued:!1},null!==n&&void 0!==r&&this.publish(n,"pending"===r.state?{...r,state:"superseded"}:r)}end(){const e=this.entry;if(null!==e){this.entry=null;try{this.ended=this.view(e)}finally{e.key=void 0}}}snapshot(){return null!==this.entry?this.view(this.entry):void 0===this.ended?void 0:{...this.ended,shortfalls:[...this.ended.shortfalls]}}shortfall(e,t){const n=this.entry;if(n?.key!==e)return;const r=JSON.stringify(t);n.seen.has(r)||(n.seen.add(r),n.shortfalls.push(t),this.requestSettle(n.key))}deferred(e,t){this.entry?.key===e&&(this.entry.deferred=t)}handIsland(e){const t=this.entry;if(t?.key!==e)return Ze;t.awaiting+=1;let n=!1;return()=>{n||this.entry!==t||(n=!0,t.awaiting-=1,this.settle(t))}}requestSettle(e){const t=this.entry;t?.key!==e||t.queued||(t.queued=!0,queueMicrotask(()=>{t.queued=!1;try{this.entry===t&&this.settle(t)}catch(e){this.host.failed(e)}}))}settle(e){const t=this.view(e);"pending"!==t.state&&this.publish(e,t)}publish(e,t){e.reported!==t.state&&(e.reported=t.state,this.host.report(t))}view(e){const t=void 0!==e.key&&this.host.outstanding(e.key)?"pending":e.shortfalls.length>0?"partial":e.awaiting>0?"unconfirmed":"current";return{revision:e.revision,state:t,shortfalls:[...e.shortfalls],deferred:e.deferred,awaitingIslands:e.awaiting}}};function et(e){const t=e.getAttribute(fe);return{kind:"fragment",id:e.getAttribute(ce)??"",key:null===t||0===t.length?void 0:t,code:"LP0801"}}var tt=class{started=!1;suspended=!1;deferredStart=null;hydration="idle";activeUpdate=null;locale=void 0;schema=void 0;schemaIndex=void 0;updateCount=0;supersededCount=0;completedCount=0;skippedUnchangedCount=0;lastFlush=null;absentFields=/* @__PURE__ */new Set;warnedOrphanFields=/* @__PURE__ */new Set;warnedStrategy=/* @__PURE__ */new WeakSet;warnedUnattributableMessage=!1;warnedVisibilityGate=!1;warnedFragmentFallback=!1;warnedIslandStart=!1;warnedEscalationUnavailable=!1;warnedProtocolShape=!1;reportedUnfaithful=/* @__PURE__ */new WeakMap;checkedServerFormat=/* @__PURE__ */new WeakSet;rowsOfBinding=/* @__PURE__ */new WeakMap;unfaithfulPatches=[];unfaithfulCount=0;escalatedCount=0;unfaithfulFields=/* @__PURE__ */new Set;autoBindSearchMs=void 0;autoBindGuesses=null;warnedForeignSource=!1;lastAppliedIdentity=/* @__PURE__ */new WeakMap;navigationReplayPending=!1;navigationBindingReplay=!1;revealLedger=new Qe;display=new Ye;fragmentStats={rendered:0,failed:0,superseded:0};routeStats={refreshes:0,partial:0,failed:0,refused:0,loopStopped:0};fragmentControllers=/* @__PURE__ */new Map;routeController=null;routeRetry=null;routeRefreshOwed=!1;routeAwaitsSave=!1;fragmentsOwed=/* @__PURE__ */new Set;readyTimers=[];revealer=new Ke;changes=new ie;merges=new _e;protocol=new He;relationships=new Ge;isRunning(){return this.started}isCurrent(e){return this.started&&this.activeUpdate===e}complete(e){this.display.requestSettle(e),e.completed||(e.completed=!0,e.countsAsUpdate&&(this.completedCount+=1))}forgetOwedWork(){this.routeRefreshOwed=!1,this.routeAwaitsSave=!1,this.fragmentsOwed.clear()}supersedeStrategies(){null!==this.routeRetry&&(clearTimeout(this.routeRetry),this.routeRetry=null,this.routeRefreshOwed=!0);for(const[e,t]of this.fragmentControllers){for(const e of t)this.fragmentsOwed.add(e);e.abort()}this.fragmentControllers.clear()}abortStrategies(){this.supersedeStrategies();const e=this.routeController;this.routeController=null,e?.abort()}},nt=class{constructor(e,t){this.deps=e,this.state=t,this.instanceContext=P({renderRichText:e.renderRichText,internalLinkPattern:e.internalLinkPattern,sanitizerPolicy:e.sanitizerPolicy,serverURL:e.serverURL,reportUnfaithful:(n,r)=>{X(e,t,n,r,this.writing)}})}deps;state;writing;instanceContext;apply(e){const{deps:t,state:n}=this,r=n.activeUpdate;if(null===r||void 0===e.revision||!y(r.revision,e.revision)||!n.isCurrent(r))return!1;const{target:i,value:o}=e,s=void 0!==r.schemaIndex?M(r.schemaIndex,i.fieldName):void 0;let a,l=function(e,t){if(e.explicitFieldType)return e.fieldType;if(void 0!==t){const e=function(e){if(Object.prototype.hasOwnProperty.call(_,e))return _[e]}(t);if(void 0!==e)return e}return e.fieldType}(i,s?.type);"text"===l&&!0!==i.explicitFieldType&&rt(o)&&(l="richText");try{a=t.resolveRenderer(l,i)}catch(e){return this.fail(r,i.fieldName,e)}if(!n.isCurrent(r))return!1;const u=t.emitter.listenerCount("elementUpdate")>0,d=u?"INPUT"===(c=i.element).tagName||"TEXTAREA"===c.tagName?c.value:"IMG"===c.tagName?c.src:c.textContent:void 0;var c;if(!n.isCurrent(r))return!1;const f={allFields:e.allFields,locale:i.locale??r.locale,schema:s,...this.instanceContext};!0===i.hidesWhenEmpty&&i.element.toggleAttribute("hidden",function(e){return null==e||("string"==typeof e?0===e.trim().length:Array.isArray(e)&&0===e.length||it(e))}(o));try{if(void 0!==i.targetAttribute){if("blocked"===function(e,t,n){const r=t.toLowerCase().trim();if(0===r.length)return"blocked";if(!G(r))return"blocked";if(null==n)return e.removeAttribute(r),"applied";if("string"!=typeof n&&"number"!=typeof n&&"boolean"!=typeof n)return"blocked";const i=String(n);return V.has(r)&&!isSafeUrl(i)?"blocked":(e.setAttribute(r,i),"applied")}(i.element,i.targetAttribute,o))return t.warn(`[live-preview] LP0401: refused to write "${i.fieldName}" into attribute "${i.targetAttribute}"`),n.display.shortfall(r,{kind:"write",field:i.fieldName,code:"LP0401"}),!1}else{if(void 0===a)return t.log("no renderer for",l),X(t,n,i,`has no renderer for "${l}"`,o),!1;{const e=function(e,t,n,r){if("ignore"===e.onUnfaithfulPatch)return;if(void 0!==n.format||!Z.has(r))return;if(Y(r)&&n.element.matches("select,input"))return;if(t.checkedServerFormat.has(n.element))return;t.checkedServerFormat.add(n.element);const i=ee(n.element);return i.trim().length>0?i:void 0}(t,n,i,l);this.writing=o;const r=function(e,t,n,r){return e.render(t,n,r)}(a,i,o,f);if(!1===r&&function(e){return ne.has(e.render)}(a))return X(t,n,i,`is a value ${a.name} cannot render`,o),!1;void 0!==e&&function(e,t,n,r){const i=ee(t.element);i!==n&&e.warn(`[live-preview] LP0412: "${t.fieldName}" showed ${te(n)}, the patch wrote ${te(i)} — `+(Y(r)?'Payload sends the value of an option, not its label. Render the label in a data-payload-fragment boundary, or bind it with data-payload-strategy="route".':"either an edit that arrived before the preview connected, or a template that formats this value differently. Set data-payload-format to match it."))}(t,i,e,l)}}}catch(e){return this.fail(r,i.fieldName,e)}if(!n.isCurrent(r))return!1;u&&t.emitter.emitWhile("elementUpdate",{element:i.element,fieldName:i.fieldName,previousValue:d,nextValue:o,revision:r.revision.revision,receivedAt:r.receivedAt,source:"patch"},()=>n.isCurrent(r));const h=n.isCurrent(r);return h&&(void 0!==e.valueIdentity?n.lastAppliedIdentity.set(i.element,e.valueIdentity):n.lastAppliedIdentity.delete(i.element)),h}fail(e,t,n){if(!this.state.isCurrent(e))return!1;this.state.display.shortfall(e,{kind:"write",field:t,code:"LP0603"});const r=n instanceof Error?n:new Error(String(n));return this.deps.emitter.emitWhile("error",{error:r,context:"renderer",code:"LP0603"},()=>this.state.isCurrent(e)),!1}};function rt(e){if("object"!=typeof e||null===e||!("root"in e))return!1;const t=e.root;return"object"==typeof t&&null!==t&&Array.isArray(t.children)}function it(e){return!!rt(e)&&e.root.children.every(e=>{const{type:t,children:n}=e??{};return"paragraph"===t&&(!Array.isArray(n)||0===n.length)})}function ot(e){if(null==e)return[];const t=/* @__PURE__ */new Set,n=[];for(const r of e.split(/[\s,]+/)){const e=r.trim();0===e.length||t.has(e)||(t.add(e),n.push(e))}return n}function st(...e){const t=/* @__PURE__ */new Map;for(const n of e)for(const[e,r]of Object.entries(n)){let n=t.get(e);void 0===n&&(n=/* @__PURE__ */new Set,t.set(e,n));for(const e of r)n.add(e)}const n={};for(const[e,r]of t)n[e]=[...r];return n}function at(e,t){const n={};for(const r of t)r!==e&&(n[r]=[e]);return n}var lt="payload-live-preview:update",ut="data-payload-island",dt=`astro-island, [${ut}]`,ct="data-payload-owned";function ft(e){if(e.tagName.toLowerCase().includes("-")&&!e.hasAttribute("data-payload-morph"))return!0;if(pt(e)||e.hasAttribute(ct))return!0;const t=e.getAttribute("contenteditable");return null!==t&&"false"!==t}function ht(e){return"patch"===e.getAttribute(ut)}function pt(e){return function(e){return"astro-island"===e.tagName.toLowerCase()||e.hasAttribute(ut)}(e)&&!ht(e)}function isInsideIsland(e){let t=e;for(;null!==t;){if(pt(t))return!0;t=t.parentElement}return!1}function gt(e){return"astro-island"===e.tagName.toLowerCase()&&e.hasAttribute("ssr")}var mt=["component-url","component-export","renderer-url","client","opts","before-hydration-url"],vt=/* @__PURE__ */new WeakMap,yt=/* @__PURE__ */new WeakSet;function bt(e){return"astro-island"===e.tagName.toLowerCase()}function wt(e){let t="";for(const n of e.querySelectorAll("astro-slot, template[data-astro-template]"))n.parentElement?.closest("astro-island")===e&&(t+=`${n.getAttribute("name")??n.getAttribute("data-astro-template")??""}\0${n.innerHTML}\0`);return t}function St(e,t){if(!bt(e)||!bt(t))return!0;const n=wt(t);if(!mt.every(n=>e.getAttribute(n)===t.getAttribute(n))||(vt.get(e)??wt(e))!==n||e.getAttribute("props")!==t.getAttribute("props")&&!function(e){const t=e.ownerDocument.defaultView?.customElements.get("astro-island");return void 0!==t&&e instanceof t&&Array.isArray(t.observedAttributes)&&t.observedAttributes.includes("props")}(e))return vt.set(t,n),!1;vt.set(e,n);const r=t.getAttribute("props");return r!==e.getAttribute("props")&&(e.setAttribute("ssr",""),null===r?e.removeAttribute("props"):e.setAttribute("props",r)),!0}function At(e){return Array.from(e.querySelectorAll("astro-island"))}function kt(e){const t=e.ownerDocument.defaultView;if(void 0===t?.customElements.get("astro-island"))return"element";const n=e.getAttribute("client"),r=Reflect.get(t,"Astro");return null===n||"object"!=typeof r||null===r||void 0===Reflect.get(r,n)?"directive":void 0}var Tt="data-payload-field",Ct="data-payload-type",Rt="data-payload-attribute",$t="data-payload-href",Lt="data-payload-src",Nt="data-payload-alt",Pt="data-payload-array-template",xt="data-payload-array-separator",Et="data-payload-locale",Mt="data-payload-format",Ot="data-payload-richtext",Ft="data-payload-html",Ut="data-payload-array",It="data-payload-structural",_t="data-payload-owner",Dt="data-payload-depends",jt="data-payload-strategy",Bt="data-payload-boundary",zt="data-payload-guessed",Wt="data-payload-covers",Ht=[Tt,Ct,Rt,$t,Lt,Nt,Pt,xt,Et,Mt,Ot,Ft,Ut,It,_t,Dt,jt,Bt,"type"],qt=`[${Tt}]`,Vt=`[${_t}]`,Gt=`[${ce}], [${jt}="route"]`;function Jt(e){const t=e.closest(Vt)?.getAttribute(_t);return null==t||0===t.length?void 0:t}var Kt=/^[a-z][a-z0-9-]*:[a-z][a-z0-9-]*$/i,Xt=/* @__PURE__ */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"]);function Qt(e){return Xt.has(e)||Kt.test(e)}function Zt(e,t){return e.fieldName===t.fieldName&&e.locale===t.locale&&e.owner===t.owner&&e.strategyKind===t.strategyKind&&e.fragmentBoundary===t.fragmentBoundary}var Yt=class{entriesByField=/* @__PURE__ */new Map;entryByElement=/* @__PURE__ */new WeakMap;filter;count=0;dependencies=null;islandRoots=[];ownersByIsland=/* @__PURE__ */new Map;navigationRoots=[];coverDeclarations=[];renderedDeclarations=[];constructor(e={}){this.filter=e.filter??tn}dependencyMap(){if(null!==this.dependencies)return this.dependencies;const e=[];for(const t of this.values())void 0!==t.dependsOn&&e.push(at(t.fieldName,t.dependsOn));return this.dependencies=st(...e),this.dependencies}get islands(){return this.islandRoots}get islandOwners(){return this.ownersByIsland}get covers(){return this.coverDeclarations}get rendered(){return this.renderedDeclarations}get navigationReplayRoots(){return this.navigationRoots}buildFromRoot(e){const t=performance.now();this.clear();let n=0;for(const t of e.querySelectorAll(qt))void 0!==this.add(t)&&(n+=1);return this.islandRoots=function(e){const t=[];for(const n of e.querySelectorAll(dt))ht(n)||t.push(n);return t}(e),this.ownersByIsland=new Map(this.islandRoots.map(e=>[e,Jt(e)])),this.navigationRoots=[...e.querySelectorAll(Gt)].filter(e=>this.filter(e)&&(e.hasAttribute(ce)||0===(e.getAttribute(Tt)??"").length)),this.coverDeclarations=[...e.querySelectorAll(`[${Wt}]`)].filter(e=>this.filter(e)).map(e=>({paths:ot(e.getAttribute(Wt)),owner:Jt(e)})),this.renderedDeclarations=[...e.querySelectorAll(`[${Dt}]`)].filter(e=>this.filter(e)).flatMap(e=>{const t=function(e){if((e.getAttribute(ce)??"").length>0)return"fragment";const t=e.getAttribute(jt);return null!==t?"route"===t?"route":void 0:e.hasAttribute(Tt)&&null!==e.closest("head")?"route":void 0}(e);return void 0===t?[]:[{strategy:t,paths:ot(e.getAttribute(Dt)),owner:Jt(e)}]}),{elementCount:n,fieldCount:this.entriesByField.size,durationMs:performance.now()-t}}add(e){const t=this.filter(e)?this.resolveBinding(e):void 0,n=this.entryByElement.get(e);if(this.dependencies=null,void 0!==t)return void 0!==n&&this.replaceEntry(n,t)?(this.entryByElement.set(e,t),t):(void 0!==n&&this.removeEntry(e,n),this.append(t),this.entryByElement.set(e,t),t);void 0!==n&&this.removeEntry(e,n)}remove(e){const 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(const e of this.entriesByField.values())yield*e}has(e){return this.entryByElement.has(e)}clear(){this.entriesByField.clear(),this.entryByElement=/* @__PURE__ */new WeakMap,this.count=0,this.dependencies=null,this.islandRoots=[],this.ownersByIsland=/* @__PURE__ */new Map,this.navigationRoots=[],this.coverDeclarations=[],this.renderedDeclarations=[]}replaceEntry(e,t){if(e.fieldName!==t.fieldName)return!1;const n=this.entriesByField.get(e.fieldName),r=void 0===n?-1:n.indexOf(e);return!(void 0===n||r<0||(n[r]=t,0))}removeEntry(e,t){this.entryByElement.delete(e);const n=this.entriesByField.get(t.fieldName),r=void 0===n?-1:n.indexOf(t);return!(void 0===n||r<0||(n.splice(r,1),0===n.length&&this.entriesByField.delete(t.fieldName),this.count-=1,0))}append(e){const t=this.entriesByField.get(e.fieldName);t?t.push(e):this.entriesByField.set(e.fieldName,[e]),this.count+=1}resolveBinding(e){const t=e.getAttribute(Tt);if(null===t||0===t.length)return;const n=e.getAttribute(Ct),r=e.getAttribute(Rt),i=e.getAttribute($t),o=e.getAttribute(Lt),s=e.getAttribute(Nt),a=e.getAttribute(Pt),l=e.getAttribute(xt),u=e.getAttribute(Et),d=e.getAttribute(Mt),c=Jt(e),f=ot(e.getAttribute(Dt)),h=e.getAttribute(jt),p=e.getAttribute(zt),g=he(e);return{element:e,fieldName:t,fieldType:en(e),explicitFieldType:null!==n&&Qt(n),strategyKind:ge(e)??"unknown",...null!==g?{fragmentBoundary:g}:{},...null!==r&&r.length>0?{targetAttribute:r}:{},...null!==i&&i.length>0?{hrefField:i}:{},...null!==o&&o.length>0?{srcField:o}:{},...null!==s&&s.length>0?{altField:s}:{},...null!==a?{arrayTemplate:a}:{},...null!==l?{arraySeparator:l}:{},...null!==u&&u.length>0?{locale:u}:{},...null!==d&&d.length>0?{format:d}:{},...void 0!==c?{owner:c}:{},...f.length>0?{dependsOn:f}:{},...null!==h&&h.length>0?{strategy:h}:{},...e.hasAttribute(Bt)?{hidesWhenEmpty:!0}:{},...null!==p?{guessed:p}:{}}}};function en(e){const t=e.getAttribute(Ct);if(null!==t&&Qt(t))return t;if(e.hasAttribute(Ot))return"richText";if(e.hasAttribute(Ft))return"html";if(e.hasAttribute(It))return"structural-array";if(e.hasAttribute(Ut))return"array";if("IMG"===e.tagName)return"image";if("A"===e.tagName)return"url";if("TIME"===e.tagName)return"date";if("INPUT"===e.tagName){const t=e.type;if("checkbox"===t)return"checkbox";if("number"===t)return"number";if("date"===t||"datetime-local"===t)return"date"}return"text"}function tn(){return!0}var nn=1e4,rn=1048576,on=/* @__PURE__ */new Set(["__proto__","constructor","prototype"]);function sn(){throw new Error("invalid or oversized legacy population")}function an(e){for(let t=0;t<e.length;t+=1){const n=e.charCodeAt(t);if(n<=31||127===n)return!0}return!1}function ln(e,t){if("string"!=typeof e||0===e.length||e.length>t||"."===e||".."===e)return!1;if(e.includes("/")||e.includes("\\")||an(e))return!1;try{return encodeURIComponent(e),!0}catch{return!1}}function un(e){return ln(e,128)&&!/[?#%]/u.test(e)&&!on.has(e)}function dn(e){return Number.isFinite(e)?String(e):ln(e,512)?e:sn()}function cn(e,t){return Object.hasOwn(e,t)?Reflect.get(e,t):void 0}function fn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0,enumerable:!0})}function hn(e){let t=e.length;for(;t>0&&47===e.charCodeAt(t-1);)t-=1;return e.slice(0,t)}function pn(e){const t=/* @__PURE__ */new WeakSet;let n=0,r=0;return function e(i,o){if(++n>nn||o>64)return sn();if("string"==typeof i)return r+=i.length,r>rn&&sn(),i;if(null==i||"boolean"==typeof i)return i;if("number"==typeof i)return Number.isFinite(i)?i:sn();if(!Array.isArray(i)&&!h(i))return sn();if(Array.isArray(i)){i.length>nn&&sn();for(let e=0;e<i.length;e+=1)Object.hasOwn(i,e)||sn()}if(t.has(i))return sn();t.add(i);const s=Array.isArray(i)?[]:{};for(const t of Object.keys(i))fn(s,t,e(Reflect.get(i,t),o+1));return t.delete(i),s}(e,0)}function gn(e,t,n,r,i,o){if(!Number.isSafeInteger(i)||i<0||i>64)return sn();void 0!==o&&("string"!=typeof o||o.length>128||an(o))&&sn();const s=pn(e);if(!h(s))return sn();const a=/* @__PURE__ */new Map,l=/* @__PURE__ */new Set;let u=0;const d=/* @__PURE__ */new WeakSet,c=e=>{(++u>nn||e>64)&&sn()};function f(e,t,n,r){if(null==r||""===r)return;const o=h(r)?cn(r,"id"):r,s=dn(o);if(0===i)return void fn(e,t,o);const u=JSON.stringify([n,s]);l.add(u),l.size>1e3&&sn();const d=a.get(n)??[];d.push({owner:e,key:t,id:s}),a.set(n,d)}function p(e,t,n){void 0!==n.hasMany&&"boolean"!=typeof n.hasMany&&sn();const r=n.relationTo,i=cn(e,t);if(Array.isArray(r)){0===r.length&&sn();const e=h(i)?cn(i,"relationTo"):void 0;let t;for(const n of r)c(0),un(n)||sn(),n===e&&(t=n);if(null==i||""===i)return;h(i)&&void 0!==t||sn(),f(i,"value",t,cn(i,"value"))}else un(r)||sn(),f(e,t,r,i)}function g(e,t){if(c(t),Array.isArray(e)||h(e)){if(h(e)&&Object.hasOwn(e,"relationTo")&&Object.hasOwn(e,"value")){const t=cn(e,"relationTo");return un(t)||sn(),void f(e,"value",t,cn(e,"value"))}for(const n of Object.keys(e))g(Reflect.get(e,n),t+1)}}!function e(t,n,r){c(r),d.has(t)&&sn(),d.add(t);for(const i of t){c(r),h(i)&&ln(i.name,512)&&!on.has(i.name)||sn();const t=cn(n,i.name);if("relationship"===i.type||"upload"===i.type)if(i.hasMany)if(null==t||Array.isArray(t)||sn(),Array.isArray(t))for(let e=0;e<t.length;e+=1)p(t,e,i);else p(n,i.name,i);else p(n,i.name,i);else if("group"===i.type||"tabs"===i.type)null==t||h(t)||sn(),h(t)&&i.fields&&e(i.fields,t,r+1);else if("row"===i.type||"collapsible"===i.type)i.fields&&e(i.fields,n,r+1);else if("array"===i.type||"blocks"===i.type){if(0===t?fn(n,i.name,[]):null==t||Array.isArray(t)||sn(),Array.isArray(t))for(const n of t)if(h(n)||sn(),"array"===i.type&&i.fields)e(i.fields,n,r+1);else if("blocks"===i.type){const t=cn(n,"blockType"),o=i.blocks?.find(e=>(c(r),e.slug===t));void 0===o&&sn(),e(o.fields,n,r+1)}}else"richText"===i.type&&g(t,r+1)}d.delete(t)}(t,s,0),a.size>25&&sn();const m=[];if(0===a.size)return{doc:s,requests:m};const v=new URL(n);(!["http:","https:"].includes(v.protocol)||v.username||v.password||v.search||v.hash)&&sn(),(!r.startsWith("/")||r.includes("\\")||/[%?#]/u.test(r)||an(r))&&sn(),r.split("/").some(e=>"."===e||".."===e)&&sn();const y=`${hn(n)}${hn(r)}/`;for(const[e,t]of a){const n=[...new Set(t.map(e=>e.id))];let r=0;for(;r<n.length;){const s=n[r];void 0===s&&sn();const a=s.includes(","),l=[];let u="";for(;r<n.length&&l.length<20;){const t=n[r];if(void 0===t||l.length>0&&(a||t.includes(",")))break;const s=[...l,t],d=new URLSearchParams({depth:String(i),limit:String(s.length)});void 0!==o&&d.set("locale",o),d.set(a?"where[id][equals]":"where[id][in]",a?t:s.join(","));const c=`${y}${encodeURIComponent(e)}?${d}`;if(c.length>8192){0===l.length&&sn();break}new URL(c).origin!==v.origin&&sn(),l.push(t),r+=1,u=c}(0===l.length||m.length>=64)&&sn();const d=new Set(l);m.push({url:u,ids:d,slots:t.filter(e=>d.has(e.id))})}}return{doc:s,requests:m}}async function mn(e,t,n){let r,i=!1,o=!1;const s=/* @__PURE__ */Symbol();let a;const l=new Promise(e=>{a=()=>{e(s)}}),u=()=>{n()&&!t.aborted||sn()},d=()=>{if(void 0!==r&&!i){i=!0;try{Promise.resolve(r.cancel()).catch(()=>{})}catch{}}},c=()=>{a?.(),d()};t.addEventListener("abort",c,{once:!0});try{u();const t=e.body??null;if(u(),null===t){const t=e.json.bind(e);u();const n=await Promise.race([Promise.resolve().then(()=>(u(),t())),l]);return u(),n===s&&sn(),n}const n=t.getReader.bind(t);u();const i=n();r=i,u();const a=[];let d=0,c=0;for(;;){const e=Promise.resolve().then(()=>{u();const e=i.read.bind(i);return u(),e()}),t=await Promise.race([e,l]);if(u(),t===s&&sn(),t.done)break;d+=t.value.byteLength,(++c>1e4||d>rn)&&sn(),a.push(t.value)}o=!0;const f=new Uint8Array(d);let h=0;for(const e of a)f.set(e,h),h+=e.byteLength;try{return JSON.parse((new TextDecoder).decode(f))}catch{return sn()}}finally{t.removeEventListener("abort",c),o||d();try{r?.releaseLock()}catch{}}}function vn(e,t){const n=pn(t);h(n)||sn();const r=cn(n,"docs");(!Array.isArray(r)||r.length>20)&&sn();const i=/* @__PURE__ */new Map;for(const t of r){h(t)||sn();const n=dn(cn(t,"id"));e.ids.has(n)&&!i.has(n)||sn(),i.set(n,t)}i.size!==e.ids.size&&sn();for(const t of e.slots)fn(t.owner,t.key,i.get(t.id))}function yn(e,t){return e.length>0&&e.length<=t&&"."!==e&&".."!==e&&!e.includes("/")&&!e.includes("\\")&&!function(e){for(const t of e){const e=t.codePointAt(0)??0;if(e<=31||127===e)return!0}return!1}(e)}function bn(e){return yn(e,128)&&!e.includes("?")&&!e.includes("#")}function wn(e){return"number"==typeof e?Number.isFinite(e):"string"==typeof e&&yn(e,512)}var Sn=new Error,An=class{serverURL;apiRoute;depth;fetchFn;log;timeoutMs;inflight=null;attempt=0;destroyDepth=0;constructor(e){this.serverURL=function(e){let t=e.length;for(;e.endsWith("/",t);)t-=1;return e.slice(0,t)}(e.serverURL);const t=e.apiRoute??"/api";this.apiRoute=t.startsWith("/")?t:`/${t}`,this.depth=e.depth??1,this.fetchFn=e.fetchFn,this.log=w(e.log??S);const n=e.timeoutMs??0;this.timeoutMs=n>0&&n<Number.POSITIVE_INFINITY?n:void 0}canMerge(e){try{const t=e.schema;return void 0!==t?(gn(e.data,t,this.serverURL,this.apiRoute,this.depth,e.locale),!0):null!==this.endpointOf(e)}catch{return!1}}endpointOf(e){try{const t=e.globalSlug;if(t)return bn(t)?{path:`globals/${encodeURIComponent(t)}`,field:"globalType",value:t}:null;const n=e.collectionSlug??"",r=e.data.id;return bn(n)&&wn(r)?{path:`${encodeURIComponent(n)}/${encodeURIComponent(String(r))}`,field:"id",value:String(r)}:null}catch{return null}}async merge(e){if(this.destroyDepth>0)return{status:"superseded"};const t=this.attempt+=1,n=this.inflight;this.inflight=null;let r=null,i=!1;const o=()=>this.attempt!==t,s=this.timeoutMs;let a,l,u=!1;const d=(e,t)=>void 0===s?e:(void 0===l&&(l=new Promise((e,n)=>{a=setTimeout(()=>{u=!0,t.abort(),n(Sn)},s)}),l.catch(()=>{})),Promise.race([e,l]));try{if(n?.abort(),o())return{status:"superseded"};const t=e.schema;if(i=void 0!==t,void 0!==t){const n=gn(e.data,t,this.serverURL,this.apiRoute,this.depth,e.locale);if(o())return{status:"superseded"};if(0===n.requests.length)return{status:"merged",doc:n.doc};const i=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(o())return{status:"superseded"};if(void 0===i)return{status:"unavailable"};r=new AbortController,this.inflight=r;for(const e of n.requests){const t=await d(i(e.url,{method:"GET",credentials:"include",redirect:"error",signal:r.signal}),r);if(o())return{status:"superseded"};const n=t.ok;if(o())return{status:"superseded"};if(!n){const e=t.status;return o()?{status:"superseded"}:(r.abort(),o()?{status:"superseded"}:(this.log("merge HTTP",e),o()?{status:"superseded"}:{status:"unavailable"}))}const s=await d(mn(t,r.signal,()=>!o()),r);if(o())return{status:"superseded"};if(vn(e,s),o())return{status:"superseded"}}return{status:"merged",doc:n.doc}}const s=this.endpointOf(e);if(o())return{status:"superseded"};if(null===s)return{status:"unavailable"};const a=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(o())return{status:"superseded"};if(void 0===a)return{status:"unavailable"};const l=JSON.stringify({data:e.data,depth:this.depth,flattenLocales:!1,locale:e.locale});if(o())return{status:"superseded"};r=new AbortController,this.inflight=r;const u=`${this.serverURL}${this.apiRoute}/${s.path}`,c=await d(a(u,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","X-Payload-HTTP-Method-Override":"GET"},body:l,signal:r.signal}),r);if(o())return{status:"superseded"};const f=c.ok;if(o())return{status:"superseded"};if(!f){const e=c.status;return o()?{status:"superseded"}:(this.log("merge HTTP",e,u),o()?{status:"superseded"}:{status:"unavailable"})}const h=c.json.bind(c);if(o())return{status:"superseded"};const p=await d(h(),r);if(o())return{status:"superseded"};if(null===p||"object"!=typeof p||Array.isArray(p))return this.log("merge invalid",u),o()?{status:"superseded"}:{status:"unavailable"};const g=p,m=g[s.field],v=Object.hasOwn(g,s.field)&&("id"===s.field?!wn(m)||String(m)!==s.value:m!==s.value);return o()?{status:"superseded"}:v?(this.log("merge invalid",u),o()?{status:"superseded"}:{status:"unavailable"}):{status:"merged",doc:g}}catch(e){return o()?{status:"superseded"}:u?(this.log("merge timeout",s),{status:"unavailable"}):i&&(r?.abort(),o())?{status:"superseded"}:(this.log("merge exception",i?new Error("legacy population could not be resolved"):e),o()?{status:"superseded"}:{status:"unavailable"})}finally{clearTimeout(a),this.inflight===r&&(this.inflight=null)}}destroy(){this.attempt+=1;const e=this.inflight;this.inflight=null,this.destroyDepth+=1;try{e?.abort()}finally{this.destroyDepth-=1}}},kn={name:"payload-2",fieldTyping:"schema",populatesRelationships:"admin",documentEvents:!1},Tn={name:"payload-3",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!0},Cn={name:"unknown",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!1};function detectProtocolProfile(e){return e.has("schema-json")?kn:e.has("document-events")||e.has("relationship-events")?Tn:Cn}var Rn="ssr",$n=[Tt,_t,Wt,Dt],Ln=`[${Tt}], [${Wt}], ${dt}, ${Gt}`,Nn=class{callbacks;debounceMs;rootMargin;visible=/* @__PURE__ */new Set;mutation=null;intersection=null;debounceTimer=null;generation=0;constructor(e,t={}){this.callbacks=e,this.debounceMs=t.mutationDebounceMs??100,this.rootMargin=t.intersectionRootMargin??"200px"}start(e){const t=this.generation;this.stop();const n=t+1;if(this.generation!==n)return;let r=null,i=null;try{r=new MutationObserver(e=>{this.handleMutations(e,n)}),i=new IntersectionObserver(e=>{this.handleIntersection(e,n)},{rootMargin:this.rootMargin,threshold:0}),r.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...Ht,Wt,ut,Rn]})}catch(e){throw r?.disconnect(),i?.disconnect(),e}if(this.generation!==n)return r.disconnect(),void i.disconnect();this.mutation=r,this.intersection=i}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;const e=this.debounceTimer,t=this.mutation,n=this.intersection;this.debounceTimer=null,this.mutation=null,this.intersection=null,this.visible.clear(),null!==e&&clearTimeout(e);try{t?.disconnect()}finally{n?.disconnect()}}handleMutations(e,t){if(!this.isCurrentGeneration(t))return;for(const n of e){const e=Pn(n);if(null!==e&&(this.callbacks.onIslandHydrated?.(e),!this.isCurrentGeneration(t)))return}if(!function(e){for(const t of e){if("attributes"===t.type&&t.attributeName===ut)return!0;if("attributes"===t.type&&null!==t.attributeName){if($n.includes(t.attributeName))return!0;if(Ht.includes(t.attributeName)&&1===t.target.nodeType&&t.target.hasAttribute(Tt))return!0}for(const e of t.addedNodes)if(xn(e))return!0;for(const e of t.removedNodes)if(xn(e))return!0}return!1}(e))return;null!==this.debounceTimer&&clearTimeout(this.debounceTimer);const n=setTimeout(()=>{this.isCurrentGeneration(t)&&this.debounceTimer===n&&(this.debounceTimer=null,this.callbacks.onStructuralChange())},this.debounceMs);this.debounceTimer=n}handleIntersection(e,t){for(const n of e){if(!this.isCurrentGeneration(t))return;const{target:e}=n;if(n.isIntersecting){if(this.visible.has(e))continue;this.visible.add(e),this.callbacks.onVisibilityChange(e,!0)}else this.visible.has(e)&&(this.visible.delete(e),this.callbacks.onVisibilityChange(e,!1))}}isCurrentGeneration(e){return this.generation===e&&null!==this.intersection}};function Pn(e){if("attributes"!==e.type||e.attributeName!==Rn||1!==e.target.nodeType)return null;const t=e.target;return"astro-island"!==t.tagName.toLowerCase()||t.hasAttribute(Rn)?null:t}function xn(e){if(1!==e.nodeType)return!1;const t=e;return t.matches(Ln)||null!==t.querySelector(Ln)}var En=class{#t=[];#n;#r=!1;constructor(e){this.#n=e}get closed(){return this.#r}own(e){this.#r?this.#i(e):this.#t.push(e)}close(){if(this.#r)return;this.#r=!0;const e=this.#t.splice(0).reverse();for(const t of e)this.#i(t)}#i(e){try{e()}catch(e){this.#n("runtime cleanup failed:",e)}}},Mn="[data-payload-field]";function On(){if("undefined"==typeof window)return;const e=window;return e.__livePreviewHydration??={armed:!1,committed:!1,commits:[],onCommit:void 0,waiters:[]}}function Fn(){const e=On();if(void 0===e||e.armed)return;e.armed=!0;const t=window,n=t.__REACT_DEVTOOLS_GLOBAL_HOOK__??=function(){const e=/* @__PURE__ */new Map;return{supportsFiber:!0,renderers:e,inject:t=>{const n=e.size+1;return e.set(n,t),n}}}(),r=n.onCommitFiberRoot;n.onCommitFiberRoot=function(t,n,...i){try{r?.call(this,t,n,...i)}catch{}void 0===e.onCommit?e.commits.push(n):e.onCommit(n)}}function Un(e){e.committed=!0;const t=e.waiters;e.waiters=[];for(const e of t)e()}function In(e,t){const n=e.waiters.indexOf(t);n>=0&&e.waiters.splice(n,1)}function _n(e,t,n){if(e.committed)return null;let r=null;const i=()=>{null!==r&&clearTimeout(r),r=null,t("committed")};return e.waiters.push(i),r=setTimeout(()=>{r=null,In(e,i),t("timed-out")},n),()=>{null!==r&&clearTimeout(r),r=null,In(e,i)}}var Dn="__vue_app__";function jn(){if("undefined"==typeof window)return;const e=window;return e.__livePreviewVueHydration??={armed:!1,committed:!1,waiters:[]}}function Bn(e){return Object.prototype.hasOwnProperty.call(e,Dn)?e[Dn]:void 0}function zn(){const e=jn();if(void 0===e||e.armed)return;e.armed=!0;const t=Element.prototype;void 0===Object.getOwnPropertyDescriptor(t,Dn)&&Object.defineProperty(t,Dn,{configurable:!0,get:()=>{},set(e){Object.defineProperty(this,Dn,{value:e,writable:!0,configurable:!0,enumerable:!0});const t=jn();void 0===t||t.committed||null===this.querySelector(Mn)||function(e,t){const n=t?.$nuxt;!0!==n?.isHydrating||"function"!=typeof n.hook?Un(e):n.hook("app:suspense:resolve",()=>{e.committed||Un(e)})}(t,e)}})}function Wn(){if("undefined"==typeof window)return;const e=window;return e.__livePreviewHydrated??={committed:!1,waiters:[]}}function Hn(e){const t=e.hydration;if(void 0===t)return void e.startNow();const n=qn[t](e.root,n=>{e.later(()=>{Gn(e,t,n)})});null!==n?(e.defer(n),e.hydrated("waiting")):Gn(e,t,"committed")}var qn={react:(e,t)=>function(e,t=5e3){Fn();const n=On();if(void 0===n)return null;if(void 0===n.onCommit){const e=e=>{!n.committed&&function(e){const t=e;return null!=t&&function(e){const t=e;return 9===t?.nodeType||null!=t?.querySelector?.(Mn)}(t.containerInfo)&&!function(e){const t=[];for(null!==e.current&&void 0!==e.current&&t.push(e.current);t.length>0;){const e=t.pop();if(void 0===e)continue;const n=e.memoizedState;if((13===e.tag||31===e.tag)&&"object"==typeof n&&null!==n&&"dehydrated"in n&&"object"==typeof n.dehydrated&&null!==n.dehydrated&&"nodeType"in n.dehydrated&&8===n.dehydrated.nodeType)return!0;null!==e.sibling&&void 0!==e.sibling&&t.push(e.sibling),null!==e.child&&void 0!==e.child&&t.push(e.child)}return!1}(t)}(e)&&Un(n)};n.onCommit=e;for(const t of n.commits.splice(0))e(t)}return _n(n,e,t)}(t),vue:function(e,t,n=5e3){zn();const r=jn();return void 0===r?null:(!r.committed&&function(e){for(let t=e.querySelector(Mn);null!==t;t=t.parentElement)if(void 0!==Bn(t))return!0;return!1}(e)&&Un(r),_n(r,t,n))},sveltekit:function(e,t,n=5e3){const r=e.ownerDocument??e,i=()=>null!==r.querySelector("#svelte-announcer");if(i()||!Object.keys(window).some(e=>e.startsWith("__sveltekit_")))return null;const o={committed:!1,waiters:[]},s=new MutationObserver(()=>{!o.committed&&i()&&Un(o)});s.observe(r,{childList:!0,subtree:!0});const a=_n(o,e=>{s.disconnect(),t(e)},n);return()=>{s.disconnect(),a?.()}},manual:function(e,t,n=5e3){const r=Wn();return void 0===r?null:_n(r,t,n)}},Vn={react:"React commit",vue:"Vue mount",sveltekit:"SvelteKit mount",manual:"markHydrated() call"};function Gn(e,t,n){e.hydrated(n),"timed-out"===n&&e.warn(`[live-preview] LP0607: no ${Vn[t]} in ${String(5e3)} ms; started without waiting for hydration.`),e.startNow()}function Jn(e){return 9===e.nodeType}function Kn(e){return e.body}var Xn=class{timeoutMs;onTimeout;handle=null;lastKick=null;constructor(e){this.timeoutMs=e.timeoutMs??0,this.onTimeout=e.onTimeout}kick(){this.lastKick=Date.now(),this.timeoutMs<=0||(this.stop(),this.arm(this.timeoutMs))}resume(){if(this.timeoutMs<=0||null!==this.handle||null===this.lastKick)return!1;const e=Math.max(0,Date.now()-this.lastKick),t=this.timeoutMs-e;return t<=0?(this.lastKick=null,this.onTimeout(),!0):(this.arm(Math.min(t,this.timeoutMs)),!1)}arm(e){const t=setTimeout(()=>{this.handle===t&&(this.handle=null,this.lastKick=null,this.onTimeout())},e);this.handle=t}stop(){null!==this.handle&&(clearTimeout(this.handle),this.handle=null)}get lastKickAt(){return this.lastKick??0}get pending(){return null!==this.handle}},Qn=class{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)}},Zn=/* @__PURE__ */new Set(["true","false","yes","no","on","off"]),Yn=/^[\d\s.,:+/-]+$/u,er=/^[a-z][a-z0-9_-]*$/u,tr=/^[a-z]{2,3}(?:[-_][A-Za-z0-9]{2,8})*$/u,nr=/* @__PURE__ */new Set(["SCRIPT","STYLE","TEMPLATE","TITLE","NOSCRIPT","TEXTAREA","SELECT","OPTION","INPUT","IFRAME"]);function rr(e,t=13){if("string"!=typeof e)return!1;const n=e.trim();return!(n.length<t||Yn.test(n)||Zn.has(n.toLowerCase())||er.test(n)||tr.test(n))}function ir(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function or(e,t,n=13){const r=/* @__PURE__ */new Map,i=(e,t,n)=>{r.set(e,r.has(e)?null:{field:t,media:n})};for(const[r,o]of Object.entries(e)){if(Le.has(r))continue;const e=Pe(r,t);if(rr(o,n))i(o.trim(),e,!1);else if(ir(o))if("string"==typeof o.url)i(o.url,e,!0);else if(!("id"in o)&&!("_id"in o))for(const[t,r]of Object.entries(o))!Le.has(t)&&rr(r,n)&&i(r.trim(),`${e}.${t}`,!1)}return r}function sr(e){if("http://www.w3.org/1999/xhtml"!==e.namespaceURI||nr.has(e.tagName))return!0;if(e.hasAttribute(Tt)||e.hasAttribute("data-payload-no-bind")||e.hasAttribute(ct)||pt(e))return!0;const t=e.getAttribute("contenteditable");return null!==t&&"false"!==t}function ar(e){let t;for(let n=e.firstChild;null!==n;n=n.nextSibling){if(1===n.nodeType)return;if(3!==n.nodeType)continue;const e=n.data.trim();if(0!==e.length){if(void 0!==t)return;t=e}}return t}function lr(e){return G(e)&&!e.startsWith("data-payload-")&&"value"!==e}function ur(e,t,n){let r=e.byElement.get(t);void 0===r&&(r={attributes:/* @__PURE__ */new Map},e.byElement.set(t,r));let i=e.byField.get(n.field);return void 0===i&&(i=/* @__PURE__ */new Set,e.byField.set(n.field,i)),i.add(t),r}function dr(e,t){for(let n=e.firstElementChild;null!==n;n=n.nextElementSibling){if(sr(n))continue;const e=ar(n),r=void 0===e?void 0:t.values.get(e);null==r||r.media||(ur(t,n,r).text=r.field);for(const e of n.getAttributeNames()){if(!lr(e))continue;const r=t.values.get(n.getAttribute(e)??"");null!=r&&(!r.media||"IMG"===n.tagName&&"src"===e)&&ur(t,n,r).attributes.set(e,r)}dr(n,t)}}function cr(e,t,n){const r=e.tagName;if(void 0!==t){const i={[Tt]:t};if("A"===r){const e=n.get("href");void 0===e?i[Ct]="text":e!==t&&(i[$t]=e)}return{element:e,fieldName:t,matched:ar(e)??"",stamps:i}}if("IMG"===r){const t=n.get("src");if(void 0!==t){const r=n.get("alt");return{element:e,fieldName:t,matched:e.getAttribute("src")??"",attribute:"src",stamps:{[Tt]:t,...void 0!==r&&r!==t?{[Nt]:r}:{}}}}}const i=n.entries().next();if(i.done)return;const[o,s]=i.value;return{element:e,fieldName:s,matched:e.getAttribute(o)??"",attribute:o,stamps:{[Tt]:s,[Rt]:o}}}function fr(e,t){const n={values:t,byElement:/* @__PURE__ */new Map,byField:/* @__PURE__ */new Map};t.size>0&&!sr(e)&&dr(e,n);const r=e=>1===n.byField.get(e)?.size,i=[];for(const[e,t]of n.byElement){const n=void 0!==t.text&&r(t.text)?t.text:void 0,o=/* @__PURE__ */new Map;for(const[e,n]of t.attributes)r(n.field)&&o.set(e,n.field);const s=cr(e,n,o);void 0!==s&&i.push(s)}return i}function hr(e){return 9===e.nodeType?e.body:e}function pr(e,t){for(let n=t.length-1;n>=0;n-=1){const r=t[n];if(void 0!==r){r.observed&&e.observers.unobserveElement(r.element);for(let e=r.attributes.length-1;e>=0;e-=1){const t=r.attributes[e];if(void 0===t)continue;const{name:n,before:i,written:o}=t;i!==o&&r.element.getAttribute(n)===o&&(null===i?r.element.removeAttribute(n):r.element.setAttribute(n,i))}r.cacheTouched&&(r.element.hasAttribute(Tt)?e.cache.add(r.element):e.cache.remove(r.element))}}}function gr(e,t,n,r,i){const o=[],s=[],a=()=>(pr(e,s),[]);for(const l of t){if(!i())return a();const{element:t}=l;if(t.hasAttribute(Tt))continue;if(!i())return a();if(!1!==n&&!ye(Jt(t),n))continue;if(!i())return a();const u={element:t,attributes:[],cacheTouched:!1,observed:!1};s.push(u);for(const[e,n]of[...Object.entries(l.stamps),[zt,l.matched]]){const r=t.getAttribute(e);if(!i())return a();if(u.attributes.push({name:e,before:r,written:n}),t.setAttribute(e,n),!i())return a()}if(u.cacheTouched=!0,void 0!==e.cache.add(t)){if(!i())return a();if(e.observers.observeElement(t),u.observed=!0,!i())return a();if(e.log("autoBind",l.fieldName,"→",`<${t.tagName.toLowerCase()}>`,l.attribute??"text",JSON.stringify(l.matched),r),!i())return a();o.push(l)}else pr(e,[u]),s.pop()}return o}function mr(e,t,n,r,i){if("undefined"!=typeof __LEAN_BUILD__&&__LEAN_BUILD__)return;const o=function(e,t){let n,r=e;for(const e of t.split(".")){if("object"!=typeof r||null===r)break;r=r[e];const t=/^\d+$/.test(e)?r?.id:null;"string"!=typeof t&&"number"!=typeof t||(n=`${n??""}/${String(t)}`)}return n}(r,n.fieldName);if(void 0===o)return;if(i)return void t.rowsOfBinding.delete(n.element);const s=t.rowsOfBinding.get(n.element);t.rowsOfBinding.set(n.element,o),void 0!==s&&s!==o&&X(e,t,n,"stands in a row that moved",o)}function vr(e,t,n,r){if(!e.scopeBindingsByOwner)return!1;const{message:i}=n,o=function(e){if(ve(e.globalSlug))return[(t=e.globalSlug,`global:${t}`)];var t;if(!ve(e.collectionSlug))return null;const n=me(e.collectionSlug);return ve(e.documentId)?[n,me(e.collectionSlug,e.documentId)]:[n]}({globalSlug:"string"==typeof i.globalSlug?i.globalSlug:void 0,collectionSlug:"string"==typeof i.collectionSlug?i.collectionSlug:void 0,documentId:be(r)});return null!==o||t.warnedUnattributableMessage||(t.warnedUnattributableMessage=!0,e.warn("[live-preview] LP0202: scopeBindingsByOwner: update names no document; nothing applied")),o}var yr=class{constructor(e,t,n){this.deps=e,this.state=t,this.host=n}deps;state;host;awaitingHydration=/* @__PURE__ */new WeakSet;delivered=/* @__PURE__ */new WeakMap;confirmations=/* @__PURE__ */new WeakMap;reapplyBindings(e){const t=this.currentTransaction();void 0!==t?.renderData&&this.host.schedule(t,t.renderData,e)}reapplyIslands(e,t=!1){const n=t?e.filter(e=>this.awaitingHydration.delete(e)):e,r=this.state.activeUpdate,i=t&&null!==r&&this.state.isCurrent(r)?r:this.currentTransaction();void 0!==i?.renderData&&this.dispatchIslands(i,i.renderData,n)}dispatchIslands(e,t,n){const r=vr(this.deps,this.state,e,t.fields),i=()=>!e.cancelled&&this.state.isCurrent(e);if(!i())return;let o=this.delivered.get(t);void 0===o&&(o=/* @__PURE__ */new WeakSet,this.delivered.set(t,o));for(const s of n){const n=Jt(s);if(!i())return;if(!1!==r&&!ye(n,r)){this.awaitingHydration.delete(s);continue}const a=this.confirmation(s,e);if(gt(s))this.awaitingHydration.add(s);else{if(this.awaitingHydration.delete(s),o.has(s))continue;o.add(s),br(e,t,[s],i,a)}}}hasLateRouteBinding(e,t,n,r){for(const r of e){if((r.getAttribute(Tt)??"").length>0||"route"!==r.getAttribute(jt))continue;if(!1!==t&&!ye(Jt(r),t))continue;const e=ot(r.getAttribute(Dt));if(0===e.length||e.some(e=>n.touched.has(e)))return!0}for(const[i,o]of this.deps.cache.entries())for(const s of o){if(!e.has(s.element))continue;if(!1!==t&&!ye(s.owner,t))continue;if("route"!==(s.strategyKind??ge(s.element)??"unknown"))continue;const o=ue(r.fields,s,i,n.locale);if(!this.state.isCurrent(n))return!1;if(void 0!==o)return!0}return!1}fieldsForElements(e,t){const n=new Set(t);for(const[t,r]of this.deps.cache.entries())r.some(t=>e.has(t.element))&&n.add(t);return n}unrunFragmentPlan(e,t,n){if(null===t)return null;const r=t.boundaries.filter(t=>!e.fragmentBoundariesRun.has(t)&&(void 0===n||[...n].some(e=>e===t||t.contains(e))));return pe(t.strategy,r,t.ownerKeys)}confirmation(e,t){const n=this.confirmations.get(e);if(n?.transaction===t)return n.displayed;const r=this.state.display.handIsland(t);return this.confirmations.set(e,{transaction:t,displayed:r}),r}currentTransaction(){const e=this.state.activeUpdate;return this.state.navigationBindingReplay&&null!==e&&this.state.isCurrent(e)?e:null}};function br(e,t,n,r,i){!function(e,t,n){let r=0;for(const i of e){if(!n())break;if(i.dispatchEvent(new CustomEvent(lt,{detail:t,bubbles:!1})),r+=1,!n())break}}(n,{fields:t.fields,revision:e.revision.revision,receivedAt:e.receivedAt,locale:e.locale,displayed:i},r)}var wr=" subfieldCoverage";function Sr(e,t,n,r,i){const{warned:o,warn:s}=e;if(o.has(n)||t(n))return;o.add(n);const a=`data-payload-field="${Pe(n,r)}"`;s(""!==i?`[live-preview] LP0203: field "${n}" has a value and no <… ${a}> 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 <… ${a}> for the empty field "${n}"; render the anchor unconditionally so edits to an empty field have somewhere to land.`)}function Ar(e){const t=typeof e;return"string"===t||"number"===t||"boolean"===t||"bigint"===t}function kr(e){return Array.isArray(e.docs)&&"boolean"==typeof e.hasNextPage}function Tr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}var Cr="payload-live-preview",Rr=/* @__PURE__ */Symbol.for("payload-live-preview.trusted-types");function $r(){const e=globalThis,t=e[Rr];if(void 0!==t)return t;const n={};return e[Rr]=n,n}function Lr(e){const t=function(){const e=$r();if(void 0!==e.override)return e.override;if(void 0!==e.auto)return e.auto;const t=function(){const e=globalThis.trustedTypes;if("object"==typeof e&&null!==e)return"function"==typeof e.createPolicy?e:void 0}();try{e.auto=void 0===t?null:t.createPolicy(Cr,{createHTML:e=>e})}catch{e.auto=null}return e.auto}();return null===t?e:t.createHTML(e)}var Nr=/* @__PURE__ */new Set(["open","value","checked","selected"]);function Pr(e,t){for(const n of t.keyAttributes){const t=e.getAttribute(n);if(null!==t&&t.length>0)return`${n}=${t}`}}function xr(e,t,n){if(!Or(e,t))return t;const r=n.boundary??ft,i=r(e),o=r(t);if(i||o)return i&&o&&(n.retainBoundary?.(e,t)??1)?e:t;const s=Fr(e);return function(e,t){for(const n of Array.from(e.attributes))t.hasAttribute(n.name)||Nr.has(n.name.toLowerCase())||e.removeAttribute(n.name);for(const n of Array.from(t.attributes))e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value)}(e,t),!0!==n.retainChildrenOf?.(e,t)&&function(e,t,n){const r=function(e,t){const n=/* @__PURE__ */new Map;let r;for(const i of Array.from(e.children)){const e=Pr(i,t);void 0!==e&&(n.has(e)?r??=e.slice(e.indexOf("=")+1):n.set(e,i))}return void 0!==r&&t.onDuplicateKey?.(e,r),n}(e,n),i=new Set(r.values()),o=Array.from(e.childNodes).filter(e=>!i.has(e)),s=/* @__PURE__ */new Set,a=/* @__PURE__ */new Set,l=Array.from(t.childNodes);let u=e.firstChild,d=0;for(let t=0;t<l.length;t+=1){const i=l[t];let c=null,f=i instanceof Element?Pr(i,n):void 0;if(void 0!==f&&a.has(f)&&(f=void 0),void 0!==f){a.add(f);const e=r.get(f);if(void 0!==e&&!s.has(e)&&(c=Er(e,i,n)===e?e:null,null===c)){e.replaceWith(i),s.add(i),u=i.nextSibling;continue}}else{for(;d<o.length;){const r=o[d];if(d+=1,!s.has(r)){if(Or(r,i)){c=Er(r,i,n)===r?r:null,null===c&&(e.replaceChild(i,r),s.add(i),u=i.nextSibling);break}if(r instanceof Element){const n=l[t+1];if(!(i instanceof Element)||void 0!==n&&Or(r,n)){d-=1;break}e.replaceChild(i,r),s.add(i),u=i.nextSibling;break}if(!(i instanceof Element)){e.replaceChild(i,r),s.add(i),u=i.nextSibling;break}}}if(null===c&&s.has(i))continue}const h=c??i;for(s.add(h);null!==u&&u!==h&&!s.has(u)&&Mr(u);)u=u.nextSibling;h!==u&&e.insertBefore(h,u),u=h.nextSibling}for(const t of Array.from(e.childNodes))s.has(t)||t.remove()}(e,t,n),Ur(s),e}function Er(e,t,n){return e instanceof Element&&t instanceof Element?xr(e,t,n):(e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e)}function Mr(e){return e.nodeType===Node.TEXT_NODE&&0===(e.nodeValue??"").trim().length}function Or(e,t){return e.nodeType===t.nodeType&&(!(e instanceof Element&&t instanceof Element)||e.tagName===t.tagName&&e.namespaceURI===t.namespaceURI)}function Fr(e){const t=e.ownerDocument.activeElement;return t instanceof HTMLElement&&e.contains(t)?{element:t,selection:t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?[t.selectionStart,t.selectionEnd]:null}:null}function Ur(e){if(null===e)return;const{element:t,selection:n}=e;if(t.ownerDocument.activeElement!==t&&t.isConnected)try{t.focus({preventScroll:!0});const[e,r]=n??[null,null];null!==e&&null!==r&&t.setSelectionRange(e,r)}catch{}}function Ir(e,t){if(!function(){try{const e=globalThis.process?.env;return void 0!==e&&"production"!==e.NODE_ENV}catch{return!1}}())return;const n=globalThis,r=n.__payloadLivePreviewDeprecationsWarned??=/* @__PURE__ */new Set;if(!r.has(e)){r.add(e);try{console.warn(`[payload-live-preview] ${t}`)}catch{}}}var _r=/* @__PURE__ */new Set;function Dr(e){_r.has(e)||(_r.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("data-payload-")?"A binding inside CMS content is refused by design — 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 — DOM clobbering, refused by design (docs/security.md)":"Put it on an element the template owns, or set `sanitizerPolicy: 'compat'` to keep every `data-*` as 1.x did"}(e)}.`))}var jr=/* @__PURE__ */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"]),Br=/* @__PURE__ */new Set(["input","button","textarea","select","option","label"]),zr=/* @__PURE__ */new Set(["script","style","iframe","object","embed","link","meta","base","form","input","button","select","textarea","svg","math","template","frame","frameset","noframes","noscript"]),Wr=/* @__PURE__ */new Set(["id","class","lang","dir","title","role","tabindex"]),Hr="aria-",qr="data-",Vr={a:/* @__PURE__ */new Set(["href","target","rel","download","hreflang","type"]),img:/* @__PURE__ */new Set(["src","srcset","sizes","alt","width","height","loading","decoding"]),picture:/* @__PURE__ */new Set([]),source:/* @__PURE__ */new Set(["src","srcset","sizes","type","media"]),audio:/* @__PURE__ */new Set(["src","controls","autoplay","loop","muted","preload"]),video:/* @__PURE__ */new Set(["src","poster","controls","autoplay","loop","muted","preload","width","height","playsinline"]),time:/* @__PURE__ */new Set(["datetime"]),abbr:/* @__PURE__ */new Set(["title"]),q:/* @__PURE__ */new Set(["cite"]),blockquote:/* @__PURE__ */new Set(["cite"]),table:/* @__PURE__ */new Set(["summary"]),th:/* @__PURE__ */new Set(["colspan","rowspan","scope","headers","abbr"]),td:/* @__PURE__ */new Set(["colspan","rowspan","headers"]),col:/* @__PURE__ */new Set(["span"]),colgroup:/* @__PURE__ */new Set(["span"]),ol:/* @__PURE__ */new Set(["start","reversed","type"]),li:/* @__PURE__ */new Set(["value"]),code:/* @__PURE__ */new Set(["class"]),pre:/* @__PURE__ */new Set(["class"])},Gr=/* @__PURE__ */new Set(["href","src","cite","poster","action","formaction"]),Jr=class extends Error{name="SanitizerEnvironmentError"},Kr=/* @__PURE__ */new Set(["id","name","data-payload-key","data-payload-morph","data-payload-nested-key","data-payload-nested-template"]),Xr="strict",Qr=/* @__PURE__ */Symbol.for("payload-live-preview.sanitizer-document");function sanitizeHtml(e,t){return Zr(e,void 0,t)}function Zr(e,t,n){const r=n?.document??ti();if(!r)throw Yr();if(""===e)return"";const i=function(e,t){const n=e?.policy??t??Xr;if(!e){const e=/* @__PURE__ */new Map;for(const[t,n]of Object.entries(Vr))e.set(t,n);return{allowedTags:jr,attrByTag:e,allowFormControls:!1,templateMode:!1,mode:n,allowedData:/* @__PURE__ */new Set}}const r=new Set(jr);if(e.additionalAllowedTags?.forEach(e=>r.add(e)),!0===e.allowFormControls)for(const e of Br)r.add(e);const i=/* @__PURE__ */new Map;for(const[e,t]of Object.entries(Vr))i.set(e,t);for(const[t,n]of Object.entries(e.additionalAllowedAttributes??{})){const e=new Set(i.get(t));for(const t of n)e.add(t);i.set(t,e)}return{allowedTags:r,attrByTag:i,allowFormControls:!0===e.allowFormControls,templateMode:!0===e.templateMode,mode:n,allowedData:new Set(e.allowedDataAttributes?.map(e=>e.toLowerCase()))}}(n,t);let o=e;for(let e=0;e<6;e+=1){const e=r.createElement("template");e.innerHTML=Lr(o);const t=e.content;ni(t,i);const n=ei(t);if(n===o)return n;o=n}return Ir("sanitizer-unsettled",`sanitizeHtml: the output did not settle after ${String(6)} passes, so it returned an empty string (ADR 0016).`),""}function Yr(){return"undefined"!=typeof __INLINE_BUILD__&&__INLINE_BUILD__?new Error("sanitizeHtml needs a DOM"):new Jr("sanitizeHtml needs a DOM; pass one per call during SSR: { document } (linkedom, jsdom).")}function ei(e){const t=e.ownerDocument?.createElement("div");if(void 0===t)throw Yr();const n=e.firstChild;if(t.append(e),t.firstChild!==n)throw Yr();return t.innerHTML}function ti(){if("undefined"==typeof __INLINE_BUILD__||!__INLINE_BUILD__){const e=globalThis[Qr];if(e)return e}if("undefined"!=typeof document)return document}function ni(e,t){for(const n of Array.from(e.childNodes))1===n.nodeType?ri(n,t):8===n.nodeType&&n.remove()}function ri(e,t){const n=e.tagName.toLowerCase();if(!zr.has(n)||t.allowFormControls&&Br.has(n)){if(!t.allowedTags.has(n))return ni(e,t),void e.replaceWith(...e.childNodes);!function(e,t,n){const r=n.attrByTag.get(t);for(const t of Array.from(e.attributes)){const i=t.name.toLowerCase();if(i.startsWith("on")||"style"===i)e.removeAttribute(t.name);else if("is"!==i){if("strict"===n.mode){if(n.templateMode&&Kr.has(i))continue;if("id"===i||"name"===i||i.startsWith("data-payload-")){e.removeAttribute(t.name),"name"===i&&!0!==r?.has(i)||Dr(i);continue}if(i.startsWith(qr)){n.allowedData.has(i)||(e.removeAttribute(t.name),Dr(i));continue}if(Wr.has(i)||i.startsWith(Hr))continue}else if(Wr.has(i)||i.startsWith(Hr)||i.startsWith(qr))continue;r?.has(i)?Gr.has(i)&&!isSafeUrl(t.value)?e.removeAttribute(t.name):("srcset"!==i||ii(t.value))&&("ping"!==i||t.value.trim().split(/\s+/u).every(isSafeUrl))||e.removeAttribute(t.name):e.removeAttribute(t.name)}else e.setAttribute("is","")}}(e,n,t),"a"===n&&function(e){const t=e.getAttribute("href");null!==t&&isExternalHttpUrl(t)&&(e.setAttribute("rel","noopener noreferrer"),e.hasAttribute("target")||e.setAttribute("target","_blank"))}(e),ni(e,t)}else e.remove()}function ii(e){for(const t of e.split(",")){const e=t.trim();if(0===e.length)continue;const[n=e]=e.split(/\s/,1);if(!isSafeUrl(n)||!isSafeUrl(e))return!1}return!0}var oi=Object.freeze({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"}),si=/[&<>"'/`=]/g;function escapeHtml(e){return e.replace(si,e=>oi[e])}var ai=Object.freeze({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}),li=/[&<>"']/g;function escapeHtmlAttribute(e){return e.replace(li,e=>ai[e])}var ui=/\{\{([\s\S]*?)\}\}/g;function di(e){const t=/* @__PURE__ */new Set;for(const n of e)if("object"==typeof n&&null!==n)for(const e of Object.keys(n))t.add(e);return t}function ci(e,t,n,r,i){const o="object"==typeof t&&null!==t?t:null;return e.replace(ui,(e,s)=>null!==o&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(o,s)?escapeHtml(r(Reflect.get(o,s))):null===o&&"value"===s?escapeHtml(r(t)):"index"===s?String(n):null!==o&&!0===i?.has(s)?"":e)}function fi(e){const t=e.children,n=t[0];if(void 0===n)return[];const r=[];for(const{name:e,value:i}of Array.from(n.attributes)){if(!G(e)||e.startsWith("data-payload-"))continue;let n=!0;for(let r=1;r<t.length&&n;r+=1)n=t[r]?.getAttribute(e)===i;n&&r.push([e,i])}return r}function hi(e,t){for(const[n,r]of t)e.hasAttribute(n)||e.setAttribute(n,r)}function pi(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 gi(e){return null==e||""===e}function mi(e,t){const n=e.get(t);return void 0!==n&&(e.delete(t),e.set(t,n)),n}function vi(e,t,n,r){return e.set(t,n),function(e,t){for(const n of e.keys()){if(e.size<=t)break;e.delete(n)}}(e,r),n}var yi=["input","textarea","select","option","button","label","details","summary","dialog","video","audio","progress","meter"],bi=["type","name","placeholder","open","disabled","readonly","required","checked","selected","value","min","max","step","rows","cols","for","controls","muted","loop","poster","src"],wi=/<([a-z][a-z0-9]*(?:-[a-z0-9]+)+)\b/gi,Si=/* @__PURE__ */new Map;function Ai(e){const t=mi(Si,e);if(void 0!==t)return t;const n=new Set(yi);for(const t of e.matchAll(wi)){const e=t[1]?.toLowerCase();void 0!==e&&n.add(e)}const r={};for(const e of n)r[e]=bi;const i={additionalAllowedTags:[...n],additionalAllowedAttributes:r,allowFormControls:!0,templateMode:!0};return vi(Si,e,i,64)}var ki="data-payload-key",Ti="data-payload-nested-key",Ci="data-payload-nested-template";function Ri(e){const t=Li(e.container,e.patches,e);return null===t?null:Ni(t,e.store,{morph:e.morph??!0,onDuplicateKey:e.onDuplicateKey})}function $i(e,t){return t.hasAttribute(Ti)&&t.hasAttribute(Ci)}function Li(e,t,n){const r=function(e,t,n){const{template:r,nextItems:i,forceRender:o=!1,store:s,sanitizerPolicy:a}=n,l=s.get(e),u=fi(e),d=di(i),c=Array.from(e.children),f=Ui(c,ki),h=/* @__PURE__ */new Set,p=[];for(let s=0;s<i.length;s+=1){const g=i[s],m=Fi(g);let v=void 0===m?c[s]??null:Ii(f,m)??null;null!==v&&h.has(v)&&(v=null),null!==v&&h.add(v);const y=t.replaces.has(s),b=o||t.renders.has(s)||null===v?_i(e.ownerDocument,r,g,s,a,u,d):void 0;if(null===b)return null;const w=void 0===b?[]:Pi(y?null:v,b,g,void 0===m?void 0:l?.get(m),n);if(null===w)return null;p.push([s,v,b,w,y])}return p}(e,function(e){const t=/* @__PURE__ */new Set,n=/* @__PURE__ */new Set;for(const r of e)"insert"===r.kind||"update"===r.kind?t.add(r.index):"replace"===r.kind&&(t.add(r.index),n.add(r.index));return{renders:t,replaces:n}}(t),n);return null===r?null:[e,r,n.nextItems]}function Ni(e,t,n){const[r,i,o]=e,s=/* @__PURE__ */new Set;let a=!1;const l=Fr(r);for(const[e,o,l,u,d]of i){let i=o;if(void 0!==l){const e=!(!n.morph||d||null===o)&&xr(o,l,{keyAttributes:[ki,Ti],boundary:ft,retainBoundary:St,retainChildrenOf:$i,...void 0!==n.onDuplicateKey?{onDuplicateKey:n.onDuplicateKey}:{}})===o;if(!e)for(const[e,t]of u)null!==e&&(Ei(e,t),t.replaceWith(e));for(const[,,e]of u)void 0!==e&&Ni(e,t,n);e?a=!0:(null!==o&&(o.replaceWith(l),a=!0),i=l)}if(null===i)continue;const c=r.children[e]??null;i!==c&&(r.insertBefore(i,c),a=!0),s.add(i)}for(const e of Array.from(r.children))s.has(e)||(e.remove(),a=!0);Ur(l);const u=function(e,t){let n=t.get(e);return n||(n=/* @__PURE__ */new Map,t.set(e,n)),n}(r,t);u.clear();for(const e of o)Oi(u,e);return a}function Pi(e,t,n,r,i){const o=Ui(null===e?[]:xi(e),Ti),s=[];for(const e of xi(t)){const t=e.getAttribute(Ti);if(null===t)continue;const a=Ii(o,t)??null,l=e.getAttribute(Ci),u=l?a:null,d=u?.getAttribute(Ci)??null;let c;if(l){const o=Mi(n,t);if(void 0!==o||null!==u){const n=o??[],s=U(null===u?[]:Mi(r,t)??[],n),a=null!==u&&d!==l;if((s.length>0||a)&&(c=Li(u??e,s,{template:l,nextItems:n,forceRender:a,store:i.store,sanitizerPolicy:i.sanitizerPolicy})??void 0,void 0===c))return null}}s.push([u,e,c])}return s}function xi(e){return Array.from(e.querySelectorAll(`[${Ti}]`)).filter(t=>{let n=t.parentElement;for(;null!==n&&n!==e;){if(n.hasAttribute(Ti))return!1;n=n.parentElement}return n===e})}function Ei(e,t){for(const n of Array.from(e.attributes))t.hasAttribute(n.name)||e.removeAttribute(n.name);for(const n of Array.from(t.attributes))e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value)}function Mi(e,t){if("object"!=typeof e||null===e)return;const n=e[t];return Array.isArray(n)?n:void 0}function Oi(e,t){const n=Fi(t);void 0!==n&&e.set(n,t)}function Fi(e){if("object"!=typeof e||null===e)return;const t=e.id;return"string"==typeof t||"number"==typeof t?String(t):void 0}function Ui(e,t){const n=/* @__PURE__ */new Map;for(let r=e.length-1;r>=0;r-=1){const i=e[r];if(void 0===i)continue;const o=i.getAttribute(t);if(null===o)continue;const s=n.get(o);void 0===s?n.set(o,[i]):s.push(i)}return n}function Ii(e,t){return e.get(t)?.pop()}function _i(e,t,n,r,i,o,s){const a=Zr(ci(t,n,r,pi,s),i,Ai(t)),l=e.createElement("template");l.innerHTML=Lr(a);const u=l.content.firstElementChild;if(!u)return null;hi(u,o);const d=Fi(n);return void 0!==d&&u.setAttribute(ki,d),u}function Di(e,t,n){t.warnedFragmentFallback||(t.warnedFragmentFallback=!0,e.warn(`[live-preview] LP0806: "${n.fieldName}" asks for the fragment strategy but no handler is configured; patching instead`))}function ji(e,t,n){t.warnedStrategy.has(n.element)||(t.warnedStrategy.add(n.element),e.warn(`[live-preview] LP0407: "${n.fieldName}" asks for strategy "${String(n.strategy)}"; only patch, fragment and route exist`))}function Bi(e,t,n){if(t.warnedEscalationUnavailable)return;t.warnedEscalationUnavailable=!0;const r=`[live-preview] LP0808: onUnfaithfulPatch: 'escalate' has nowhere to go: ${String(n)} field(s) fell short`,i="or onUnfaithfulPatch: 'warn' to keep the patch and say so.";e.warn(void 0===e.strategies.fragment?`${r} and no route or fragment strategy is configured. Set routeStrategy: true or fragments: { endpoint }, ${i}`:`${r}, not all of them inside a data-payload-fragment boundary of this document, and no route strategy is configured. Cover them with a boundary or add the route strategy, ${i}`)}var zi=class{constructor(e,t,n){this.deps=e,this.state=t,this.host=n}deps;state;host;planFragments(e,t){const{deps:n,state:r}=this,i=n.strategies.fragment;if(void 0===i)return null;const o=new Set(i.plan(n.root,e));for(const e of r.fragmentsOwed)n.root.contains(e)?o.add(e):r.fragmentsOwed.delete(e);return pe(i,[...o].filter(e=>Wi(e,t)),t)}escalateUnfaithful(e,t,n,r){if(e.routeRefreshed)return void this.kept(e,n);const{fragment:i,route:o}=this.deps.strategies,s=void 0===i?void 0:function(e){const t=[];for(const n of e){const e=n.fragmentBoundary;if(void 0===e)return;t.includes(e)||t.push(e)}return t}(n),a=void 0===s||s.every(e=>Wi(e,r))?s:void 0;return void 0!==i&&void 0!==a?(this.state.escalatedCount+=n.length,e.pendingFragments+=a.length,void this.runFragments(e,t,pe(i,a,r))):void 0===o?(Bi(this.deps,this.state,n.length),void this.kept(e,n)):(this.state.escalatedCount+=n.length,void this.refreshRoute(e,t,o))}kept(e,t){for(const n of t)this.state.display.shortfall(e,{kind:"unfaithful",field:n.fieldName})}hasUnboundChange(e,t){const{deps:n,state:r}=this;if(e.baseline||e.routeRefreshed)return!1;const i=Oe(n.cache,e.touched,e.locale,t,this.subfields(e),n.strategies);let o=0;for(const e of i)Q(r,e)&&(o+=1);const[s]=i;if(void 0===s)return!1;if("escalate"!==n.onUnfaithfulPatch||void 0===n.strategies.route){"escalate"===n.onUnfaithfulPatch&&Bi(n,r,i.length);for(const t of i)r.display.shortfall(e,{kind:"unbound",field:t});return!1}return e.navigated?(r.routeAwaitsSave=!0,r.display.shortfall(e,{kind:"route-saved"}),!1):(n.log("route","LP0807",`field "${s}" has no binding; refreshing the route`),r.escalatedCount+=o,!0)}subfields(e){const{previousFields:t}=this.state.changes;return Me(this.deps.subfieldCoverage,t,e.renderData?.fields)}plansRoute(e,t,n){const r=e=>!1===n||ye(e,n),i=function(e,t,n){const r=e.rendered.flatMap(e=>"route"===e.strategy?e.paths:[]);for(const[t,n]of e.entries())n.some(e=>"route"===e.strategyKind)&&r.push(t);const i=new Set(t);for(const e of r){const[r=e]=e.split(".");t.has(r)&&(void 0===n||Re(e,n.previous,n.next))&&i.add(e)}return i}(this.deps.cache,t.touched,this.subfields(t));if(e.plan(this.deps.root,i,{inScope:e=>r(Jt(e))}))return!0;for(const[e,t]of this.deps.cache.entries())if(i.has(e)&&t.some(e=>"route"===e.strategyKind&&r(e.owner)))return!0;return!1}async runFragments(e,t,n){const{deps:r,state:i}=this,o=new AbortController,s=new Set(n.boundaries);for(const e of s)i.fragmentsOwed.delete(e);i.fragmentControllers.set(o,s);const a=t=>{s.delete(t)&&(e.pendingFragments-=1)},l=()=>i.isCurrent(e)&&!o.signal.aborted,u=e=>function(e,t,n){if(t.isConnected)return t;const r=t.getAttribute(ce),i=t.getAttribute(fe);let o;for(const t of e.querySelectorAll(`[${ce}]`))if(t.getAttribute(ce)===r&&t.getAttribute(fe)===i&&n(t)){if(void 0!==o)return;o=t}return o}(r.root,e,e=>Wi(e,n.ownerKeys)),{emitter:d}=r,{message:c}=e,f=e.revision.revision,h=e.receivedAt,p={root:r.root,revision:f,receivedAt:h,fields:t.fields,locale:e.locale,collectionSlug:"string"==typeof c.collectionSlug?c.collectionSlug:void 0,globalSlug:"string"==typeof c.globalSlug?c.globalSlug:void 0,signal:o.signal,isCurrent:l,log:(e,t)=>{r.log("fragment",e,t)},morph:(e,t)=>{const n=l()?u(e):void 0;void 0!==n&&function(e,t,n){const r=e.ownerDocument.createElement("template");r.innerHTML=Lr(t);const i=e.cloneNode(!1);i.append(r.content);const o=At(e);xr(e,i,{keyAttributes:[ki],boundary:ft,retainBoundary:St}),function(e){for(const t of e)t.isConnected||yt.has(t)||(yt.add(t),t.dispatchEvent(new CustomEvent("astro:unmount")))}(o);const s=new Set(o);for(const t of At(e)){const e=s.has(t)?void 0:kt(t);void 0!==e&&n(t,e)}}(n,t,(e,t)=>{!function(e,t,n,r){if(t.warnedIslandStart)return;t.warnedIslandStart=!0;const i="element"===r?"<astro-island>":`client:${n.getAttribute("client")??""}`;e.warn(`[live-preview] LP0809: a fragment island cannot start: this page never loaded ${i}; render one on the page`)}(this.deps,this.state,e,t)})},patch:r=>{const i=u(r);void 0!==i&&(i!==r&&this.host.rebuildCache(),this.patchFallback(e,t,i,n.ownerKeys,l))},rendered:(e,t,n)=>{a(e);const r=u(e)??e;d.emitWhile("fragmentRender",{element:r,id:t,key:n,status:"rendered",revision:f,receivedAt:h},l)},failed:(t,n,o,s,c)=>{a(t);const p=u(t)??t;i.display.shortfall(e,{kind:"fragment",id:n,key:o,code:s});const g=`fragment "${n}" fell back to patch: ${c}`;r.log("fragment",s,g),d.emitWhile("error",{error:new Error(g),context:"fragment",code:s},l),d.emitWhile("fragmentRender",{element:p,id:n,key:o,status:"failed",code:s,revision:f,receivedAt:h},l)}};let g={rendered:0,failed:0,superseded:0};try{g=await n.strategy.render(p,n.boundaries)}catch(t){if(r.log("fragment","LP0801",t),l()){for(const t of n.boundaries)p.patch(t),i.display.shortfall(e,et(t));g={rendered:0,failed:n.boundaries.length,superseded:0}}}i.fragmentStats.rendered+=g.rendered,i.fragmentStats.failed+=g.failed,i.fragmentStats.superseded+=g.superseded,i.fragmentControllers.delete(o);for(const e of s)a(e);l()&&(g.rendered>0&&this.host.restoreGuesses(e,t),0===e.pendingFragments&&0===r.scheduler.pendingCount&&i.complete(e),this.host.revealPending(e),l()&&0!==g.rendered&&0!==d.listenerCount("afterUpdate")&&d.emitWhile("afterUpdate",{data:t,updatedCount:g.rendered,durationMs:Date.now()-h,revision:f,receivedAt:h,source:"fragment"},l))}async refreshRoute(e,t,n){const{deps:r,state:i}=this;if(e.routeRefreshed)return i.routeStats.loopStopped+=1,void r.log("route","LP0805",`revision ${String(e.revision.revision)} asked for a second refresh`);e.routeRefreshed=!0,await this.runRoute(e,t,n,!1).catch(e=>{this.routeFailed(e)})}refreshAfterSave(){const{deps:e,state:t}=this,{route:n}=e.strategies,r=t.activeUpdate;t.routeAwaitsSave&&void 0!==n&&void 0!==r?.renderData&&(e.log("route","document saved; refreshing the route"),this.runRoute(r,r.renderData,n,!0).catch(e=>{this.routeFailed(e)}))}routeFailed(e){this.deps.log("route refresh failed:",e)}armRouteRetry(e,t,n,r,i){const{state:o}=this;null!==o.routeRetry&&clearTimeout(o.routeRetry),o.routeRetry=setTimeout(()=>{o.routeRetry=null,o.isCurrent(e)&&this.runRoute(e,t,n,i).catch(e=>{this.routeFailed(e)})},r)}async runRoute(e,t,n,r){const{deps:i,state:o}=this;if(i.routeAfterSave&&!r)return o.routeAwaitsSave=!0,void o.display.shortfall(e,{kind:"route-saved"});const s=o.routeStats,a=new AbortController;o.routeController?.abort(),o.routeController=a;const l=()=>!a.signal.aborted;let u;try{u=await n.refresh({revision:e.revision.revision,receivedAt:e.receivedAt,signal:a.signal,isCurrent:l,log:(e,t)=>{i.log("route",e,t)},retryAfter:i=>{this.armRouteRetry(e,t,n,i,r)}})}catch(e){i.log("route","LP0801",e),u="failed"}if(!l())return;o.routeController=null;const d=o.activeUpdate;if(null===d)return;const c=d.renderData,f=()=>o.isCurrent(d);if("partial"===u?o.display.shortfall(d,{kind:"route-saved"}):("failed"===u||"superseded"===u||"refused"===u&&null===o.routeRetry)&&o.display.shortfall(d,{kind:"route-failed",outcome:u}),"refreshed"===u||"partial"===u){if(s.refreshes+=1,"partial"===u&&(s.partial+=1),o.routeAwaitsSave="partial"===u&&!r,o.lastAppliedIdentity=/* @__PURE__ */new WeakMap,void 0!==c&&this.host.restoreGuesses(d,c),this.host.rebuildCache(),void 0===c||!f())return;return this.host.reapply(d,c),void(i.emitter.listenerCount("afterUpdate")>0&&i.emitter.emitWhile("afterUpdate",{data:c,updatedCount:i.cache.elementCount,durationMs:Date.now()-d.receivedAt,revision:d.revision.revision,receivedAt:d.receivedAt,source:"route"},f))}"failed"===u?s.failed+=1:"refused"===u&&(s.refused+=1),void 0!==c&&this.host.reapply(d,c)}warnFragmentFallback(e){Di(this.deps,this.state,e)}warnUnsupportedStrategy(e){ji(this.deps,this.state,e)}patchFallback(e,t,n,r,i){if(i())for(const[o,s]of this.deps.cache.entries())for(const a of s){if(a.fragmentBoundary!==n)continue;if(!1!==r&&!ye(a.owner,r))continue;const s=ue(t.fields,a,o,e.locale);void 0!==s&&i()&&this.deps.scheduler.schedule({target:a,value:this.host.transform(a,s,t.fields,i),allFields:t.fields,revision:e.revision,data:t})}}};function Wi(e,t){return!1===t||ye(Jt(e),t)}function Hi(e,t,n,r,i){const o=e.transformValue;if(void 0===o)return n;try{const e=o(t.fieldName,n,{element:t.element,allFields:r},i),s=v(e);if(!i())return n;if(s)throw new TypeError(`Transform for "${t.fieldName}" returned a thenable; transforms must be synchronous`);return e}catch(t){if(!i())return n;const r=t instanceof Error?t:new Error(String(t));return e.emitter.emit("error",{error:r,context:"transform",code:"LP0602"}),n}}var qi=/* @__PURE__ */new Set,Vi={kind:"merge"},Gi=class{constructor(e,t,n){this.deps=e,this.state=t,t.changes.keepValues="declared"===e.subfieldCoverage,t.display.host=function(e,t){return{outstanding:n=>!n.completed||n.pendingFragments>0||null!==t.routeController||null!==t.routeRetry||e.scheduler.pendingCount>0,report:t=>{"partial"===t.state&&e.a11y?.announcePartial(),e.emitter.emit("revisionDisplay",t)},failed:t=>{e.log("revision display failed:",t)}}}(e,t),this.strategies="undefined"!=typeof __LEAN_BUILD__&&__LEAN_BUILD__?function(e,t){return{planFragments:()=>null,escalateUnfaithful:(e,n,r)=>{for(const{fieldName:n}of r)t.display.shortfall(e,{kind:"unfaithful",field:n})},hasUnboundChange:(n,r)=>{if(n.baseline)return!1;const i=Oe(e.cache,n.touched,n.locale,r,Me(e.subfieldCoverage,t.changes.previousFields,n.renderData?.fields));for(const e of i)Q(t,e),t.display.shortfall(n,{kind:"unbound",field:e});return!1},plansRoute:()=>!1,runFragments:()=>Promise.resolve(),refreshRoute:()=>($("route refreshes"),Promise.resolve()),refreshAfterSave:()=>{},warnFragmentFallback:n=>{$("server-rendered fragments"),Di(e,t,n)},warnUnsupportedStrategy:n=>{ji(e,t,n)}}}(e,t):new zi(e,t,{reapply:(e,t)=>{this.scheduleAllFields(e,t)},transform:(t,n,r,i)=>Hi(e,t,n,r,i),rebuildCache:n,restoreGuesses:(e,t)=>{this.restoreGuesses(e,t)},revealPending:e=>{this.revealPending(e)}}),this.navigationReplay=new yr(e,t,{schedule:(e,t,n)=>{this.scheduleAllFields(e,t,n)}})}deps;state;strategies;navigationReplay;handleUpdate(e,t,n){const{deps:r,state:i}=this;r.heartbeat.kick(),i.protocol.observe(function(e){const 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),r.log,r.warn);const o=e.data;void 0!==o?void 0!==n&&this.acceptDataUpdate(e,o,t,n,!0):void 0!==e.protocolVersion&&i.protocol.applyVersion(e.protocolVersion,r.log)}handleReplay(e,t,n){const r=e.data;void 0!==r&&this.acceptDataUpdate(e,r,t,n,!1)}reapplyNavigationBindings(e){this.navigationReplay.reapplyBindings(e)}reapplyNavigationIslands(e,t=!1){this.navigationReplay.reapplyIslands(e,t)}acceptDataUpdate(e,t,n,r,i){const{deps:o,state:s}=this,a=i?s.relationships.inspect(e):null,l="string"==typeof e.locale?e.locale:s.locale;let u=s.schema,d=s.schemaIndex;Array.isArray(e.fieldSchemaJSON)&&(u=e.fieldSchemaJSON,d=function(e,t=""){const n=/* @__PURE__ */new Map;return E(e,t,n,!1),E(e,t,n,!0),n}(e.fieldSchemaJSON));const c=s.activeUpdate;if(!s.isRunning()||null!==c&&c.revision.revision>r.revision)return;const f=null===a?null:s.relationships.commit(a),h=c,p={revision:r,message:e,rawData:t,locale:l,schema:u,schemaIndex:d,receivedAt:Date.now(),forceRender:null!==f||Ve(h),countsAsUpdate:i,renderData:void 0,fragmentBoundariesRun:/* @__PURE__ */new WeakSet,touched:/* @__PURE__ */new Set,baseline:!1,navigated:!1,invalidated:/* @__PURE__ */new Set,revealTarget:void 0,revealIdentities:[],pendingFragments:0,routeRefreshed:!1,cancelled:!1,completed:!1};if(s.locale=l,s.schema=u,s.schemaIndex=d,null!==h&&!h.completed&&h.countsAsUpdate&&(s.supersededCount+=1),s.activeUpdate=p,i&&(s.updateCount+=1),s.display.begin(p,r.revision),s.isCurrent(p)&&(o.scheduler.acceptRevision(r),s.isCurrent(p)&&(s.supersedeStrategies(),s.isCurrent(p)&&(null===f||(o.emitter.emitWhile("relationshipUpdate",{detail:f,timestamp:Date.now()},()=>s.isCurrent(p)),s.isCurrent(p)))&&(!i||void 0===e.protocolVersion||(s.protocol.applyVersion(e.protocolVersion,o.log),s.isCurrent(p)))))){if(i&&o.connection.markConnected()){if(o.a11y?.announceConnected(),o.emitter.emit("connect",{origin:n,timestamp:Date.now()}),!s.isCurrent(p))return;if(o.log("connection","disconnected","→","connected"),!s.isCurrent(p))return}this.processUpdate(p).catch(e=>{o.log("update failed:",e)})}}async processUpdate(e){const{deps:t,state:n}=this,r=await this.resolveIncomingFields(e);if(null===r||!n.isCurrent(e))return;const i=this.dataFor(e,r);t.emitter.listenerCount("beforeUpdate")>0&&(!await t.emitter.emitWhile("beforeUpdate",{data:i,revision:e.revision.revision,receivedAt:e.receivedAt,source:"patch",cancel:()=>{e.cancelled=!0,t.scheduler.cancelRevision(e.revision)}},()=>!e.cancelled&&n.isCurrent(e))||e.cancelled||!n.isCurrent(e))||this.applyFields(e,i,!1)}dataFor(e,t){const{message:n}=e;return{fields:t,...void 0!==e.schema?{schema:e.schema}:{},..."string"==typeof n.globalSlug?{globalSlug:n.globalSlug}:{},..."string"==typeof n.collectionSlug?{collectionSlug:n.collectionSlug}:{},...void 0!==e.locale?{locale:e.locale}:{}}}applyFields(e,t,n){const{deps:r,state:i}=this;if(!i.isCurrent(e))return;if(i.changes.isBaseline&&!n&&"off"!==r.autoBind){if("undefined"!=typeof __LEAN_BUILD__&&__LEAN_BUILD__)$("auto-binding");else{const n=vr(r,i,e,t.fields);!function(e,t,n,r,i,o){if(!o())return 0;const s=performance.now(),a=hr(e.root),l=or(n,r);if(!o())return 0;const u=null===a?[]:fr(a,l);if(!o())return 0;const d=gr(e,u,i,"on the first message",o);if(!o())return 0;const c=function(e,t){const n=/* @__PURE__ */new Set;for(const{fieldName:e,stamps:r}of t){n.add(e);for(const e of[$t,Nt]){const t=r[e];void 0!==t&&n.add(t)}}const r=/* @__PURE__ */new Map;for(const[t,i]of e)null!==i&&n.has(i.field)&&r.set(t,i);return{fields:n,values:r}}(l,d),f=performance.now()-s;o()&&(t.autoBindGuesses=c,t.autoBindSearchMs=f,d.length)}(r,i,t.fields,e.locale,n,()=>i.isCurrent(e))}if(!i.isCurrent(e))return}const o=st(r.dependencies,r.cache.dependencyMap());if(!i.isCurrent(e))return;const s=i.changes.diff(t.fields,o,()=>i.isCurrent(e));if(null===s)return;const a=!n&&i.navigationReplayPending;a&&(i.navigationReplayPending=!1,i.navigationBindingReplay=!0),e.baseline=s.baseline&&!a,e.navigated=a,e.invalidated=n?qi:s.invalidated,e.touched=n?qi:/* @__PURE__ */new Set([...s.changed,...s.invalidated]),e.renderData=t,this.scheduleAllFields(e,t)}async resolveIncomingFields(e){const{deps:t,state:n}=this,r=e.rawData;if(null===t.merger)return r;const i=n.merges.decide(t,e);if(!i.merge)return i.fields;const{message:o}=e,s=n.merges.request(t.merger,t.mergeWindowMs,{collectionSlug:o.collectionSlug,globalSlug:o.globalSlug,data:r,...void 0===e.schema?{}:{schema:e.schema},locale:e.locale});if(!s.leading)return this.applyMerged(e,s.result).catch(e=>{t.log("update failed:",e)}),i.fields;const a=await s.result;return n.isCurrent(e)?"merged"===a.status?(n.merges.recordMerged(a.doc,e.locale),a.doc):"superseded"===a.status?null:(n.display.shortfall(e,Vi),i.fields):null}async applyMerged(e,t){const{state:n}=this,r=await t;"unavailable"===r.status&&n.display.shortfall(e,Vi),"merged"===r.status&&n.isCurrent(e)&&(n.merges.recordMerged(r.doc,e.locale),this.applyFields(e,this.dataFor(e,r.doc),!0))}scheduleAllFields(e,t,n){const{deps:r,state:i}=this;if(!i.isCurrent(e))return;const o=void 0!==n,s=()=>i.isCurrent(e),a=vr(r,i,e,t.fields);if(!s())return;const{touched:l}=e,u=r.strategies.route;if(o&&void 0!==u&&!e.routeRefreshed&&this.navigationReplay.hasLateRouteBinding(n,a,e,t))return void(s()&&this.strategies.refreshRoute(e,t,u));const d=!o&&this.strategies.hasUnboundChange(e,a),c=i.routeRefreshOwed;if(!o&&void 0!==u&&!e.routeRefreshed&&(d||c||this.strategies.plansRoute(u,e,a))&&s())return i.routeRefreshOwed=!1,void this.strategies.refreshRoute(e,t,u);const f=o?this.navigationReplay.fieldsForElements(n,l):l,h=this.navigationReplay.unrunFragmentPlan(e,this.strategies.planFragments(f,a),n);if(!s())return;const p=r.skipUnchanged;let g=0;for(const[l,u]of r.cache.entries()){if(!s())return;for(const d of u){if(void 0!==n&&!n.has(d.element))continue;if(!1!==a&&!ye(d.owner,a))continue;if(!0===h?.covers(d)){if(r.revealEditedField){const n=ue(t.fields,d,l,e.locale);i.revealLedger.note(e,d,n)}continue}const u=d.strategyKind??ge(d.element)??"unknown";if("unknown"===u){this.strategies.warnUnsupportedStrategy(d);continue}"fragment"===u&&null===h&&this.strategies.warnFragmentFallback(d);const c=ue(t.fields,d,l,e.locale);if(void 0===c){i.absentFields.add(l);continue}if(mr(r,i,d,t.fields,e.navigated),!o&&r.revealEditedField&&i.revealLedger.note(e,d,c),!s())return;const f=Hi(r,d,c,t.fields,s);if(!s())return;const m=p?de(d,f,t.fields,e.locale):void 0,v=i.lastAppliedIdentity.get(d.element);if(!e.forceRender&&r.skipUnchanged&&void 0!==m&&v===m&&!e.invalidated.has(l)){i.skippedUnchangedCount+=1;continue}const y={target:d,value:f,allFields:t.fields,revision:e.revision,...o?{}:{data:t},valueIdentity:m};r.scheduler.schedule(y),g+=1}}if(o||function(e,t,n,r,i){const{cache:o,strategies:s}=e,a={warned:t,warn:e.warn};if(0===o.fieldCount)return;if(!1!==i&&!function(e,t){for(const n of e.values())if(ye(n.owner,t))return!0;return!1}(o,i))return;const l=function(e,t,n,r){const i=xe(e,t,n,Ne(e,n,r));return e=>"none"!==i(e)}(o,r,i,s);for(const[e,t]of Object.entries(n)){if(Le.has(e))continue;if(Ar(t)){Sr(a,l,e,r,t);continue}if(!Tr(t)||l(e)||kr(t))continue;const n=Pe(e,r);for(const[e,i]of Object.entries(t))Ar(i)&&!Le.has(e)&&Sr(a,l,`${n}.${e}`,r,i)}if("declared"!==e.subfieldCoverage)return void function(e,t,n,r,i){if("undefined"!=typeof __LEAN_BUILD__&&__LEAN_BUILD__)return;if(!e.coverageByDefault||t.has(wr)||!isDevMode())return;t.add(wr);const[o]=Ee(e.cache,n,r,i,e.strategies);void 0!==o&&e.warn(`[live-preview] LP0204: no binding names "${o.path}", and a binding elsewhere in its group covers it, so an edit there changes nothing on the page. 3.0 makes subfieldCoverage: 'declared' the default, where it refreshes the route. Set the option to choose now.`)}(e,t,n,r,i);const u=Ee(o,n,r,i,s);for(const{path:e,value:t}of u)if(Ar(t)&&Sr(a,l,e,r,t),Tr(t)&&!kr(t))for(const[n,i]of Object.entries(t))Ar(i)&&Sr(a,l,`${e}.${n}`,r,i)}(r,i.warnedOrphanFields,e.rawData,e.locale,a),s()){if(null!==h&&h.boundaries.length>0){for(const t of h.boundaries)e.fragmentBoundariesRun.add(t);e.pendingFragments+=h.boundaries.length,this.strategies.runFragments(e,t,h)}!o&&s()&&0===g&&(0===e.pendingFragments&&0===r.scheduler.pendingCount&&(i.complete(e),this.revealPending(e)),this.notifyIslands(e,t))}}notifyIslands(e,t){0!==e.touched.size&&this.navigationReplay.dispatchIslands(e,t,this.deps.cache.islands)}restoreGuesses(e,t){const{deps:n,state:r}=this;if("off"!==n.autoBind&&null!==r.autoBindGuesses&&("undefined"==typeof __LEAN_BUILD__||!__LEAN_BUILD__)){const i=vr(n,r,e,t.fields);!function(e,t,n,r,i,o){if(!o())return 0;const s=t.autoBindGuesses,a=hr(e.root);if(null===s||0===s.fields.size||null===a)return 0;const l=new Map(s.values);for(const[e,t]of or(n,r)){if(null===t||!s.fields.has(t.field))continue;const n=l.get(e);void 0===n?l.set(e,t):n?.field!==t.field&&l.set(e,null)}if(!o())return 0;const u=fr(a,l);o()&&gr(e,u,i,"after a server render",o).length}(n,r,t.fields,e.locale,i,()=>r.isCurrent(e))}}onFlush(e){const{deps:t,state:n}=this;n.lastFlush=e,e.deferred>0&&!n.warnedVisibilityGate&&(n.warnedVisibilityGate=!0,t.warn(`[live-preview] LP0301: visibility gate held ${String(e.deferred)} off-screen update(s) until scrolled into view; see visibilityGateThreshold`));const{revision:r,data:i}=e;if(void 0===r)return;const o=n.activeUpdate;if(null===o||!n.isCurrent(o)||!y(o.revision,r))return;n.display.deferred(o,e.deferred),0===o.pendingFragments&&n.complete(o);const s=()=>n.isCurrent(o)&&y(o.revision,r),a=i??o.renderData;if(this.revealPending(o),!s())return;const l=n.unfaithfulPatches;if(l.length>0){if(n.unfaithfulPatches=[],void 0!==a){const e=vr(t,n,o,a.fields);this.strategies.escalateUnfaithful(o,a,l,e)}if(!s())return}void 0!==i&&(e.applied>0&&t.a11y?.announceUpdate(e.applied),s()&&(this.notifyIslands(o,i),s()&&0!==e.applied&&0!==t.emitter.listenerCount("afterUpdate")&&t.emitter.emitWhile("afterUpdate",{data:i,updatedCount:e.applied,durationMs:e.durationMs,revision:r.revision,receivedAt:o.receivedAt,source:"patch"},s)))}revealPending(e){const t=this.state.revealLedger.commit(e);if(void 0!==t)try{Xe(this.state.revealer,t)}catch(e){this.deps.log("reveal",e)}}revealField(e){const t=this.deps.cache.get(e)?.[0];return void 0===t?"no-element":Xe(this.state.revealer,t)}documentSaved(){this.strategies.refreshAfterSave()}},Ji=class{apply;debounceMs;maxWaitMs;isVisible;gateThresholdValue;gateDisabled;getCacheSize;onFlush;scheduleFrame;cancelFrame;pending=/* @__PURE__ */new Map;replay=/* @__PURE__ */new Map;activeFlushes=/* @__PURE__ */new Set;debounceTimer=null;debounceToken=0;deadlineTimer=null;frameHandle=null;frameFallback=null;frameToken=0;windowUntil=0;activeRevision=null;activeRevisionCancelled=!1;destroying=!1;constructor(e,t){this.apply=e,this.debounceMs=t.debounceMs??50,this.maxWaitMs=t.maxWaitMs??4*this.debounceMs,this.isVisible=t.isVisible,this.gateThresholdValue=t.visibilityGateThreshold??50,this.gateDisabled=t.disableVisibilityGate??!1,this.getCacheSize=t.getCacheSize,this.onFlush=t.onFlush,this.scheduleFrame=t.scheduleFrame??("function"==typeof requestAnimationFrame?requestAnimationFrame.bind(globalThis):e=>setTimeout(()=>{e(performance.now())},0)),this.cancelFrame=t.cancelFrame??("function"==typeof cancelAnimationFrame?cancelAnimationFrame.bind(globalThis):e=>{clearTimeout(e)})}schedule(e){if(this.destroying)return;if(void 0!==e.revision){if(this.activeRevisionCancelled)return;if(null===this.activeRevision||!y(e.revision,this.activeRevision))return}const 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){var t,n;this.destroying||null!==this.activeRevision&&y(e,this.activeRevision)||null!==this.activeRevision&&(t=e,n=this.activeRevision,(t.generation!==n.generation?t.generation-n.generation:t.revision-n.revision)<0)||(this.clearWork(),this.activeRevision=e,this.activeRevisionCancelled=!1,this.cancelScheduledWork())}cancelRevision(e){null!==this.activeRevision&&y(e,this.activeRevision)&&(this.clearWork(),this.activeRevisionCancelled=!0,this.cancelScheduledWork())}flushNow(){return this.cancelScheduledWork(),this.flush()}notifyVisible(e){const t=this.replay.get(e);if(!t)return;if(this.replay.delete(e),!this.isCurrent(t))return;const n=performance.now(),r=this.didApply(t)?1:0;this.onFlush?.(this.statsFor(t,r,0,performance.now()-n,1===r?[t.target.fieldName]:[]))}retarget(e){this.retargetBuffer(this.pending,e),this.retargetBuffer(this.replay,e);for(const t of this.activeFlushes)this.retargetBuffer(t,e)}forget(e){this.pending.delete(e),this.replay.delete(e);for(const t of this.activeFlushes)t.delete(e)}destroy(){if(!this.destroying){this.destroying=!0;try{this.clearWork(),this.activeRevision=null,this.activeRevisionCancelled=!1,this.windowUntil=0,this.cancelScheduledWork()}finally{this.destroying=!1}}}get pendingCount(){return this.pending.size}get replayCount(){return this.replay.size}get gateThreshold(){return this.gateThresholdValue}get gateActive(){return!this.gateDisabled&&this.getCacheSize()>this.gateThresholdValue}armDebounce(){const e=Date.now(),t=e>=this.windowUntil;if(this.windowUntil=e+this.debounceMs,t)return void this.requestFrame();const n=this.debounceToken+=1,r=this.debounceTimer;if(this.debounceTimer=null,null!==r&&clearTimeout(r),this.debounceToken!==n)return;const i=setTimeout(()=>{this.debounceToken===n&&(this.debounceTimer=null,this.pending.size>0&&this.requestFrame())},this.debounceMs);this.debounceToken===n&&(this.debounceTimer=i),null===this.deadlineTimer&&this.maxWaitMs>this.debounceMs&&(this.deadlineTimer=setTimeout(()=>{this.deadlineTimer=null,this.pending.size>0&&this.requestFrame()},this.maxWaitMs))}requestFrame(){const e=this.frameToken+=1,t=this.frameHandle;if(this.frameHandle=null,this.clearFrameFallback(),null!==t&&this.cancelFrame(t),this.frameToken!==e)return;let n=!1;const r=()=>{if(this.frameToken!==e||n)return;n=!0;const t=this.frameHandle;this.frameHandle=null,this.clearFrameFallback(),null!==t&&this.cancelFrame(t),this.flush()},i=this.scheduleFrame(r);n||this.frameToken!==e||(this.frameHandle=i,this.frameFallback=setTimeout(r,100))}clearFrameFallback(){clearTimeout(this.frameFallback??void 0),this.frameFallback=null}flush(){const e=performance.now();this.clearDeadline();const t=this.gateActive,n=this.pending;this.pending=/* @__PURE__ */new Map;let r=0;const i=[];let o,s=0;this.activeFlushes.add(n);try{for(const e of n.values()){if(!this.isCurrent(e))continue;const n=!t||this.isVisible(e.target.element)||Ki(e.target);this.isCurrent(e)&&(o??=e,n?(this.replay.delete(e.target.element),this.didApply(e)&&(r+=1,i.push(e.target.fieldName))):(this.replay.set(e.target.element,e),s+=1))}}finally{this.activeFlushes.delete(n)}const a=this.statsFor(o,r,s,performance.now()-e,i);return this.onFlush?.(a),a}isCurrent(e){return void 0===e.revision||!this.activeRevisionCancelled&&null!==this.activeRevision&&y(e.revision,this.activeRevision)}didApply(e){return!1!==this.apply(e)||(t=this.apply,!ne.has(t));var t}retargetBuffer(e,t){const n=e.get(t.element);void 0!==n&&(Zt(n.target,t)?n.target=t:e.delete(t.element))}clearWork(){this.pending.clear(),this.replay.clear();for(const e of this.activeFlushes)e.clear()}statsFor(e,t,n,r,i){return{applied:t,appliedFields:i,deferred:n,durationMs:r,...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(){const e=this.debounceTimer,t=this.frameHandle;this.debounceToken+=1,this.frameToken+=1,this.debounceTimer=null,this.frameHandle=null,this.clearDeadline(),this.clearFrameFallback(),null!==e&&clearTimeout(e),null!==t&&this.cancelFrame(t)}};function Ki(e){if(!0!==e.hidesWhenEmpty)return!1;const{element:t}=e;if(t.hasAttribute("hidden"))return!0;const n=t.getBoundingClientRect();return 0===n.width||0===n.height}var Xi=[0,500,1e3,2e3],Qi=class{deps;state=new tt;pipeline;writer;rootSentinel=null;scope=null;closingSession=!1;observedRoot=null;replayRetainedOnStart=!1;constructor(e){const{emitter:t,renderers:n}=e,r=void 0===e.log?S:w(e.log),i=void 0===e.warn?k:w(e.warn),o=e.root??("undefined"!=typeof document?document:void 0);if(void 0===o)throw new Error("LivePreviewRuntime: no document; pass options.root");const s=new Yt({filter:e=>!isInsideIsland(e)}),a=new Nn({onStructuralChange:()=>{this.rebuildCache()},onIslandHydrated:e=>{this.pipeline.reapplyNavigationIslands([e],!0)},onVisibilityChange:(e,t)=>{t&&l.notifyVisible(e)}},void 0!==e.intersectionRootMargin?{intersectionRootMargin:e.intersectionRootMargin}:{}),l=new Ji(re(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=>a.isVisible(e),getCacheSize:()=>s.elementCount,onFlush:e=>{this.pipeline.onFlush(e)}}),u=new b(e.originMatcher,{onUpdate:(e,t,n)=>{this.pipeline.handleUpdate(e,t,n)},onReplay:(e,t,n)=>{this.pipeline.handleReplay(e,t,n)},onDocumentEvent:()=>{this.state.protocol.observe(["document-events"],r,i),t.emit("documentSave",{timestamp:Date.now()}),this.pipeline.documentSaved()},onFocusField:e=>{this.deps.revealEditedField&&this.pipeline.revealField(e)},onInvalid:(e,n)=>{if("token"===e){const e=new Error(`Preview token rejected (origin: ${n})`);t.emit("error",{error:e,context:"token",code:"LP0502"})}"shape"!==e&&"type"!==e||this.state.warnedProtocolShape||(this.state.warnedProtocolShape=!0,i(`[live-preview] LP0503: ${n} 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,i(`[live-preview] LP0501: a message from ${n} 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.`)),r("LP0501 message rejected:",e,n)},...void 0!==e.validateToken?{validateToken:e.validateToken}:{},...void 0!==e.eventSourcePolicy?{sourcePolicy:e.eventSourcePolicy}:{}}),d=e.dataMerge;this.deps={emitter:t,cache:s,observers:a,scheduler:l,bus:u,connection:new Qn,heartbeat:new Xn({...void 0!==e.heartbeatMs?{timeoutMs:e.heartbeatMs}:{},onTimeout:()=>{this.onHeartbeatTimeout()}}),renderers:n,resolveRenderer:e.resolveRenderer??(e=>n[e]),transformValue:e.transformValue,renderRichText:e.renderRichText,internalLinkPattern:e.internalLinkPattern,routeAfterSave:!0===e.routeAfterSave,sanitizerPolicy:e.sanitizerPolicy,root:o,readyTargets:"function"==typeof e.readyTargets?e.readyTargets:/* @__PURE__ */(e=>()=>e)(e.readyTargets),sendReady:e.sendReady??N,onHeartbeatTimeout:e.onHeartbeatTimeout,log:r,warn:i,a11y:L(e),serverURL:d?.serverURL,merger:void 0===d?null:new An({...d,log:r}),mergeWindowMs:e.debounceMs??50,scopeBindingsByOwner:!0===e.scopeBindingsByOwner,subfieldCoverage:e.subfieldCoverage??"descendant",coverageByDefault:void 0===e.subfieldCoverage,lockedOrigin:e.lockedOrigin??(()=>{}),skipUnchanged:!0===e.skipUnchanged,dependencies:e.dependencies??{},strategies:e.strategies??{},revealEditedField:!0===e.revealEditedField,onUnfaithfulPatch:K(e),autoBind:e.autoBind??"off",hydration:e.hydration},this.writer=new nt(this.deps,this.state),this.pipeline=new Gi(this.deps,this.state,()=>{this.rebuildCache()})}start(){const{state:e}=this;if(e.isRunning()||this.closingSession)return!1;e.suspended&&(this.replayRetainedOnStart=!0),e.started=!0,e.suspended=!1,this.openScope();try{return function(e){"react"===e.hydration?Fn():"vue"===e.hydration&&zn();const{root:t}=e;if(!Jn(t)||"loading"!==t.readyState)return void Hn(e);const n=()=>{e.isRunning()&&e.later(()=>{Hn(e)})};t.addEventListener("DOMContentLoaded",n,{once:!0}),e.defer(()=>{t.removeEventListener("DOMContentLoaded",n)})}(this.startupHost()),!0}catch(e){throw this.rollbackFailedStart(),e}}startupHost(){const{state:e,deps:t}=this;return{root:t.root,hydration:t.hydration,isRunning:()=>e.isRunning(),defer:t=>{e.deferredStart=t,this.scope?.own(()=>{e.deferredStart===t&&(e.deferredStart=null,t())})},later:t=>{e.deferredStart=null;try{t()}catch(e){this.rollbackFailedStart(),this.reportError(e,"startup","LP0605")}},hydrated:t=>{e.hydration=t},warn:t.warn,startNow:()=>{this.startNow()}}}startNow(){const{state:e,deps:t}=this;if(!e.isRunning())return;const n=Jn(t.root)?Kn(t.root):t.root;if(null===n)throw new Error("LivePreviewRuntime: document.body unavailable");if(t.observers.start(n),this.observedRoot=n,this.watchRootReplacement(),this.buildCacheAndObserve(),!e.isRunning())return;if(t.bus.attach(),t.emitter.emitWhile("init",{timestamp:Date.now()},()=>e.isRunning()),!e.isRunning())return;const r=this.replayRetainedOnStart;this.replayRetainedOnStart=!1;const i=r&&t.heartbeat.resume();if(e.isRunning()&&(!r||i||(e.forgetOwedWork(),e.merges.resetRawChanges(),e.unfaithfulPatches=[],e.revealer.reset(),e.lastAppliedIdentity=/* @__PURE__ */new WeakMap,e.changes.reset(),e.navigationReplayPending=!0,t.bus.replayLastAccepted()||(e.navigationReplayPending=!1),e.isRunning())))for(const n of Xi){if(!e.isRunning())return;0===n?t.sendReady(t.readyTargets()):e.readyTimers.push(setTimeout(()=>{e.isRunning()&&this.sendReadyAfterStart()},n))}}suspend(){if(!this.state.isRunning())return!1;const e=this.release();return this.state.suspended=!0,e&&this.deps.emitter.emit("disconnect",{reason:"unload",timestamp:Date.now()}),!0}destroy(){const{state:e,deps:t}=this;if(!e.isRunning()&&!e.suspended)return;const n=!!e.isRunning()&&this.release();e.suspended=!1,this.replayRetainedOnStart=!1,t.bus.forgetLastAccepted(),n&&t.emitter.emit("disconnect",{reason:"destroy",timestamp:Date.now()}),t.a11y?.detach(),t.emitter.emit("destroy",{timestamp:Date.now()})}openScope(){const{state:e,deps:t}=this,n=new En(t.log);n.own(()=>{t.merger?.destroy(),e.merges.destroy()}),n.own(()=>{t.scheduler.destroy()}),n.own(()=>{t.observers.stop()}),n.own(()=>{this.rootSentinel?.disconnect(),this.rootSentinel=null,this.observedRoot=null}),n.own(()=>{e.abortStrategies()}),n.own(()=>{t.bus.detach()}),n.own(()=>{t.heartbeat.stop()}),n.own(()=>{for(const t of e.readyTimers)clearTimeout(t);e.readyTimers.length=0}),this.scope=n}release(){const{state:e,deps:t}=this;e.display.end(),e.activeUpdate=null,e.navigationBindingReplay=!1,e.started=!1;const n=this.scope;this.scope=null,this.closingSession=!0;try{n?.close()}finally{this.closingSession=!1}return t.cache.clear(),t.connection.markDisconnected()}rollbackFailedStart(){this.release();try{this.deps.a11y?.detach()}catch(e){this.deps.log("runtime cleanup failed:",e)}}refreshCache(){this.state.isRunning()&&(this.state.revealer.reset(),this.followReplacedRoot()||this.rebuildCache())}navigationCommit(){const{state:e,deps:t}=this;e.isRunning()&&null===e.deferredStart&&(this.cancelActiveUpdate(!0),t.merger?.destroy(),e.merges.destroy(),e.abortStrategies(),this.cancelActiveUpdate(!0),e.forgetOwedWork(),e.merges.resetRawChanges(),e.unfaithfulPatches=[],e.revealer.reset(),e.lastAppliedIdentity=/* @__PURE__ */new WeakMap,e.changes.reset(),e.isRunning()&&(t.bus.advanceGeneration(),e.navigationReplayPending=!0,this.followReplacedRoot()||this.rebuildCache(),e.isRunning()&&(t.bus.replayLastAccepted(),e.isRunning()&&this.sendReadyAfterStart())))}watchRootReplacement(){const{root:e}=this.deps;Jn(e)&&"undefined"!=typeof MutationObserver&&(this.rootSentinel?.disconnect(),this.rootSentinel=new MutationObserver(()=>{this.followReplacedRoot()}),this.rootSentinel.observe(e.documentElement,{childList:!0}))}followReplacedRoot(){const{root:e}=this.deps;if(!this.state.isRunning()||!Jn(e))return!1;const t=Kn(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(t,n){const{cache:r,scheduler:i}=t,o=n.protocol.negotiation,s=n.activeUpdate,a=n.lastFlush,l=[],u=/* @__PURE__ */new Set,d=[];for(const[e,t]of r.entries()){l.push(e);for(const n of t)void 0!==n.owner&&u.add(n.owner),void 0!==n.guessed&&d.push({field:e,matched:n.guessed,attribute:n.targetAttribute??("IMG"===n.element.tagName?"src":void 0)})}return{version:e,started:n.started,status:t.connection.status,origins:{trusted:[...t.readyTargets()],locked:t.lockedOrigin()},protocol:{ours:o.ours,theirs:o.theirs,negotiated:o.negotiated,capabilities:[...o.capabilities].sort(),observed:[...o.observed].sort(),profile:detectProtocolProfile(o.observed).name},revisions:{accepted:n.updateCount,superseded:n.supersededCount,completed:n.completedCount,skippedUnchanged:n.skippedUnchangedCount,active:null===s?void 0:s.revision.revision,display:n.display.snapshot()},bindings:{elements:r.elementCount,fields:r.fieldCount,fieldNames:l.sort(),absentFields:[...n.absentFields].sort(),orphanFields:[...n.warnedOrphanFields].sort(),ownerScoped:t.scopeBindingsByOwner,owners:[...u].sort(),guessed:d.sort((e,t)=>e.field.localeCompare(t.field)),autoBind:{mode:t.autoBind,searchMs:n.autoBindSearchMs}},route:{handler:void 0!==t.strategies.route,...n.routeStats},fidelity:{mode:t.onUnfaithfulPatch,canEscalate:void 0!==t.strategies.fragment||void 0!==t.strategies.route,unfaithful:n.unfaithfulCount,escalated:n.escalatedCount,fields:[...n.unfaithfulFields].sort()},hydration:{mode:t.hydration??"off",state:n.hydration},fragments:{handler:void 0!==t.strategies.fragment,inFlight:s?.pendingFragments??0,...n.fragmentStats},scheduler:{pending:i.pendingCount,deferred:i.replayCount,visibilityGateThreshold:i.gateThreshold,visibilityGateActive:i.gateActive,lastFlush:null===a?void 0:{applied:a.applied,appliedFields:a.appliedFields,deferred:a.deferred,durationMs:a.durationMs}},plugins:[],renderers:Object.keys(t.renderers).sort()}}(this.deps,this.state)}buildCacheAndObserve(){const{state:e,deps:t}=this;if(!e.isRunning())return;const n=t.cache.buildFromRoot(t.root);if(t.log("cache",n),e.isRunning()&&(t.emitter.emitWhile("cacheRefresh",n,()=>e.isRunning()),e.isRunning()))for(const n of t.cache.values()){if(!e.isRunning())return;t.observers.observeElement(n.element)}}rebuildCache(){const{state:e,deps:t}=this;if(!e.isRunning())return;const n=/* @__PURE__ */new Map,r=t.cache.islandOwners,i=new Set(t.cache.navigationReplayRoots);for(const e of t.cache.values())n.set(e.element,e),t.observers.unobserveElement(e.element);if(this.buildCacheAndObserve(),!e.isRunning())return;const o=new Set(t.cache.navigationReplayRoots.filter(e=>!i.has(e)));for(const e of t.cache.values()){const r=n.get(e.element);void 0!==r&&Zt(r,e)?t.scheduler.retarget(e):(t.scheduler.forget(e.element),o.add(e.element)),n.delete(e.element)}for(const e of n.values())t.scheduler.forget(e.element);o.size>0&&this.pipeline.reapplyNavigationBindings(o);const s=t.cache.islands.filter(e=>!r.has(e)||t.scopeBindingsByOwner&&r.get(e)!==t.cache.islandOwners.get(e));s.length>0&&this.pipeline.reapplyNavigationIslands(s)}onHeartbeatTimeout(){const{state:e,deps:t}=this;if(!e.isRunning())return;if(this.cancelActiveUpdate(!1),t.merger?.destroy(),e.merges.destroy(),e.abortStrategies(),this.cancelActiveUpdate(!1),!e.isRunning())return;t.bus.advanceGeneration(),t.bus.forgetLastAccepted(),e.navigationBindingReplay=!1;const n=t.connection.markDisconnected();try{t.onHeartbeatTimeout?.()}catch(e){t.log("heartbeat:",e)}if(e.isRunning()){if(n&&this.isIdleDisconnected()){if(t.a11y?.announceDisconnected(),t.emitter.emitWhile("disconnect",{reason:"timeout",timestamp:Date.now()},()=>this.isIdleDisconnected()),!e.isRunning())return;if(this.isIdleDisconnected()&&t.log("connection","connected","→","disconnected"),!e.isRunning())return}this.sendReadyAfterStart()}}cancelActiveUpdate(e){const{state:t,deps:n}=this,r=t.activeUpdate;t.display.end(),t.activeUpdate=null,null!==r&&(r.cancelled=!0,n.scheduler.cancelRevision(r.revision),e&&!r.completed&&r.countsAsUpdate&&(t.supersededCount+=1))}sendReadyAfterStart(){try{this.deps.sendReady(this.deps.readyTargets())}catch(e){this.reportError(e,"ready","LP0606")}}reportError(e,t,n){const r=e instanceof Error?e:new Error(String(e));this.deps.emitter.emit("error",{error:r,context:t,code:n})}isIdleDisconnected(){return this.state.isRunning()&&"disconnected"===this.deps.connection.status&&null===this.state.activeUpdate}},EventEmitter=class{#o=/* @__PURE__ */new Map;#s=/* @__PURE__ */new Map;on(e,t){return this.#a(this.#o,e,t)}once(e,t){return this.#a(this.#s,e,t)}off(e,t){this.#l(this.#o,e,t),this.#l(this.#s,e,t)}async emit(e,t){await this.#u(e,t)}async emitWhile(e,t,n){return this.#u(e,t,n)}async#u(e,t,n){const r=()=>n?.()??!0;if(!r())return!1;const i=this.#o.get(e);if(i)for(const n of[...i]){if(!r())return!1;if(await this.#d(n,t,e),!r())return!1}if(!r())return!1;const o=this.#s.get(e);if(o&&o.size>0){const n=[...o];this.#s.delete(e);for(const i of n){if(!r())return!1;if(await this.#d(i,t,e),!r())return!1}}return r()}listenerCount(e){return(this.#o.get(e)?.size??0)+(this.#s.get(e)?.size??0)}removeAllListeners(e){if(void 0===e)return this.#o.clear(),void this.#s.clear();this.#o.delete(e),this.#s.delete(e)}eventNames(){const e=/* @__PURE__ */new Set;for(const t of this.#o.keys())e.add(t);for(const t of this.#s.keys())e.add(t);return[...e]}#a(e,t,n){let r=e.get(t);return r||(r=/* @__PURE__ */new Set,e.set(t,r)),r.add(n),()=>{this.#l(e,t,n)}}#l(e,t,n){const r=e.get(t);void 0!==r&&(r.delete(n),0===r.size&&e.delete(t))}async#d(e,t,n){try{await e(t)}catch(e){const t="string"==typeof n||"number"==typeof n?String(n):"<event>";A(`[live-preview] LP0601: handler for "${t}" threw:`,e)}}},Zi=/^https?:\/\/(localhost|127\.0\.0\.1)(?::\d+)?$/i,Yi=/^https?:\/\/[^/?#\s]+$/i,eo=[3e3,3001,3333,4e3,4321,5e3,5173,5174,8e3,8080,8888,9e3];function to(){if("undefined"==typeof location)return;const e=location.ancestorOrigins;return e?.[0]}var OriginDetector=class{#c;constructor(e={}){const t=/* @__PURE__ */new Set;for(const n of e.additionalOrigins??[]){const e=no(n);void 0!==e&&t.add(e)}let n;if(e.enableReferrerDetection??1){const t=e.referrer??("undefined"!=typeof document?document.referrer:"");if(t.length>0)try{const e=new URL(t).origin;e&&"null"!==e&&(n=e)}catch{}}const r=(e.enableLocalhostMatching??!0)&&(e.forceDevMode??isDevMode());this.#c=[t,n,r,void 0!==n,void 0,to()]}matches(e){return 0!==e.length&&"null"!==e&&(void 0!==this.#c[4]?e===this.#c[4]:!!this.#c[0].has(e)||0===this.#c[0].size&&void 0!==this.#c[1]&&e===this.#c[1]||!(!this.#c[2]||!Zi.test(e)))}lockOrigin(e){return!!this.matches(e)&&(this.#c[4]=e,!0)}unlockOrigin(){const e=this.#c[4];return this.#c[4]=void 0,e}get lockedOrigin(){return this.#c[4]}enumerate(){if(void 0!==this.#c[4])return[this.#c[4]];const e=new Set(this.#c[0]);0===this.#c[0].size&&void 0!==this.#c[1]&&e.add(this.#c[1]);const t=this.#c[5];if(this.#c[2]&&void 0!==t)Zi.test(t)&&e.add(t);else if(this.#c[2])for(const t of eo)e.add(`http://localhost:${String(t)}`),e.add(`http://127.0.0.1:${String(t)}`);return[...e]}get referrerWasAvailable(){return this.#c[3]}get isProductionUnconfigured(){return!(!isInIframe()||this.#c[0].size>0||this.#c[2]||void 0!==this.#c[1])}get isReferrerOnlyTrust(){return!(this.#c[0].size>0||this.#c[2]||void 0===this.#c[1])}};function no(e){const t=e.trim();if(0!==t.length)try{const e=new URL(t);if("http:"!==e.protocol&&"https:"!==e.protocol)return;if(!Yi.test(e.origin))return;return e.origin}catch{return}}var ro=()=>{},io=class{#f;#n;#h=/* @__PURE__ */new Set;#c="staging";constructor(e,t){this.#f=e,this.#n=t}assertOpen(){if("closed"===this.#c)throw new Error(`Plugin context for "${this.#f}" is no longer active`)}get active(){return"active"===this.#c}eligible(){return"closed"!==this.#c}own(e){return this.assertOpen(),this.#p({kind:"cleanup",acquire:void 0,finalize:void 0,cleanup:e,disposed:!1})}stage(e,t,n){this.assertOpen();const r={kind:e,acquire:t,finalize:n,cleanup:void 0,disposed:!1},i=this.#p(r);if("active"===this.#c)try{this.#g(r)}catch(e){throw this.#m(r),e}return i}counts(){const e={transform:0,renderer:0,subscription:0,cleanup:0};for(const t of this.#h)e[t.kind]+=1;return e}commit(){if("staging"!==this.#c)throw new Error(`Plugin context for "${this.#f}" cannot be committed`);this.#c="committing";try{for(const e of this.#h)this.#g(e);this.#c="active"}catch(e){throw this.close(),e}}close(){if("closed"!==this.#c){this.#c="closed";for(const e of[...this.#h].reverse())this.#m(e);this.#h.clear()}}#p(e){return this.#h.add(e),()=>{this.#m(e)}}#g(e){if(e.disposed||void 0!==e.cleanup||void 0===e.acquire)return;const t=e.acquire();e.cleanup=t??ro}#m(e){if(e.disposed)return;e.disposed=!0,this.#h.delete(e);const t=e.cleanup;if(e.cleanup=void 0,void 0!==t)try{v(t())&&this.#n(`plugin "${this.#f}" cleanup returned a Promise/thenable; cleanups must be synchronous`)}catch(e){this.#n(`plugin "${this.#f}" cleanup failed:`,e)}try{e.finalize?.()}catch(e){this.#n(`plugin "${this.#f}" cleanup failed:`,e)}}},oo=class{#v;#y;#b=/* @__PURE__ */new Set;constructor(e,t){this.#v=e,this.#y=t}on(e,t){return this.#w("on",e,t)}once(e,t){return this.#w("once",e,t)}off(e,t){const n=t;for(const t of[...this.#b])t.event===e&&t.handler===n&&t.dispose()}emit(e,t){return this.#y.assertOpen(),this.#v.emit(e,t)}emitWhile(e,t,n){return this.#y.assertOpen(),this.#v.emitWhile(e,t,()=>{if(!this.#y.eligible())return!1;const e=n();return!!this.#y.eligible()&&e})}listenerCount(e){let t=0;for(const n of this.#b)n.event===e&&(t+=1);return t}removeAllListeners(e){for(const t of[...this.#b])void 0!==e&&t.event!==e||t.dispose()}eventNames(){const e=/* @__PURE__ */new Set;for(const t of this.#b)e.add(t.event);return[...e]}#w(e,t,n){this.#y.assertOpen();const r=n,i=[...this.#b].find(n=>n.kind===e&&n.event===t&&n.handler===r);if(void 0!==i)return i.dispose;let o=ro,s=!0;const a=async t=>{this.#y.active&&s&&("once"===e&&o(),await n(t))},l={kind:e,event:t,handler:r,dispose:ro};return o=this.#y.stage("subscription",()=>this.#v[e](t,a),()=>{s=!1,this.#b.delete(l)}),l.dispose=o,this.#b.add(l),o}},so=class{#v;#S;#A;#k;#n;#T=/* @__PURE__ */new Map;#C=/* @__PURE__ */new Map;#R=/* @__PURE__ */new Map;#$=/* @__PURE__ */new Set;#L=/* @__PURE__ */new Map;#N=Promise.resolve();#P=0;constructor(e){this.#v=e.events,this.#S=e.config,this.#A=e.registerFieldRenderer,this.#n=w(e.log);const t=e.onTransformError;this.#k=void 0===t?void 0:w((...e)=>{const n=e[0];try{return t(n)}catch(e){return void this.#n("transform error reporter failed:",e)}})}register(e){return this.#P>0?this.#x(e,!1):this.#E(()=>this.#x(e,!0))}unregister(e){return this.#P>0?this.#M(e,!1):this.#E(async()=>{await this.#M(e,!0)})}destroyAll(){return this.#P>0?this.#O(!1):this.#E(async()=>{await this.#O(!0)})}applyTransforms(e,t,n,r){const i=this.#L.get(e);if(void 0===i||0===i.length)return t;let o=t;for(const s of[...i]){if(!s.active)continue;const{transform:i}=s;if(!1===r?.())return t;try{o=i(o,{fieldName:e,element:n.element,allFields:n.allFields});const s=v(o);if(!1===r?.())return t;if(s)throw new TypeError(`Transform for "${e}" returned a Promise/thenable; transforms must be synchronous`)}catch(n){if(!1===r?.())return t;const i=n instanceof Error?n:new Error(String(n));return this.#n(`transform for "${e}" failed:`,i),this.#k?.(i),t}}return o}list(){return[...this.#T.keys()]}snapshot(){const e=[],t=(e,t,n,r)=>{const i=r.counts();return{name:e,version:t,state:n,registrations:{transforms:i.transform,renderers:i.renderer,subscriptions:i.subscription,cleanups:i.cleanup}}};for(const[n,r]of this.#C)e.push(t(n,void 0,"initializing",r.scope));for(const[n,r]of this.#T)e.push(t(n,r.plugin.version,"active",r.scope));for(const t of this.#R.keys())e.push({name:t,version:void 0,state:"tearing-down",registrations:{transforms:0,renderers:0,subscriptions:0,cleanups:0}});return e}get size(){return this.#T.size}async#x(t,n){if(this.#T.has(t.name)||this.#C.has(t.name)||this.#R.has(t.name))return void this.#n(`plugin "${t.name}" already registered`);const r=function(e,t){if(void 0!==e){if(void 0!==e.runtime&&!function(e,t){const n=function(e){const t=/^v?(\d+)\.(\d+)\.(\d+)/.exec(e.trim());if(null!==t)return[Number(t[1]),Number(t[2]),Number(t[3])]}(e);return void 0!==n&&t.split("||").some(e=>{const r=e.trim().split(/\s+/).filter(e=>e.length>0);return 0===r.length?""===e.trim()&&""===t.trim():r.every(e=>function(e,t){const n=t.trim();if(""===n||"*"===n)return!0;const r=/^(\^|~|>=|<=|>|<|=)?\s*v?(\d+)\.(\d+)\.(\d+)/.exec(n);if(null===r)return!1;const i=r[1]??"=",o=[Number(r[2]),Number(r[3]),Number(r[4])],s=function(e,t){for(let n=0;n<3;n+=1){const r=(e[n]??0)-(t[n]??0);if(0!==r)return r}return 0}(e,o);switch(i){case"=":return 0===s;case">":return s>0;case">=":return s>=0;case"<":return s<0;case"<=":return s<=0;case"~":return s>=0&&e[0]===o[0]&&e[1]===o[1];case"^":return!(s<0)&&(o[0]>0?e[0]===o[0]:o[1]>0?0===e[0]&&e[1]===o[1]:0===e[0]&&0===e[1]&&e[2]===o[2]);default:return!1}}(n,e))})}(t,e.runtime))return`declares runtime ${e.runtime}, this runtime is ${t}`;if(void 0!==e.protocol){if(!Number.isInteger(e.protocol)||e.protocol<1)return`declares an invalid protocol version ${String(e.protocol)}`;if(e.protocol<4)return`declares protocol ${String(e.protocol)}, this runtime speaks ${String(4)}`}}}(t.compat,e);if(void 0!==r)return void this.#F(t.name,r);const i=new io(t.name,this.#n),o=this.#U(t.name,i),s={scope:i,cancelled:!1};this.#C.set(t.name,s);try{if(await this.#I(()=>t.init(o),n),s.cancelled)return;i.commit()}catch(e){return i.close(),void(s.cancelled||this.#n(`plugin "${t.name}" init failed:`,e))}finally{this.#C.get(t.name)===s&&this.#C.delete(t.name)}this.#T.set(t.name,{plugin:t,scope:i}),this.#n(`plugin "${t.name}" registered`)}#F(e,t){const n=`plugin "${e}" refused: ${t}`;this.#n(n),this.#v.emit("error",{error:new Error(n),context:"plugin",code:"LP0103"})}#U(e,t){return{events:new oo(this.#v,t),registerFieldRenderer:e=>{t.stage("renderer",()=>{const t=this.#A(e);return"function"==typeof t?t:void 0})},registerTransform:(e,n)=>{const r={transform:n,active:!1};t.stage("transform",()=>{r.active=!0;const t=this.#L.get(e);return void 0===t?this.#L.set(e,[r]):t.push(r),()=>{r.active=!1;const t=this.#L.get(e);if(void 0===t)return;const n=t.indexOf(r);n>=0&&t.splice(n,1),0===t.length&&this.#L.delete(e)}})},registerCleanup:e=>{t.own(e)},getConfig:()=>this.#S,log:(...t)=>{this.#n(`[${e}]`,...t)}}}#M(e,t){const n=this.#C.get(e);if(void 0!==n)return n.cancelled=!0,n.scope.close(),Promise.resolve();const r=this.#R.get(e);if(void 0!==r)return this.#$.has(e)?Promise.resolve():t?this.#_(r):r;const i=this.#T.get(e);if(void 0===i)return Promise.resolve();this.#T.delete(e),i.scope.close();const o=Promise.resolve().then(()=>this.#D(e,i.plugin,t));return this.#R.set(e,o),o.then(()=>{this.#R.get(e)===o&&this.#R.delete(e)}),o}async#D(e,t,n){if(void 0!==t.destroy){this.#$.add(e);try{await this.#I(()=>t.destroy?.(),n)}catch(t){this.#n(`plugin "${e}" destroy failed:`,t)}finally{this.#$.delete(e)}}}async#O(e){for(const e of this.#C.values())e.cancelled=!0,e.scope.close();const t=[...this.#T.keys()];for(const n of t)await this.#M(n,e)}async#I(e,t){t?await this.#_(Promise.resolve().then(e)):await e()}async#_(e){this.#P+=1;try{await e}finally{this.#P-=1}}#E(e){const t=this.#N.then(e);return this.#N=t.catch(e=>{this.#n("plugin manager mutation failed:",e)}),t}},ao=class{#j;#B;#z=/* @__PURE__ */new Map;constructor(e){this.#j=e,this.#B={...e}}get renderers(){return this.#B}resolve(e){return this.#B[e]}register(e){const t=e.name,n={renderer:e},r=this.#z.get(t);void 0===r?this.#z.set(t,[n]):r.push(n),this.#B[t]=e;let i=!0;return()=>{if(!i)return;i=!1;const e=this.#z.get(t);if(void 0===e)return;const r=e.indexOf(n);if(r<0)return;const o=r===e.length-1;if(e.splice(r,1),0===e.length&&this.#z.delete(t),!o)return;const s=e.at(-1),a=s?.renderer??this.#j[t];void 0===a?Reflect.deleteProperty(this.#B,t):this.#B[t]=a}}},lo={1:"left",2:"center",3:"right",4:"justify"},uo=/* @__PURE__ */new Set(["left","center","right","justify","start","end"]);function co(e){const t=e.format;return"string"==typeof t&&uo.has(t)?t:"number"==typeof t?lo[t]:void 0}function fo(e){const t=e.indent;return"number"==typeof t&&t>0?t:0}function ho(e){return"rtl"===e.direction?' dir="rtl"':"ltr"===e.direction?' dir="ltr"':""}function po(e){const t=co(e),n=fo(e),r=[];return void 0!==t&&r.push(`lp-align-${t}`),n>0&&r.push(`lp-indent-${String(n)}`),0===r.length?"":` class="${r.join(" ")}"`}var go=/* @__PURE__ */new Set(["h1","h2","h3","h4","h5","h6"]);function mo(e){return"object"==typeof e&&null!==e?e:void 0}function vo(e){return mo(e)}function yo(e,t){if(void 0===t||""===t||!e.startsWith("/"))return e;try{const n=new URL(t),r=new URL(e,n);return r.origin===n.origin?r.href:e}catch{return e}}function bo(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-").toLowerCase()}function wo(e){return"string"==typeof e&&e.length>0?e:void 0}function So(e){const t=wo(e.title)??wo(e.name)??wo(e.slug);return void 0!==t?t:void 0===e.id?void 0:String(e.id)}var Ao=/\{(slug|id|collection|locale)\}/gu,ko=' target="_blank" rel="noopener noreferrer"',To=(e,t)=>{const n=t.renderChildren(e.children??[]),r=mo(e.fields),i=function(e,t,n){if("internal"===t?.linkType)return function(e,t){const n=mo(e),r=mo(n?.value),i=r?.url;if("string"==typeof i&&i.length>0)return i;const o=void 0===t.internalLinkPattern?void 0:function(e,t){const n=e=>{const n=t[e];return"string"==typeof n&&n.length>0||"number"==typeof n?encodeURIComponent(n):void 0};for(const[,t=""]of e.matchAll(Ao))if(void 0===n(t))return;return e.replace(Ao,(e,t)=>n(t)??"")}(t.internalLinkPattern,{slug:r?.slug,id:void 0===r?n?.value:r.id,collection:n?.relationTo,locale:t.locale});if(void 0!==o)return o;const s=r?.slug;return"string"==typeof s&&s.length>0?`/${s}`:void 0}(t.doc,n);const r=t?.url??e.url;return"string"==typeof r&&r.length>0?r:void 0}(e,r,t);if(void 0===i||!isSafeUrl(i))return n;const o="string"==typeof e.title?` title="${escapeHtml(e.title)}"`:"";return`<a href="${escapeHtmlAttribute(i)}"${function(e,t,n){if(!0===t?.newTab||isExternalHttpUrl(n))return ko;const r="string"==typeof e.target?e.target:"";return""===r?"":"_blank"===r?ko:` target="${escapeHtml(r)}"`}(e,r,i)}${o}>${n}</a>`};function Co(e){if("string"==typeof e.text)return e.text;if(!e.children)return"";let t="";for(const n of e.children)t+=Co(n);return t}function Ro(e){return`${"number"==typeof e.width?` width="${String(e.width)}"`:""}${"number"==typeof e.height?` height="${String(e.height)}"`:""}`}function $o(e){return"string"==typeof e.mimeType?` type="${escapeHtmlAttribute(e.mimeType)}"`:""}var Lo=/* @__PURE__ */new Map;function No(e){return Lo.get(e)}var Po=".lp-block:empty,.lp-inline-block:empty";function xo(e,t,n,r){const i=mo(e.fields)??{},o="string"==typeof i.blockType?i.blockType:"",s=bo(o),a=""===s?r:`${r} ${r}--${s}`;if(""!==o){const e=No(o)??No(s);if(e)return e(i,{renderChildren:t.renderChildren});t.onUnrenderedBlock?.(o,a,i)}return`<${n} class="${a}"></${n}>`}function Eo(e,t){return"number"==typeof t&&t>1?` ${e}="${String(t)}"`:""}var Mo={text:e=>{let t=escapeHtml("string"==typeof e.text?e.text:"");const n="number"==typeof e.format?e.format:0;return!!(16&n)&&(t=`<code>${t}</code>`),!!(1&n)&&(t=`<strong>${t}</strong>`),!!(2&n)&&(t=`<em>${t}</em>`),!!(8&n)&&(t=`<u>${t}</u>`),!!(4&n)&&(t=`<s>${t}</s>`),!!(32&n)&&(t=`<sub>${t}</sub>`),!!(64&n)&&(t=`<sup>${t}</sup>`),!!(128&n)&&(t=`<mark>${t}</mark>`),t},paragraph:(e,t)=>{const n=t.renderChildren(e.children??[]);return`<p${ho(e)}${po(e)}>${n}</p>`},heading:(e,t)=>{const n="string"==typeof e.tag?e.tag.toLowerCase():"h2",r=go.has(n)?n:"h2",i=t.renderChildren(e.children??[]);return`<${r}${ho(e)}${po(e)}>${i}</${r}>`},list:(e,t)=>{const n="string"==typeof e.listType?e.listType:"bullet",r="number"===n?"ol":"ul",i="number"===n&&"number"==typeof e.start&&e.start>1?` start="${String(e.start)}"`:"",o="check"===n?' role="list"':"",s=t.renderChildren(e.children??[]);return`<${r}${ho(e)}${po(e)}${i}${o}>${s}</${r}>`},listitem:(e,t)=>{const n=t.renderChildren(e.children??[]);if("boolean"==typeof e.checked)return`<li role="checkbox" aria-checked="${e.checked?"true":"false"}"${po(e)}>${n}</li>`;const r="number"==typeof e.value?` value="${escapeHtml(String(e.value))}"`:"";return`<li${ho(e)}${po(e)}${r}>${n}</li>`},link:To,autolink:To,quote:(e,t)=>{const n=t.renderChildren(e.children??[]);return`<blockquote${ho(e)}${po(e)}>${n}</blockquote>`},code:e=>{const t=bo("string"==typeof e.language?e.language:"");return`<pre><code${""===t?"":` class="language-${t}"`}>${escapeHtml(Co(e))}</code></pre>`},"code-highlight":e=>{const t="string"==typeof e.text?e.text:"";return`<span${"string"==typeof e.highlightType?` class="token-${bo(e.highlightType)}"`:""}>${escapeHtml(t)}</span>`},linebreak:()=>"<br>",horizontalrule:()=>"<hr>",tab:()=>"\t",upload:e=>{const t=vo(e.value);if(void 0===t)return"";const n=t.url;if("string"!=typeof n||!isSafeUrl(n))return"";const r="string"==typeof t.mimeType?t.mimeType:"";return r.startsWith("video/")?function(e,t){return`<video controls${Ro(e)}><source src="${escapeHtmlAttribute(t)}"${$o(e)}></video>`}(t,n):r.startsWith("audio/")?function(e,t){return`<audio controls><source src="${escapeHtmlAttribute(t)}"${$o(e)}></audio>`}(t,n):""===r||r.startsWith("image/")?function(e,t){const n="string"==typeof e.alt?escapeHtml(e.alt):"";return`<img src="${escapeHtmlAttribute(t)}" alt="${n}"${Ro(e)} loading="lazy" decoding="async">`}(t,n):function(e,t){const n="string"==typeof e.filename?escapeHtml(e.filename):escapeHtml(t);return`<a href="${escapeHtmlAttribute(t)}" target="_blank" rel="noopener noreferrer">${n}</a>`}(t,n)},relationship:e=>{const t="string"==typeof e.relationTo?e.relationTo:"",n=mo(e.value),r=escapeHtml((n&&So(n))??`#${t}`),i=bo(t),o=""===i?' class="lp-relation"':` class="lp-relation lp-relation--${i}"`,s=n?.url;return"string"==typeof s&&isSafeUrl(s)?`<a href="${escapeHtmlAttribute(s)}"${o}>${r}</a>`:`<span${o}>${r}</span>`},block:(e,t)=>xo(e,t,"div","lp-block"),inlineBlock:(e,t)=>xo(e,t,"span","lp-inline-block"),table:(e,t)=>`<table${ho(e)}><tbody>${t.renderChildren(e.children??[])}</tbody></table>`,tablerow:(e,t)=>`<tr>${t.renderChildren(e.children??[])}</tr>`,tablecell:(e,t)=>{const n="number"==typeof e.headerState?e.headerState:0,r=3&n?"th":"td";return`<${r}${1===n?' scope="col"':2===n?' scope="row"':""}${Eo("colspan",e.colSpan)}${Eo("rowspan",e.rowSpan)}>${t.renderChildren(e.children??[])}</${r}>`}},Oo=/* @__PURE__ */new Map,Fo=!1;function Uo(e){if("object"!=typeof e||null===e)return!1;if(!("root"in e))return!1;const t=e.root;return"object"==typeof t&&null!==t&&"children"in t&&Array.isArray(t.children)}function Io(e,t={}){if(!Uo(e))return"";const n=function(e){const t={renderChildren:e=>{let n="";for(const r of e)n+=Do(r,t);return n},resolveAlignment:co,resolveIndent:fo,onUnrenderedBlock:e.onUnrenderedBlock,internalLinkPattern:e.internalLinkPattern,locale:e.locale};return t}(t).renderChildren(e.root.children);return!1===t.sanitize?n:void 0!==t.document?sanitizeHtml(n,{document:t.document}):!0===t.requireDocument||void 0!==ti()?sanitizeHtml(n):(function(){if(!Fo){Fo=!0;try{console.warn('[live-preview] lexicalToHtml() has no sanitizer document and returned unsanitised HTML; pass { document } (linkedom, jsdom) per call. 3.0 throws here instead: opt in now with { requireDocument: true }. See "HTML sanitization" in docs/security.md.')}catch{}}}(),n)}function _o(e){return Uo(e)?e.root.children.map(jo).join("\n").trim():""}function Do(e,t){const n=(r=e.type,Oo.get(r)??Mo[r]);var r;return n?n(e,t):void 0!==e.children?t.renderChildren(e.children):""}function jo(e){if("string"==typeof e.text)return e.text;if("linebreak"===e.type)return"\n";if(void 0===e.children)return"";let t="";for(const n of e.children)t+=jo(n);return t}function Bo(e="text"){const t=/* @__PURE__ */new WeakSet;return{name:e,render:/* @__PURE__ */re((e,n)=>{const r=e.element,i=function(e){return null==e?"":Uo(e)?_o(e):"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):JSON.stringify(e)}(n);if("INPUT"!==r.tagName&&"TEXTAREA"!==r.tagName){if(r.textContent.trim()!==i.trim())return function(e){return null!==e.querySelector(":scope > :not(br)")}(r)&&!r.hasAttribute("data-payload-text")?(function(e,t,n){e.has(t)||(e.add(t),k(`[live-preview] LP0402: Skipping text update for "${n}": <${t.tagName.toLowerCase()}> has structured children. Move data-payload-field to the value element, or add data-payload-text to replace them.`))}(t,r,e.fieldName),!1):void(i.includes("\n")||i.includes("\r")?r.innerHTML=Lr(function(e){return escapeHtml(e).replace(/\r\n|\r|\n/g,"<br>")}(i)):r.textContent=i)}else r.value=i})}}var zo=/* @__PURE__ */new Set,Wo=/* @__PURE__ */new Set,Ho=/* @__PURE__ */new WeakMap,qo=/* @__PURE__ */new Set(["DIV","SECTION","ARTICLE"]),Vo={name:"richText",render:/* @__PURE__ */re((e,t,n)=>{const r=e.element;if(gi(t))return void(r.textContent="");const i=n.sanitizerPolicy;if(void 0!==n.renderRichText){const o=n.renderRichText(t,{fieldName:e.fieldName,element:r,locale:n.locale});return void(r.innerHTML=Lr(Zr(o,i)))}if(Uo(t)){if(it(t))return void(r.textContent="");const o=/* @__PURE__ */new Map,s=[],a=function(e,t){const n=e.cloneNode(!1);n.innerHTML=Lr(t);const r=function(e,t){const n=e.firstElementChild,r=1===t.children.length?t.firstElementChild:null;if(null!==n?.nextElementSibling||0===t.children.length)return null;if(!qo.has(n.tagName)||n.hasAttribute(Tt))return null;if(r?.tagName===n.tagName||!0===r?.matches(Po))return null;for(const e of t.children)if(e.tagName===n.tagName&&e.className===n.className)return null;return n}(e,n)??e,i=/* @__PURE__ */new Map,o=n.querySelectorAll(Po);if(o.length>0&&null!==r.firstElementChild){const e=[];Go(r,n,e);for(const[t,n]of e)t.replaceWith(n),n.matches(Po)||i.set(t.className,!1);for(const e of o)null!==e.parentNode&&i.set(e.className,!0)}return r.replaceChildren(...n.childNodes),i}(r,Zr(Io(t,{sanitize:!1,internalLinkPattern:n.internalLinkPattern,locale:n.locale,onUnrenderedBlock:(e,t,n)=>{o.set(t,e),s.push(n)}}),i));for(const[t,r]of a){const i=o.get(t);void 0!==i&&Jo(e,n,i,r)}return void function(e,t,n,r){const i=function(e){try{return JSON.stringify(e,(e,t)=>"object"==typeof t&&null!==t&&"id"in t&&"updatedAt"in t?t.id:t)}catch{return}}(n),o=Ho.get(e.element);void 0===i?Ho.delete(e.element):Ho.set(e.element,i),void 0!==i&&void 0!==o&&i!==o&&[...r.values()].includes(!1)&&t.reportUnfaithful?.(e,"changed a block no renderer draws")}(e,n,s,a)}if("string"!=typeof t)return!1;r.innerHTML=Lr(Zr(t,i))})};function Go(e,t,n){const r=(e,t)=>{e.matches(Po)?n.push([e,t]):Go(t,e,n)};let i=e.firstElementChild,o=t.firstElementChild;if(e.children.length===t.children.length){for(;null!==i&&null!==o;i=i.nextElementSibling)r(o,i),o=o.nextElementSibling;return}const s=/* @__PURE__ */new Set;for(const e of t.children)e.matches(Po)||s.add(e.tagName);const a=(e,t)=>e.matches(Po)?!s.has(t.tagName):e.tagName===t.tagName;let l=0;for(;null!==i&&null!==o&&a(o,i);l+=1)r(o,i),i=i.nextElementSibling,o=o.nextElementSibling;const u=Math.min(e.children.length,t.children.length);i=e.lastElementChild,o=t.lastElementChild;for(let e=l;e<u&&null!==i&&null!==o;e+=1){if(!a(o,i))return;r(o,i),i=i.previousElementSibling,o=o.previousElementSibling}}function Jo(e,t,n,r){r&&t.reportUnfaithful?.(e,`lost the markup the server drew for block "${n}"`);const i=r?Wo:zo;i.has(n)||(i.add(n),k(`[live-preview] ${r?`LP0413: no renderer for block "${n}", and the markup the server rendered for it is lost.`:`LP0410: no renderer for block "${n}"; keeping what the server rendered for it.`} Register one with registerBlockRenderer().`))}var Ko={name:"html",render(e,t,n){if(gi(t))return void(e.element.textContent="");const r="string"==typeof t?t:pi(t);e.element.innerHTML=Lr(Zr(r,n.sanitizerPolicy))}},Xo=/* @__PURE__ */new WeakSet;function Qo(e,t,n,r){if("string"!=typeof n||0===n.length)return{kind:"none"};const i=yo(n,r);return isSafeUrl(i)?{kind:"safe",url:i}:(Xo.has(e)||(Xo.add(e),k(`[live-preview] LP0401: refused an unsafe URL for "${t}" on <${e.tagName.toLowerCase()}>; the attribute was cleared.`)),{kind:"unsafe"})}function Zo(e,t=e=>e){return{name:e,render(e,n,r){const i=e.element;if(gi(n))return void function(e){"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):e.value=""}(i);const o=pi(n);if("INPUT"!==i.tagName&&"TEXTAREA"!==i.tagName){if("A"===i.tagName){const n=e.hrefField,s=void 0===n||0===n.length?t(o):ae(r.allFields,n,r.locale,void 0!==e.locale),a=Qo(i,e.fieldName,s);"safe"===a.kind?i.setAttribute("href",a.url):"unsafe"===a.kind&&i.removeAttribute("href")}i.textContent=o}else i.value=o}}}var Yo=Zo("url"),es=/^[a-zA-Z][a-zA-Z0-9+.-]*:/,ts=Zo("email",function(e){const t=e.trim();return es.test(t)||!t.includes("@")?t:`mailto:${t}`}),ns=["src","srcset","sizes"],rs=/* @__PURE__ */new WeakMap;function is(e){for(const t of ns)e.removeAttribute(t);os(e)}function os(e){if("PICTURE"===e.parentElement?.tagName)for(const t of e.parentElement.querySelectorAll("source"))t.remove()}function ss(e,t,n,r){const i=function(e,t){const n=[];for(const[r,i]of Object.entries(e?.sizes??e?.variants??{})){if("string"!=typeof i.url||"number"!=typeof i.width)continue;const e=yo(i.url,t);isSafeUrl(e)&&n.push({...i,name:r,url:e,width:i.width})}return n}(n,r),o=e.getAttribute("src"),s=i.find(t=>null!==o&&as(e,t.url,o))??i.find(t=>t.name===rs.get(e));void 0===s?.name?rs.delete(e):rs.set(e,s.name),null!==o&&(as(e,t,o)||i.some(t=>as(e,t.url,o)))||os(e),e.src=s?.url??t;const a=s??n,l=i.filter(e=>ls(e,a)),u=l.length>0?l:i.filter(e=>ls({...e,mimeType:void 0},a));if(0===u.length)return e.removeAttribute("srcset"),void e.removeAttribute("sizes");if("number"==typeof n?.width&&"string"==typeof n.url){const e=yo(n.url,r),t={...n,url:e,width:n.width};isSafeUrl(e)&&ls(t,a)&&u.push(t)}const d=/* @__PURE__ */new Set,c=[];for(const e of u)d.has(e.width)||(d.add(e.width),c.push(`${us(e.url)} ${String(e.width)}w`));const f=c.join(", ");e.setAttribute("srcset",f)}function as(e,t,n){try{return new URL(t,e.baseURI).href===new URL(n,e.baseURI).href}catch{return t===n}}function ls(e,t){if(void 0===t)return!0;if("string"==typeof e.mimeType&&"string"==typeof t.mimeType&&e.mimeType!==t.mimeType)return!1;const{width:n,height:r}=t;return"number"!=typeof n||"number"!=typeof r||"number"!=typeof e.width||"number"!=typeof e.height||Math.abs(e.width*r-e.height*n)<=Math.max(n,e.width)}function us(e){return e.replace(/[\s,]/g,encodeURIComponent)}var ds=/^(?:\.{0,2}\/|\S*[/.:]\S*$|.*\.(?:avif|bmp|gif|ico|jpe?g|png|svg|tiff?|webp)$)/i,cs={name:"image",render:/* @__PURE__ */re((e,t,n)=>{const r=e.element;if("IMG"===r.tagName&&e.altField===e.fieldName&&void 0===e.srcField&&("string"==typeof t||gi(t)))return void(r.alt=t??"");if(gi(t))return void fs(r);const i=void 0!==e.locale,{media:o,candidate:s}=function(e,t,n,r){const i=void 0!==e.srcField&&e.srcField.length>0?ae(n.allFields,e.srcField,n.locale,r):t,o=vo(i);return{media:o,candidate:void 0===o?i:o.url}}(e,t,n,i);if(void 0===o&&"string"==typeof s&&!ds.test(s.trim()))return!1;const a=Qo(r,e.fieldName,s,void 0===o?void 0:n.serverURL);if("none"===a.kind)return!1;if("unsafe"!==a.kind){if("IMG"===r.tagName){const t=r;ss(t,a.url,o,n.serverURL);const s=function(e,t,n,r,i){if(void 0!==t&&t.length>0){const e=ae(n,t,r,i);return"string"==typeof e?e:void 0}return e?.alt}(o,e.altField,n.allFields,n.locale,i);return void(void 0!==s&&(t.alt=s))}r.style.backgroundImage=`url('${function(e){return e.replace(/['"()\\]/g,"\\$&")}(a.url)}')`}else fs(r)})};function fs(e){"IMG"===e.tagName?is(e):e.style.backgroundImage=""}var hs={name:"upload",render:/* @__PURE__ */re((e,t,n)=>{const r=e.element;if(gi(t))return void ps(r);const i=vo(t);if(void 0===i)return!1;const o=Qo(r,e.fieldName,i.url,n.serverURL);if("none"===o.kind)return!1;if("unsafe"===o.kind)return void ps(r);const s=o.url;if("IMG"===r.tagName){const e=r;return ss(e,s,i,n.serverURL),void(void 0!==i.alt&&(e.alt=i.alt))}if("A"===r.tagName)return r.setAttribute("href",s),void(r.textContent=i.filename??s);const a=escapeHtml(i.filename??s);r.innerHTML=Lr(`<a href="${escapeHtmlAttribute(s)}">${a}</a>`)})};function ps(e){"IMG"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):is(e)}var gs={name:"relationship",render(e,t){const n=e.element;if(gi(t))return n.removeAttribute("href"),void(n.textContent="");if("A"===n.tagName&&!Array.isArray(t)){const r=Qo(n,e.fieldName,mo(t)?.url);"safe"===r.kind?n.setAttribute("href",r.url):"unsafe"===r.kind&&n.removeAttribute("href")}n.textContent=Array.isArray(t)?t.map(ms).join(", "):ms(t)}};function ms(e){const t=mo(e);return void 0===t?pi(e):So(t)??""}var vs={name:"select",render(e,t,n){const r=e.element,i=gi(t)?[]:function(e){return Array.isArray(e)?e.map(pi):[pi(e)]}(t);if("SELECT"!==r.tagName){if("INPUT"===r.tagName&&"radio"===r.type){const e=r;return void(e.checked=i.includes(e.value))}r.textContent=i.map(e=>function(e,t){const n=t.schema?.options;if(!Array.isArray(n))return e;for(const t of n){const n=mo(t);if(void 0!==n&&pi(n.value)===e)return"string"==typeof n.label?n.label:e}return e}(e,n)).join(", ")}else!function(e,t){if(e.multiple)for(const n of Array.from(e.options))n.selected=t.includes(n.value);else e.value=t[0]??""}(r,i)}},ys=/* @__PURE__ */new Set(["","false","0","off","no"]),bs={name:"checkbox",render(e,t){const n=e.element,r=function(e){return"boolean"==typeof e?e:"string"==typeof e?!ys.has(e.trim().toLowerCase()):"number"==typeof e?0!==e:null!=e}(t);"INPUT"!==n.tagName||"checkbox"!==n.type?n.hasAttribute("aria-checked")?n.setAttribute("aria-checked",r?"true":"false"):n.textContent=r?"true":"false":n.checked=r}},ws=/* @__PURE__ */new Map,Ss=/* @__PURE__ */new Map;function As(e,t){const n=e??"";if(null==t)return n;const r=ks(t);return"{}"===r?n:`${n}|${r}`}function ks(e){if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(e=>ks(e)).join(",")}]`;const t=e,n=Object.keys(t).sort(),r=[];for(const e of n){const n=t[e];void 0!==n&&r.push(`${JSON.stringify(e)}:${ks(n)}`)}return`{${r.join(",")}}`}var Ts=/* @__PURE__ */new Set(["short","medium","long","full"]),Cs=/* @__PURE__ */new Set(["short","medium","long","full"]),Rs=/^[A-Za-z]{3}$/u,$s=/^[0-4]$/u;function Ls(e){return{kind:"date",options:e}}function Ns(e){return{kind:"number",options:e}}var Ps=/* @__PURE__ */new WeakSet;function xs(e,t,n,r){if(void 0===t||""===t)return;const i=function(e){const t=e.indexOf(":"),n=-1===t?e:e.slice(0,t),r=-1===t?void 0:e.slice(t+1);switch(n){case"date":return void 0===r?Ls({dateStyle:"medium"}):Ts.has(r)?Ls({dateStyle:r}):void 0;case"time":return void 0===r?Ls({timeStyle:"short"}):Cs.has(r)?Ls({timeStyle:r}):void 0;case"datetime":return void 0===r?Ls({dateStyle:"medium",timeStyle:"short"}):Ts.has(r)?Ls({dateStyle:r,timeStyle:"short"===r?"short":"medium"}):void 0;case"number":if(void 0===r)return Ns({});if(!$s.test(r))return;return Ns({minimumFractionDigits:Number(r),maximumFractionDigits:Number(r)});case"currency":if(void 0===r||!Rs.test(r))return;return Ns({style:"currency",currency:r.toUpperCase()});case"percent":return void 0===r?Ns({style:"percent"}):void 0;default:return}}(t);if(void 0!==i){if(i.kind===e)return i.options}else!function(e,t,n){Ps.has(e)||(Ps.add(e),k(`[live-preview] LP0408: data-payload-format="${n}" on "${t}" is not a known format; the default formatting was used. Known: date, time, datetime (each also :short|medium|long|full), number, number:0-4, currency:XXX, percent.`))}(n,r,t)}var Es={name:"date",render(e,t,n){const r=e.element;if(gi(t))return void("INPUT"===r.tagName?r.value="":(r.removeAttribute("datetime"),r.textContent=""));const i="number"==typeof t?t:pi(t),o=new Date(i),s=!Number.isNaN(o.getTime()),a=String(i);"INPUT"!==r.tagName?("TIME"===r.tagName&&r.setAttribute("datetime",s?o.toISOString():a),r.textContent=s?function(e,t,n){const r=t.locale??n.locale??detectInitialLocale(),i=xs("date",t.format,t.element,t.fieldName)??Ms;try{return function(e,t){const n=As(e,t);return mi(Ss,n)??vi(Ss,n,new Intl.DateTimeFormat(e,t),64)}(r,i).format(e)}catch{return e.toISOString()}}(o,e,n):a):r.value=s?function(e,t){const n=`${String(t.getFullYear()).padStart(4,"0")}-${Os(t.getMonth()+1)}-${Os(t.getDate())}`,r=`${Os(t.getHours())}:${Os(t.getMinutes())}`;return"date"===e?n:"datetime-local"===e?`${n}T${r}`:"time"===e?r:t.toISOString()}(r.type,o):a}},Ms={dateStyle:"medium",timeStyle:"short"};function Os(e){return String(e).padStart(2,"0")}var Fs={name:"number",render(e,t,n){const r=e.element;if(gi(t))return void("INPUT"===r.tagName?r.value="":r.textContent="");const i="number"==typeof t?t:Number(pi(t));Number.isNaN(i)?r.textContent=pi(t):"INPUT"!==r.tagName?r.textContent=function(e,t,n){const r=t.locale??n.locale??detectInitialLocale(),i=xs("number",t.format,t.element,t.fieldName);try{return function(e,t){const n=As(e,t);return mi(ws,n)??vi(ws,n,new Intl.NumberFormat(e,t),64)}(r,i).format(e)}catch{return String(e)}}(i,e,n):r.value=String(i)}},Us={name:"array",render:/* @__PURE__ */re((e,t,n)=>{const r=e.element;if(gi(t))return void(r.textContent="");if(!Array.isArray(t))return!1;const i=e.arrayTemplate;if(void 0!==i&&i.length>0){const e=function(e,t){const n=di(t);let r="";for(let i=0;i<t.length;i+=1)r+=ci(e,t[i],i,pi,n);return r}(i,t),o=n.sanitizerPolicy,s=Ai(i),a=fi(r);r.innerHTML=Lr(Zr(e,o,s));for(const e of Array.from(r.children))hi(e,a);return}r.textContent=t.map(pi).join(e.arraySeparator??", ")})};function Is(){const e=/* @__PURE__ */new WeakMap,t=/* @__PURE__ */new WeakSet,n=/* @__PURE__ */new WeakMap,r=/* @__PURE__ */new WeakMap;return{name:"structural-array",render:/* @__PURE__ */re((i,o,s)=>{const a=gi(o)?[]:o;if(!Array.isArray(a))return!1;const l=i.element,u=i.arrayTemplate;if(void 0===u||0===u.length)return function(e,t,n){e.has(t)||(e.add(t),k(`[live-preview] LP0403: Skipping structural update for "${n}": <${t.tagName.toLowerCase()} data-payload-structural> needs data-payload-array-template (for example "<li>{{label}}</li>").`))}(t,l,i.fieldName),!1;const d=e.get(l),c=_s(l),f=U(d?.values??c.map((e,t)=>null===e?{__payloadDomPosition:t}:{id:e}),a),h=function(e,t,n){return void 0===e||e.template!==t||!function(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}(e.domSnapshot,n)}(d,u,c);if(0===f.length&&!h)return e.set(l,{values:a.slice(),template:u,domSnapshot:c}),!1;!function(e,t,n,r,i){const o=i.map(Ds),s=/* @__PURE__ */new Set,a=o.find(e=>!(void 0===e||!s.has(e)&&(s.add(e),1)));if(void 0!==a&&js(e,t,n,a),o.some(e=>void 0===e)&&Bs(e,t,"LP0404",`LP0404: an item of "${n}" has no id and pairs by position, so an insert re-renders every row after it. Give items a stable id.`),r?.length===i.length&&i.length>1){const i=new Set(r.map(Ds).filter(e=>void 0!==e)),s=o.some(e=>void 0!==e&&i.has(e));i.size>0&&!s&&Bs(e,t,"LP0406",`LP0406: every key of "${n}" changed at once; the source generates ids per message, so no item can be retained across updates.`)}}(n,l,i.fieldName,d?.values,a);const p=Ri({template:u,container:l,patches:f,nextItems:a,store:r,forceRender:h,sanitizerPolicy:s.sanitizerPolicy,onDuplicateKey:(e,t)=>{js(n,e,i.fieldName,t)}});return null!==p&&(e.set(l,{values:a.slice(),template:u,domSnapshot:_s(l)}),!!p&&void 0)})}}function _s(e){return Array.from(e.children,e=>e.getAttribute(ki))}function Ds(e){if("object"!=typeof e||null===e)return;const t=e.id;return"string"==typeof t||"number"==typeof t?String(t):void 0}function js(e,t,n,r){Bs(e,t,"LP0405",`LP0405: two items of "${n}" share the key "${r}"; later ones pair by position. Make \`id\` unique per item.`)}function Bs(e,t,n,r){let i=e.get(t);void 0===i&&(i=/* @__PURE__ */new Set,e.set(t,i)),i.has(n)||(i.add(n),k(`[live-preview] ${r}`))}var zs=/* @__PURE__ */new Map;function Ws(e,t){return{name:e,render(){$(t)}}}function Hs(){const e=[Vo,Ko,Yo,ts,cs,hs,gs,vs,{...vs,name:"radio"},bs,Es,Fs,..."undefined"!=typeof __LEAN_BUILD__&&__LEAN_BUILD__?[Ws("array","structural arrays"),Ws("blocks","structural arrays")]:[Us,{...Us,name:"blocks"}]];return function(e=[]){const t={};for(const n of e)t[n.name]=n;for(const[e,n]of zs)t[e]=n;return Object.freeze(t)}([Bo("text"),Bo("textarea"),...e,..."undefined"!=typeof __LEAN_BUILD__&&__LEAN_BUILD__?[]:[Is()]])}var qs=Object.freeze({disableReferrerDetection:!0,eventSourcePolicy:"parent-or-opener",skipUnchanged:!0,sanitizerPolicy:"strict"}),Vs=Object.freeze({disableReferrerDetection:!1,eventSourcePolicy:"any",skipUnchanged:!1,sanitizerPolicy:"compat"});function Gs(e){return void 0===e?void 0:!e}var LivePreviewClient=class{#W=new EventEmitter;#H;#q;#V;#T;#n;#G=!1;#J=!1;#K=!1;#X=null;constructor(e={}){const n=function(e){const t="v1"===e.defaults?Vs:qs;return{...e,skipUnchanged:e.skipUnchanged??t.skipUnchanged,disableReferrerDetection:e.disableReferrerDetection??t.disableReferrerDetection,eventSourcePolicy:e.eventSourcePolicy??t.eventSourcePolicy,sanitizerPolicy:e.sanitizerPolicy??t.sanitizerPolicy}}(e),r=n.serverURL??"";t({defaults:e.defaults,serverURL:r,mergeDepth:n.mergeDepth});const i=n.debug??isDevMode();this.#n=i?(...e)=>{T("[live-preview]",...e)}:S,this.#H=new OriginDetector(P({additionalOrigins:n.allowedOrigins,enableReferrerDetection:Gs(n.disableReferrerDetection),enableLocalhostMatching:Gs(n.disableLocalhostMatching)})),this.#H.isProductionUnconfigured&&this.#n("no trusted origin could be detected — set allowedOrigins"),this.#q=new ao(Hs()),this.#T=new so({events:this.#W,config:Object.freeze({...n}),registerFieldRenderer:e=>this.#q.register(e),onTransformError:e=>{this.#W.emit("error",{error:e,context:"transform",code:"LP0602"})},log:this.#n}),this.#V=new Qi(P({root:n.root,renderers:this.#q.renderers,resolveRenderer:(e,t)=>n.resolveRenderer?.(e,t)??this.#q.resolve(e),renderRichText:n.renderRichText,internalLinkPattern:n.internalLinkPattern,routeAfterSave:n.routeAfterSave,sanitizerPolicy:n.sanitizerPolicy,transformValue:(e,t,n,r)=>this.#T.applyTransforms(e,t,n,r),originMatcher:e=>this.#H.matches(e),readyTargets:()=>this.#H.enumerate(),emitter:this.#W,dataMerge:""===r?void 0:P({serverURL:r,apiRoute:n.apiRoute,depth:n.mergeDepth,timeoutMs:n.mergeTimeoutMs,fetchFn:n.mergeFetch}),debounceMs:n.debounceMs,heartbeatMs:n.heartbeatMs,intersectionRootMargin:n.intersectionRootMargin,scopeBindingsByOwner:n.scopeBindingsByOwner,skipUnchanged:n.skipUnchanged,revealEditedField:n.revealEditedField,autoBind:n.autoBind,subfieldCoverage:n.subfieldCoverage,eventSourcePolicy:n.eventSourcePolicy,dependencies:n.dependencies,strategies:n.strategies,disableVisibilityGate:n.disableVisibilityGate,visibilityGateThreshold:n.visibilityGateThreshold,enableA11y:n.enableA11y,a11yLocale:n.a11yLocale,onHeartbeatTimeout:()=>{this.#H.unlockOrigin()},lockedOrigin:()=>this.#H.lockedOrigin,validateToken:n.validateToken,log:this.#n})),this.#W.on("connect",e=>{this.#H.lockOrigin(e.origin)}),!1!==n.autoStart&&this.start()}start(){if(this.#J)return!1;if(this.#G)return this.#V.start(),!0;if(!isInPreviewContext())return!1;const e=this.#V.start();return e&&(this.#G=!0),e}suspend(){return!(this.#J||!this.#G)&&this.#V.suspend()}resume(){return!(this.#J||!this.#G)&&this.#V.start()}destroy(){if(null!==this.#X)return this.#X;let e,t;this.#J=!0;const n=new Promise((n,r)=>{e=n,t=r});this.#X=n;const r=()=>{this.#W.removeAllListeners(),this.#K=!0};try{this.#V.destroy(),this.#T.destroyAll().finally(r).then(e,t)}catch(e){r(),t(e)}return n}async use(e){if(this.#J)throw new Error("LivePreviewClient: already destroyed");await this.#T.register(e)}async unuse(e){if(this.#K)throw new Error("LivePreviewClient: already destroyed");await this.#T.unregister(e)}refreshCache(){this.#V.refreshCache()}refreshAfterNavigation(){this.#V.navigationCommit()}get events(){return this.#W}get plugins(){return this.#T.list()}get status(){return this.#V.status}inspect(){return{...this.#V.inspect(),plugins:this.#T.snapshot()}}get updateCount(){return this.#V.updateCount}get destroyed(){return this.#J}};function Js(e,t,n){if(0===t.length)return;const r={type:"payload-live-preview-focus",field:t};e.postMessage(r,n)}var Ks="astro:page-load",Xs="astro:after-swap",Qs="__livePreviewRouteRefresh",Zs=Object.freeze({NoTrustedOrigin:"LP0101",ReferrerOnlyTrust:"LP0102",PluginIncompatible:"LP0103",ProfileFeatureOmitted:"LP0104",OrphanField:"LP0201",UnattributableUpdate:"LP0202",UnboundField:"LP0203",CoverageDefaultChanges:"LP0204",VisibilityGateDeferred:"LP0301",UnsafeAttributeWrite:"LP0401",TextTargetHasChildren:"LP0402",MissingArrayTemplate:"LP0403",StructuralItemUnkeyed:"LP0404",StructuralDuplicateKey:"LP0405",StructuralUnstableKeys:"LP0406",UnsupportedStrategy:"LP0407",UnknownValueFormat:"LP0408",SanitizerDroppedAttribute:"LP0409",UnrenderedBlockKept:"LP0410",UnfaithfulPatch:"LP0411",ServerFormatReplaced:"LP0412",UnrenderedBlockLost:"LP0413",MessageRejected:"LP0501",TokenRejected:"LP0502",ProtocolShapeUnknown:"LP0503",HandlerThrew:"LP0601",TransformThrew:"LP0602",RendererThrew:"LP0603",StartupFailed:"LP0605",ReadyFailed:"LP0606",HydrationWaitTimedOut:"LP0607",AuditRuntimeMissing:"LP0701",AuditNoFrameAncestors:"LP0702",AuditFrameOptionsBlocks:"LP0703",AuditBindingsExposed:"LP0704",AuditGateThresholdExceeded:"LP0705",AuditUnownedBindings:"LP0706",AuditNoBindings:"LP0707",AuditNotAPage:"LP0708",FragmentRequestFailed:"LP0801",FragmentResponseInvalid:"LP0802",FragmentUnauthorized:"LP0803",FragmentSuperseded:"LP0804",RouteRefreshLoop:"LP0805",FragmentStrategyUnavailable:"LP0806",UnboundChangeRefresh:"LP0807",EscalationUnavailable:"LP0808",IslandStartUnavailable:"LP0809",RouteRefreshUnconfirmed:"LP0810",V2ReadinessGap:"LP0709",RuntimeOnPublicPage:"LP0710",AuditModifierWithoutField:"LP0711"}),Ys=/* @__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(...n)=>{try{e(t(...n))}catch{}}}function n(){}function i(e){switch(typeof e){case"string":return e.length>65536?void 0:`s:${e}`;case"number":return`n:${Object.is(e,-0)?"-0":String(e)}`;case"boolean":return"b:"+(e?"1":"0");case"bigint":return`i:${String(e)}`;case"undefined":return"u";case"object":{if(null===e)return"z";let t;try{t=JSON.stringify(e)}catch{return}return t.length>65536?void 0:`o:${t}`}case"symbol":case"function":return}}function r(e){return e.onUnfaithfulPatch??("ignore"===e.onUnboundChange?"ignore":"escalate")}function l(e,t,n,r,l){let a=e.onUnfaithfulPatch,o=t.reportedUnfaithful.get(n.element),s=i(l),u=Date.now(),d=void 0!==o&&("escalate"!==a||void 0===s||s===o.identity||u-o.at<Ui);if((d||"escalate"!==a)&&t.display.shortfall(t.activeUpdate,{kind:"unfaithful",field:n.fieldName}),!d){if(t.reportedUnfaithful.set(n.element,{identity:s,at:u}),void 0===o){if(t.unfaithfulCount+=1,t.unfaithfulFields.add(n.fieldName),"ignore"===a)return;if("warn"===a){e.warn(`[live-preview] LP0411: "${n.fieldName}" ${r}`);return}}e.log("LP0411",n.fieldName,r),t.unfaithfulPatches.push(n)}}function a(e,t){return!e.unfaithfulFields.has(t)&&(e.unfaithfulFields.add(t),e.unfaithfulCount+=1,!0)}function o(e){return"select"===e||"radio"===e}function s(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value:e.textContent}function u(e){let t=e.trim();return JSON.stringify(t.length>ji?`${t.slice(0,ji)}\\u2026`:t)}function d(){return function(){if(typ','eof document>"u")return;let e=document.documentElement.getAttribute("lang");return null===e||0===e.length?void 0:e}()??function(){if(typeof navigator>"u")return;let e=navigator.language;return"string"==typeof e&&e.length>0?e:void 0}()??"en"}function c(e){null!==e.timer&&(clearTimeout(e.timer),e.timer=null),e.messageNode?.remove(),e.messageNode=null}function h(e){if(++e.nodes>1e4)throw new Error("invalid or oversized field schema")}function f(e,t,n){if(h(t),n>64||t.active.has(e))throw new Error("invalid or oversized field schema");t.active.add(e)}function p(e){try{return g(e,{nodes:0,active:new WeakSet},0)}catch{return[]}}function g(e,t,n){if(!Array.isArray(e))return[];f(e,t,n);let i=[];for(let r of e){let e=m(r,t,n);e&&i.push(e)}return t.active.delete(e),i}function m(e,t,n){if(h(t),"object"!=typeof e||null===e)return;let i=e,r=i.name,l=i.type;if("string"!=typeof r||0===r.length||"string"!=typeof l||0===l.length)return;let a=g(i.fields,t,n+1),o=function(e,t,n){if("object"==typeof e&&null!==e&&!Array.isArray(e)){f(e,t,n);let i=[];for(let r in e){if(!Object.hasOwn(e,r))continue;h(t);let l=Reflect.get(e,r);"object"!=typeof l||null===l||["__proto__","constructor","prototype"].includes(r)||i.push({...l,slug:r,fields:g(l.fields,t,n+1)})}return t.active.delete(e),i}if(!Array.isArray(e))return[];f(e,t,n);let i=[];for(let r of e){if(h(t),"object"!=typeof r||null===r)continue;let e=r,l=e.slug;if("string"!=typeof l||0===l.length)continue;let a=g(e.fields,t,n+1);i.push({...e,slug:l,fields:a})}return t.active.delete(e),i}(i.blocks,t,n+1),s={...i,name:r,type:l},u=i.relationTo;if(Array.isArray(u)){let e=[];for(let n of u)h(t),e.push(n);s.relationTo=e}return a.length>0?s.fields=a:delete s.fields,o.length>0?s.blocks=o:delete s.blocks,s}function v(e,t){return void 0===e||t(e)}function y(e,t){return null==e||t(e)}function b(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}function w(e,t=[]){let n="number"==typeof e&&Number.isFinite(e)&&e>=1?Math.floor(e):void 0,i=Math.min(4,n??1),r=new Set(t),l=new Set;for(let e of Vi)(i>=zi[e].since||r.has(e))&&l.add(e);return{ours:4,...void 0!==n?{theirs:n}:{theirs:void 0},negotiated:i,capabilities:l,observed:r}}function S(e,t){return e.generation===t.generation&&e.revision===t.revision}function A(e){return function(e){if(!1===e.enableA11y)return null;let t=e.root,n=void 0===t?void 0:function(e){return 9===e.nodeType}(t)?t:t.ownerDocument;return new Bi(e.a11yLocale,n)}(e)}function k(e){if(typ','eof window>"u")return;let t=[];window.parent!==window&&t.push(window.parent),window.opener instanceof Window&&t.push(window.opener),qi.sendReady(t,e)}function T(e,t,n,i){for(let r of e){if(Hi.has(r.type)){let e=r.fields;e&&T(e,i&&"tabs"===r.type?""===t?r.name:`${t}.${r.name}`:t,n,i);continue}let e=""===t?r.name:`${t}.${r.name}`;if(n.set(e,r),"group"===r.type)r.fields&&T(r.fields,e,n,i);else if("array"===r.type&&r.fields)T(r.fields,`${e}.*`,n,i);else if("blocks"===r.type&&r.blocks)for(let t of r.blocks)T(t.fields,`${e}.*.${t.slug}`,n,i)}}function C(e,t){if(e.has(t))return e.get(t);let n=t.replace(/\\.\\d+(?=\\.|$)/g,".*");return e.has(n)?e.get(n):void 0}function R(e){if("object"!=typeof e||null===e)return;let t=e.id;return"string"==typeof t||"number"==typeof t?t:void 0}function $(e){if("object"!=typeof e||null===e)return;let t=e.blockType;return"string"==typeof t?t:void 0}function F(e,t){return t.every(e=>void 0!==R(e))?function(e,t){let n=[],i=new Map;for(let t=0;t<e.length;t+=1){let n=R(e[t]);void 0!==n&&i.set(n,t)}let r=new Set;for(let l=0;l<t.length;l+=1){let a=t[l],o=R(a);if(void 0===o){n.push({kind:"insert",index:l,value:a});continue}let s=i.get(o);if(void 0===s){n.push({kind:"insert",index:l,value:a});continue}r.add(s);let u=e[s];$(u)===$(a)?(s!==l&&n.push({kind:"move",from:s,to:l,value:a}),N(u,a)||n.push({kind:"update",index:l,value:a})):n.push({kind:"replace",index:l,oldValue:u,value:a})}for(let t=0;t<e.length;t+=1)r.has(t)||n.push({kind:"remove",index:t,value:e[t]});return n}(e,t):function(e,t){let n=[],i=Math.min(e.length,t.length);for(let r=0;r<i;r+=1)N(e[r],t[r])||n.push({kind:"update",index:r,value:t[r]});if(t.length>e.length)for(let i=e.length;i<t.length;i+=1)n.push({kind:"insert",index:i,value:t[i]});if(e.length>t.length)for(let i=t.length;i<e.length;i+=1)n.push({kind:"remove",index:i,value:e[i]});return n}(e,t)}function N(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;let n=e,i=t,r=Object.keys(n),l=Object.keys(i);if(r.length!==l.length)return!1;for(let e of r)if(!Object.is(n[e],i[e]))return!1;return!0}function M(e){if("string"!=typeof e)return!1;let t=e.trim().replace(Qi,"");if(0===t.length)return!1;if(t.startsWith("#")||t.startsWith("?")||Xi.test(t)||t.startsWith("/"))return!0;try{let e=new URL(t);return Ki.has(e.protocol)}catch{return Ji.test(t)&&!function(e){let t=Yi.exec(e.replace(Zi,""))?.[1];return void 0!==t&&!Ki.has(`${t.toLowerCase()}:`)}(t)}}function O(e){let t=e.trim().replace(Qi,"");return/^https?:\\/\\//i.test(t)||Xi.test(t)}function E(e){return!e.startsWith("on")&&!er.has(e)}function L(e){return nr.add(e),e}function P(){return!0}function x(e,t,n,i=!1){if(i&&void 0!==n){let i=U(e,`${t}_${n}`);if(void 0!==i)return i}let r=U(e,t);if(void 0!==r)return r;if(t.includes(".")){let n=e,i=!0;for(let e of t.split(".")){if(rr.has(e)||null===n||"object"!=typeof n){i=!1;break}if(n=U(n,e),void 0===n){i=!1;break}}if(i)return n}return void 0===n?void 0:U(e,`${t}_${n}`)}function U(e,t){if(!rr.has(t)&&Object.prototype.hasOwnProperty.call(e,t))return e[t]}function I(e,t,n,i){return x(e,n,t.locale??i,void 0!==t.locale)}function j(e,t,n,r){let l=i(t);if(void 0===l)return;let a=[e.hrefField,e.srcField,e.altField],o=JSON.stringify([e.format,e.locale??r])+l;for(let t of a){if(void 0===t||0===t.length)continue;let l=i(I(n,e,t,r));if(void 0===l)return;o+=`|${t}=${l}`}return o}function D(e){return e.closest(`[${lr}]`)}function W(e,t,n){let i=new Set(t);return{boundaries:t,strategy:e,ownerKeys:n,covers:e=>void 0!==e.fragmentBoundary&&i.has(e.fragmentBoundary)}}function B(e){let t=e.getAttribute(or);return null!==t&&t.length>0?"patch"===t||"fragment"===t||"route"===t?t:void 0:null!==D(e)?"fragment":null!==e.closest("head")?"route":"patch"}function _(e){return`global:${e}`}function z(e,t){return void 0===t||""===t?`collection:${e}`:`collection:${e}:${t}`}function V(e){return"string"==typeof e&&e.length>0}function q(e,t){return null!==t&&void 0!==e&&t.includes(e)}function H(e){let t=e.id;return"string"==typeof t&&t.length>0?t:"number"==typeof t&&Number.isFinite(t)?String(t):void 0}function G(e){return"object"==typeof e&&null!==e}function K(e){return Array.isArray(e)?"array":G(e)?"object":"scalar"}function J(e,t){return G(e)?e[t]:void 0}function X(e,t){return("string"==typeof t||"number"==typeof t)&&G(e)&&!Array.isArray(e)&&e.id===t}function Q(e,t){if(!G(e)||!G(t))return X(e,t)||X(t,e)||i(e)===i(t);if(Array.isArray(e)!==Array.isArray(t))return!1;let n=Object.keys(t);return n.length===Object.keys(e).length&&n.every(n=>Object.hasOwn(e,n)&&Q(J(e,n),J(t,n)))}function Z(e,t){let n=i(t),r=i(e);return!!(void 0!==n&&n===r||X(e,t)||X(t,e))||void 0!==n&&void 0!==r&&Q(e,t)}function Y(e,t,n){let i=t,r=n;for(let t of e.split("."))i=J(i,t),r=J(r,t);return!Z(i,r)}function ee(e,t,n,i){let r=[],l=0,a=(e,t,n,o)=>{if(l+=1,i.covers(e)||Z(t,n))return;if(!((void 0===t||K(t)===K(n))&&G(n)&&i.reachesBelow(e)&&o<sr)){r.push({path:e,value:n});return}let s=function(e,t){let n=new Set(Object.keys(t));if(G(e))for(let t of Object.keys(e))n.add(t);return[...n]}(t,n);0===s.length&&r.push({path:e,value:n});for(let i of s){if(l>=ur){r.push({path:e,value:n});return}a(`${e}.${i}`,J(t,i),J(n,i),o+1)}};return a(e,t,n,0),r}function te(e,t,n={}){let i=e=>!1===t||q(e,t),r=[];for(let[t,n]of e.entries())n.some(e=>i(e.owner))&&r.push(t);let l=e.rendered.filter(e=>void 0!==n[e.strategy]);return function(e,t){let n=new Set(e),i=[...t],r=(e,t)=>{let n=`${t}.`;for(let t of e)if(t.startsWith(n))return!0;return!1};return{covers:e=>n.has(e)||i.some(t=>t===e||e.startsWith(`${t}.`)),reachesBelow:e=>r(n,e)||r(i,e)}}(r,[...e.covers,...l].filter(e=>i(e.owner)).flatMap(e=>e.paths))}function ne(e,t){if(void 0===t||0===t.length)return e;let n=`_${t}`;return e.endsWith(n)?e.slice(0,-n.length):e}function ie(e,t,n,i=te(e,n)){let r,l=i.covers,a=i.reachesBelow;return i=>{let o=ne(i,t);return l(i)||o!==i&&l(o)||(r??(r=function(e,t){let n=new Set;for(let[i,r]of e.entries())for(let e of r)!1!==t&&!q(e.owner,t)||void 0!==e.locale&&n.add(`${i}_${e.locale}`);return n}(e,n)),r.has(i))?"whole":a(i)||o!==i&&a(o)?"below":"none"}}function re(e,t,n,i,r){let l=te(e,i,r),a=ie(e,n,i,l),o=[];for(let[e,i]of Object.entries(t)){if(dr.has(e)||"below"!==a(e))continue;let t=ne(e,n);o.push(...ee(t,void 0,i,l))}return o}function le(e,t,n,i,r){return se(n)?!se(t)||function(e,t,n){let i=void 0===n?void 0:C(n,e);return void 0!==i&&!cr.has(i.type)||!0===t.get(e)?.some(ae)||function(e,t){let n=`${t}.`;for(let[t,i]of e.entries())if(t.startsWith(n))return!0;return!1}(t,e)}(e,i,r)?"keep":null==t?"ask":"own":"ask"}function ae(e){return!cr.has(e.fieldType)}function oe(e){let t=[e],n=new Set;for(let e=t.pop();void 0!==e;e=t.pop()){if("object"!=typeof e||null===e||n.has(e))continue;n.add(e);let{type:i,fields:r,children:l}=e;if(!hr.has(i)||"internal"===r?.linkType)return!0;if(Array.isArray(l))for(let e of l)t.push(e)}return!1}function se(e){return null===e||"object"!=typeof e&&"function"!=typeof e}function ue(e){return!0===e?.includes(".")}function de(){if(typ','eof window>"u")return!1;try{return window.self!==window.top}catch{return!0}}function ce(){let e=function(){if(typ','eof process>"u")return;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}function he(e,t){let n=t.globalSlug??t.collectionSlug;if("string"!=typeof n||e.entitySlug!==n)return!0;let i=H(e),r=H(t.data??{});return void 0!==i&&void 0!==r&&i!==r}function fe(e){return null!==e&&e.forceRender&&!e.completed}function pe(e){try{return!0===e.matchMedia?.("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function ge(e,t){let n=t.element.ownerDocument.defaultView;return null===n?"no-element":e.reveal(`${t.owner??""} ${t.fieldName}`,t.element,n)}function me(e){let t=e.getAttribute(ar);return{kind:"fragment",id:e.getAttribute(lr)??"",key:null===t||0===t.length?void 0:t,code:"LP0801"}}function ve(e){if("object"!=typeof e||null===e||!("root"in e))return!1;let t=e.root;return"object"==typeof t&&null!==t&&Array.isArray(t.children)}function ye(e){return!!ve(e)&&e.root.children.every(e=>{let{type:t,children:n}=e??{};return"paragraph"===t&&(!Array.isArray(n)||0===n.length)})}function be(e){if(null==e)return[];let t=new Set,n=[];for(let i of e.split(/[\\s,]+/)){let e=i.trim();0===e.length||t.has(e)||(t.add(e),n.push(e))}return n}function we(...e){let t=new Map;for(let n of e)for(let[e,i]of Object.entries(n)){let n=t.get(e);void 0===n&&(n=new Set,t.set(e,n));for(let e of i)n.add(e)}let n={};for(let[e,i]of t)n[e]=[...i];return n}function Se(e,t){let n={};for(let i of t)i!==e&&(n[i]=[e]);return n}function Ae(e){if(e.tagName.toLowerCase().includes("-")&&!e.hasAttribute(Fr)||Te(e)||e.hasAttribute($r))return!0;let t=e.getAttribute("contenteditable");return null!==t&&"false"!==t}function ke(e){return"patch"===e.getAttribute(Cr)}function Te(e){return function(e){return"astro-island"===e.tagName.toLowerCase()||e.hasAttribute(Cr)}(e)&&!ke(e)}function Ce(e){return"astro-island"===e.tagName.toLowerCase()&&e.hasAttribute("ssr")}function Re(e){return"astro-island"===e.tagName.toLowerCase()}function $e(e){let t="";for(let n of e.querySelectorAll("astro-slot, template[data-astro-template]"))n.parentElement?.closest("astro-island")===e&&(t+=`${n.getAttribute("name")??n.getAttribute("data-astro-template")??""}\\0${n.innerHTML}\\0`);return t}function Fe(e,t){if(!Re(e)||!Re(t))return!0;let n=$e(t);if(!Nr.every(n=>e.getAttribute(n)===t.getAttribute(n))||(Mr.get(e)??$e(e))!==n||e.getAttribute("props")!==t.getAttribute("props")&&!function(e){let t=e.ownerDocument.defaultView?.customElements.get("astro-island");return void 0!==t&&e instanceof t&&Array.isArray(t.observedAttributes)&&t.observedAttributes.includes("props")}(e))return Mr.set(t,n),!1;Mr.set(e,n);let i=t.getAttribute("props");return i!==e.getAttribute("props")&&(e.setAttribute("ssr",""),null===i?e.removeAttribute("props"):e.setAttribute("props",i)),!0}function Ne(e){return Array.from(e.querySelectorAll("astro-island"))}function Me(e){let t=e.ownerDocument.defaultView;if(void 0===t?.customElements.get("astro-island"))return"element";let n=e.getAttribute("client"),i=Reflect.get(t,"Astro");return null===n||"object"!=typeof i||null===i||void 0===Reflect.get(i,n)?"directive":void 0}function Oe(e){let t=e.closest(el)?.getAttribute(Hr);return null==t||0===t.length?void 0:t}function Ee(e){return il.has(e)||nl.test(e)}function Le(e,t){return e.fieldName===t.fieldName&&e.locale===t.locale&&e.owner===t.owner&&e.strategyKind===t.strategyKind&&e.fragmentBoundary===t.fragmentBoundary}function Pe(e){let t=e.getAttribute(Lr);if(null!==t&&Ee(t))return t;if(e.hasAttribute(_r))return"richText";if(e.hasAttribute(zr))return"html";if(e.hasAttribute(qr))return"structural-array";if(e.hasAttribute(Vr))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 xe(){return!0}function Ue(){throw new Error("invalid or oversized legacy population")}function Ie(e){for(let t=0;t<e.length;t+=1){let n=e.charCodeAt(t);if(n<=31||127===n)return!0}return!1}function je(e,t){if("string"!=typeof e||0===e.length||e.length>t||"."===e||".."===e||e.includes("/")||e.includes("\\\\")||Ie(e))return!1;try{return encodeURIComponent(e),!0}catch{return!1}}function De(e){return je(e,128)&&!/[?#%]/u.test(e)&&!fl.has(e)}function We(e){return Number.isFinite(e)?String(e):je(e,512)?e:Ue()}function Be(e,t){return Object.hasOwn(e,t)?Reflect.get(e,t):void 0}function _e(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0,enumerable:!0})}function ze(e){let t=e.length;for(;t>0&&47===e.charCodeAt(t-1);)t-=1;return e.slice(0,t)}function Ve(e){let t=new WeakSet,n=0,i=0;return function e(r,l){if(++n>al||l>ll)return Ue();if("string"==typeof r)return i+=r.length,i>dl&&Ue(),r;if(null==r||"boolean"==typeof r)return r;if("number"==typeof r)return Number.isFinite(r)?r:Ue();if(!Array.isArray(r)&&!b(r))return Ue();if(Array.isArray(r)){r.length>al&&Ue();for(let e=0;e<r.length;e+=1)Object.hasOwn(r,e)||Ue()}if(t.has(r))return Ue();t.add(r);let a=Array.isArray(r)?[]:{};for(let t of Object.keys(r))_e(a,t,e(Reflect.get(r,t),l+1));return t.delete(r),a}(e,0)}function qe(e,t,n,i,r,l){function a(e,t,n,i){if(null==i||""===i)return;let l=b(i)?Be(i,"id"):i,a=We(l);if(0===r){_e(e,t,l);return}let o=JSON.stringify([n,a]);c.add(o),c.size>ol&&Ue();let s=d.get(n)??[];s.push({owner:e,key:t,id:a}),d.set(n,s)}function o(e,t,n){void 0!==n.hasMany&&"boolean"!=typeof n.hasMany&&Ue();let i=n.relationTo,r=Be(e,t);if(Array.isArray(i)){0===i.length&&Ue();let e,t=b(r)?Be(r,"relationTo"):void 0;for(let n of i)p(0),De(n)||Ue(),n===t&&(e=n);if(null==r||""===r)return;(!b(r)||void 0===e)&&Ue(),a(r,"value",e,Be(r,"value"))}else De(i)||Ue(),a(e,t,i,r)}function s(e,t){if(p(t),Array.isArray(e)||b(e)){if(b(e)&&Object.hasOwn(e,"relationTo")&&Object.hasOwn(e,"value")){let t=Be(e,"relationTo");De(t)||Ue(),a(e,"value",t,Be(e,"value"));return}for(let n of Object.keys(e))s(Reflect.get(e,n),t+1)}}if(!Number.isSafeInteger(r)||r<0||r>ll)return Ue();void 0!==l&&("string"!=typeof l||l.length>128||Ie(l))&&Ue();let u=Ve(e);if(!b(u))return Ue();let d=new Map,c=new Set,h=0,f=new WeakSet,p=e=>{(++h>al||e>ll)&&Ue()};(function e(t,n,i){p(i),f.has(t)&&Ue(),f.add(t);for(let r of t){p(i),(!b(r)||!je(r.name,512)||fl.has(r.name))&&Ue();let t=Be(n,r.name);if("relationship"===r.type||"upload"===r.type)if(r.hasMany)if(null!=t&&!Array.isArray(t)&&Ue(),Array.isArray(t))for(let e=0;e<t.length;e+=1)o(t,e,r);else o(n,r.name,r);else o(n,r.name,r);else if("group"===r.type||"tabs"===r.type)null!=t&&!b(t)&&Ue(),b(t)&&r.fields&&e(r.fields,t,i+1);else if("row"===r.type||"collapsible"===r.type)r.fields&&e(r.fields,n,i+1);else if("array"===r.type||"blocks"===r.type){if(0===t?_e(n,r.name,[]):null!=t&&!Array.isArray(t)&&Ue(),Array.isArray(t))for(let n of t)if(b(n)||Ue(),"array"===r.type&&r.fields)e(r.fields,n,i+1);else if("blocks"===r.type){let t=Be(n,"blockType"),l=r.blocks?.find(e=>(p(i),e.slug===t));void 0===l&&Ue(),e(l.fields,n,i+1)}}else"richText"===r.type&&s(t,i+1)}f.delete(t)})(t,u,0),d.size>25&&Ue();let g=[];if(0===d.size)return{doc:u,requests:g};let m=new URL(n);(!["http:","https:"].includes(m.protocol)||m.username||m.password||m.search||m.hash)&&Ue(),(!i.startsWith("/")||i.includes("\\\\")||/[%?#]/u.test(i)||Ie(i))&&Ue(),i.split("/").some(e=>"."===e||".."===e)&&Ue();let v=`${ze(n)}${ze(i)}/`;for(let[e,t]of d){let n=[...new Set(t.map(e=>e.id))],i=0;for(;i<n.length;){let a=n[i];void 0===a&&Ue();let o=a.includes(","),s=[],u="";for(;i<n.length&&s.length<hl;){let t=n[i];if(void 0===t||s.length>0&&(o||t.includes(",")))break;let a=[...s,t],d=new URLSearchParams({depth:String(r),limit:String(a.length)});void 0!==l&&d.set("locale",l),d.set(o?"where[id][equals]":"where[id][in]",o?t:a.join(","));let c=`${v}${encodeURIComponent(e)}?${d}`;if(c.length>ul){0===s.length&&Ue();break}new URL(c).origin!==m.origin&&Ue(),s.push(t),i+=1,u=c}(0===s.length||g.length>=sl)&&Ue();let d=new Set(s);g.push({url:u,ids:d,slots:t.filter(e=>d.has(e.id))})}}return{doc:u,requests:g}}async function He(e,t,n){let i,r,l=!1,a=!1,o=Symbol(),s=new Promise(e=>{r=()=>{e(o)}}),u=()=>{(!n()||t.aborted)&&Ue()},d=()=>{if(void 0!==i&&!l){l=!0;try{Promise.resolve(i.cancel()).catch(()=>{})}catch{}}},c=()=>{r?.(),d()};t.addEventListener("abort",c,{once:!0});try{u();let t=e.body??null;if(u(),null===t){let t=e.json.bind(e);u();let n=await Promise.race([Promise.resolve().then(()=>(u(),t())),s]);return u(),n===o&&Ue(),n}let n=t.getReader.bind(t);u();let r=n();i=r,u();let l=[],d=0,c=0;for(;;){let e=Promise.resolve().then(()=>{u();let e=r.read.bind(r);return u(),e()}),t=await Promise.race([e,s]);if(u(),t===o&&Ue(),t.done)break;d+=t.value.byteLength,(++c>cl||d>dl)&&Ue(),l.push(t.value)}a=!0;let h=new Uint8Array(d),f=0;for(let e of l)h.set(e,f),f+=e.byteLength;try{return JSON.parse((new TextDecoder).decode(h))}catch{return Ue()}}finally{t.removeEventListener("abort",c),a||d();try{i?.releaseLock()}catch{}}}function Ge(e,t){let n=Ve(t);b(n)||Ue();let i=Be(n,"docs");(!Array.isArray(i)||i.length>hl)&&Ue();let r=new Map;for(let t of i){b(t)||Ue();let n=We(Be(t,"id"));(!e.ids.has(n)||r.has(n))&&Ue(),r.set(n,t)}r.size!==e.ids.size&&Ue();for(let t of e.slots)_e(t.owner,t.key,r.get(t.id))}function Ke(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 Je(e){return Ke(e,128)&&!e.includes("?")&&!e.includes("#")}function Xe(e){return"number"==typeof e?Number.isFinite(e):"string"==typeof e&&Ke(e,512)}function Qe(e){return e.has("schema-json")?vl:e.has("document-events")||e.has("relationship-events")?yl:bl}function Ze(e){if("attributes"!==e.type||e.attributeName!==wl||e.target.nodeType!==Sl)return null;let t=e.target;return"astro-island"!==t.tagName.toLowerCase()||t.hasAttribute(wl)?null:t}function Ye(e){if(e.nodeType!==Sl)return!1;let t=e;return t.matches(kl)||null!==t.querySelector(kl)}function et(){if(typ','eof window>"u")return;let e=window;return e[Ol]??(e[Ol]={armed:!1,committed:!1,commits:[],onCommit:void 0,waiters:[]})}function tt(){let e=et();if(void 0===e||e.armed)return;e.armed=!0;let t=window,n=t.__REACT_DEVTOOLS_GLOBAL_HOOK__??(t.__REACT_DEVTOOLS_GLOBAL_HOOK__=function(){let e=new Map;return{supportsFiber:!0,renderers:e,inject:t=>{let n=e.size+1;return e.set(n,t),n}}}()),i=n.onCommitFiberRoot;n.onCommitFiberRoot=function(t,n,...r){try{i?.call(this,t,n,...r)}catch{}void 0===e.onCommit?e.commits.push(n):e.onCommit(n)}}function nt(e){e.committed=!0;let t=e.waiters;e.waiters=[];for(let e of t)e()}function it(e,t){let n=e.waiters.indexOf(t);n>=0&&e.waiters.splice(n,1)}function rt(e,t,n){if(e.committed)return null;let i=null,r=()=>{null!==i&&clearTimeout(i),i=null,t("committed")};return e.waiters.push(r),i=setTimeout(()=>{i=null,it(e,r),t("timed-out")},n),()=>{null!==i&&clearTimeout(i),i=null,it(e,r)}}function lt(){if(typ','eof window>"u")return;let e=window;return e[Pl]??(e[Pl]={armed:!1,committed:!1,waiters:[]})}function at(e){return Object.prototype.hasOwnProperty.call(e,Ll)?e[Ll]:void 0}function ot(){let e=lt();if(void 0===e||e.armed)return;e.armed=!0;let t=Element.prototype;void 0===Object.getOwnPropertyDescriptor(t,Ll)&&Object.defineProperty(t,Ll,{configurable:!0,get:()=>{},set(e){Object.defineProperty(this,Ll,{value:e,writable:!0,configurable:!0,enumerable:!0});let t=lt();void 0===t||t.committed||null===this.querySelector(El)||function(e,t){let n=t?.$nuxt;!0!==n?.isHydrating||"function"!=typeof n.hook?nt(e):n.hook(xl,()=>{e.committed||nt(e)})}(t,e)}})}function st(e){let t=e.hydration;if(void 0===t){e.startNow();return}let n=Il[t](e.root,n=>{e.later(()=>{ut(e,t,n)})});null!==n?(e.defer(n),e.hydrated("waiting")):ut(e,t,"committed")}function ut(e,t,n){e.hydrated(n),"timed-out"===n&&e.warn(`[live-preview] LP0607: no ${jl[t]} in ${String(5e3)} ms; started without waiting for hydration.`),e.startNow()}function dt(e){return 9===e.nodeType}function ct(e){return e.body}function ht(e,t=_l){if("string"!=typeof e)return!1;let n=e.trim();return!(n.length<t||Vl.test(n)||zl.has(n.toLowerCase())||ql.test(n)||Hl.test(n))}function ft(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function pt(e,t,n=_l){let i=new Map,r=(e,t,n)=>{i.set(e,i.has(e)?null:{field:t,media:n})};for(let[i,l]of Object.entries(e)){if(dr.has(i))continue;let e=ne(i,t);if(ht(l,n))r(l.trim(),e,!1);else if(ft(l))if("string"==typeof l.url)r(l.url,e,!0);else if(!("id"in l)&&!("_id"in l))for(let[t,i]of Object.entries(l))dr.has(t)||!ht(i,n)||r(i.trim(),`${e}.${t}`,!1)}return i}function gt(e){if(e.namespaceURI!==Kl||Gl.has(e.tagName)||e.hasAttribute(Er)||e.hasAttribute(Bl)||e.hasAttribute($r)||Te(e))return!0;let t=e.getAttribute("contenteditable");return null!==t&&"false"!==t}function mt(e){let t;for(let n=e.firstChild;null!==n;n=n.nextSibling){if(1===n.nodeType)return;if(3!==n.nodeType)continue;let e=n.data.trim();if(0!==e.length){if(void 0!==t)return;t=e}}return t}function vt(e){return E(e)&&!e.startsWith("data-payload-")&&"value"!==e}function yt(e,t,n){let i=e.byElement.get(t);void 0===i&&(i={attributes:new Map},e.byElement.set(t,i));let r=e.byField.get(n.field);return void 0===r&&(r=new Set,e.byField.set(n.field,r)),r.add(t),i}function bt(e,t){for(let n=e.firstElementChild;null!==n;n=n.nextElementSibling){if(gt(n))continue;let e=mt(n),i=void 0===e?void 0:t.values.get(e);null!=i&&!i.media&&(yt(t,n,i).text=i.field);for(let e of n.getAttributeNames()){if(!vt(e))continue;let i=t.values.get(n.getAttribute(e)??"");null!=i&&(i.media&&("IMG"!==n.tagName||"src"!==e)||yt(t,n,i).attributes.set(e,i))}bt(n,t)}}function wt(e,t,n){let i=e.tagName;if(void 0!==t){let r={[Er]:t};if("A"===i){let e=n.get("href");void 0===e?r[Lr]="text":e!==t&&(r[xr]=e)}return{element:e,fieldName:t,matched:mt(e)??"",stamps:r}}if("IMG"===i){let t=n.get("src");if(void 0!==t){let i=n.get("alt");return{element:e,fieldName:t,matched:e.getAttribute("src")??"",attribute:"src",stamps:{[Er]:t,...void 0!==i&&i!==t?{[Ir]:i}:{}}}}}let r=n.entries().next();if(r.done)return;let[l,a]=r.value;return{element:e,fieldName:a,matched:e.getAttribute(l)??"",attribute:l,stamps:{[Er]:a,[Pr]:l}}}function St(e,t){let n={values:t,byElement:new Map,byField:new Map};t.size>0&&!gt(e)&&bt(e,n);let i=e=>1===n.byField.get(e)?.size,r=[];for(let[e,t]of n.byElement){let n=void 0!==t.text&&i(t.text)?t.text:void 0,l=new Map;for(let[e,n]of t.attributes)i(n.field)&&l.set(e,n.field);let a=wt(e,n,l);void 0!==a&&r.push(a)}return r}function At(e){return 9===e.nodeType?e.body:e}function kt(e,t){for(let n=t.length-1;n>=0;n-=1){let i=t[n];if(void 0!==i){i.observed&&e.observers.unobserveElement(i.element);for(let e=i.attributes.length-1;e>=0;e-=1){let t=i.attributes[e];if(void 0===t)continue;let{name:n,before:r,written:l}=t;r===l||i.element.getAttribute(n)!==l||(null===r?i.element.removeAttribute(n):i.element.setAttribute(n,r))}i.cacheTouched&&(i.element.hasAttribute(Er)?e.cache.add(i.element):e.cache.remove(i.element))}}}function Tt(e,t,n,i,r){let l=[],a=[],o=()=>(kt(e,a),[]);for(let s of t){if(!r())return o();let{element:t}=s;if(t.hasAttribute(Er))continue;if(!r())return o();if(!1!==n&&!q(Oe(t),n))continue;if(!r())return o();let u={element:t,attributes:[],cacheTouched:!1,observed:!1};a.push(u);for(let[e,n]of[...Object.entries(s.stamps),[Xr,s.matched]]){let i=t.getAttribute(e);if(!r()||(u.attributes.push({name:e,before:i,written:n}),t.setAttribute(e,n),!r()))return o()}if(u.cacheTouched=!0,void 0!==e.cache.add(t)){if(!r()||(e.observers.observeElement(t),u.observed=!0,!r())||(e.log("autoBind",s.fieldName,"\\u2192",`<${t.tagName.toLowerCase()}>`,s.attribute??"text",JSON.stringify(s.matched),i),!r()))return o();l.push(s)}else kt(e,[u]),a.pop()}return l}function Ct(e,t,n,i,r){let a=function(e,t){let n,i=e;for(let e of t.split(".")){if("object"!=typeof i||null===i)break;i=i[e];let t=/^\\d+$/.test(e)?i?.id:null;("string"==typeof t||"number"==typeof t)&&(n=`${n??""}/${String(t)}`)}return n}(i,n.fieldName);if(void 0===a)return;if(r){t.rowsOfBinding.delete(n.element);return}let o=t.rowsOfBinding.get(n.element);t.rowsOfBinding.set(n.element,a),void 0!==o&&o!==a&&l(e,t,n,"stands in a row that moved",a)}function Rt(e,t,n,i){if(!e.scopeBindingsByOwner)return!1;let{message:r}=n,l=function(e){if(V(e.globalSlug))return[_(e.globalSlug)];if(!V(e.collectionSlug))return null;let t=z(e.collectionSlug);return V(e.documentId)?[t,z(e.collectionSlug,e.documentId)]:[t]}({globalSlug:"string"==typeof r.globalSlug?r.globalSlug:void 0,collectionSlug:"string"==typeof r.collectionSlug?r.collectionSlug:void 0,documentId:H(i)});return null===l&&!t.warnedUnattributableMessage&&(t.warnedUnattributableMessage=!0,e.warn("[live-preview] LP0202: scopeBindingsByOwner: update names no document; nothing applied")),l}function $t(e,t,n,i,r){!function(e,t,n){let i=0;for(let r of e)if(!n()||(r.dispatchEvent(new CustomEvent(Tr,{detail:t,bubbles:!1})),i+=1,!n()))break}(n,{fields:t.fields,revision:e.revision.revision,receivedAt:e.receivedAt,locale:e.locale,displayed:r},i)}function Ft(e,t,n,i,r){let{warned:l,warn:a}=e;if(l.has(n)||t(n))return;l.add(n);let o=`data-payload-field="${ne(n,i)}"`;a(""!==r?`[live-preview] LP0203: field "${n}" has a value and no <\\u2026 ${o}> 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 ${o}> for the empty field "${n}"; render the anchor unconditionally so edits to an empty field have somewhere to land.`)}function Nt(e){let t=typeof e;return"string"===t||"number"===t||"boolean"===t||"bigint"===t}function Mt(e){return Array.isArray(e.docs)&&"boolean"==typeof e.hasNextPage}function Ot(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Et(e){let t=function(){let e=function(){let e=globalThis,t=e[Zl];if(void 0!==t)return t;let n={};return e[Zl]=n,n}();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(Ql,{createHTML:e=>e})}catch{e.auto=null}return e.auto}();return null===t?e:t.createHTML(e)}function Lt(e,t){for(let n of t.keyAttributes){let t=e.getAttribute(n);if(null!==t&&t.length>0)return`${n}=${t}`}}function Pt(e,t,n){if(!It(e,t))return t;let i=n.boundary??Ae,r=i(e),l=i(t);if(r||l)return r&&l&&(n.retainBoundary?.(e,t)??1)?e:t;let a=jt(e);return function(e,t){for(let n of Array.from(e.attributes))t.hasAttribute(n.name)||Yl.has(n.name.toLowerCase())||e.removeAttribute(n.name);for(let n of Array.from(t.attributes))e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value)}(e,t),!0!==n.retainChildrenOf?.(e,t)&&function(e,t,n){let i=function(e,t){let n,i=new Map;for(let r of Array.from(e.children)){let e=Lt(r,t);if(void 0!==e){if(i.has(e)){n??(n=e.slice(e.indexOf("=")+1));continue}i.set(e,r)}}return void 0!==n&&t.onDuplicateKey?.(e,n),i}(e,n),r=new Set(i.values()),l=Array.from(e.childNodes).filter(e=>!r.has(e)),a=new Set,o=new Set,s=Array.from(t.childNodes),u=e.firstChild,d=0;for(let t=0;t<s.length;t+=1){let r=s[t],c=null,h=r instanceof Element?Lt(r,n):void 0;if(void 0!==h&&o.has(h)&&(h=void 0),void 0!==h){o.add(h);let e=i.get(h);if(void 0!==e&&!a.has(e)&&(c=xt(e,r,n)===e?e:null,null===c)){e.replaceWith(r),a.add(r),u=r.nextSibling;continue}}else{for(;d<l.length;){let i=l[d];if(d+=1,!a.has(i)){if(It(i,r)){c=xt(i,r,n)===i?i:null,null===c&&(e.replaceChild(r,i),a.add(r),u=r.nextSibling);break}if(i instanceof Element){let n=s[t+1];if(!(r instanceof Element)||void 0!==n&&It(i,n)){d-=1;break}e.replaceChild(r,i),a.add(r),u=r.nextSibling;break}if(!(r instanceof Element)){e.replaceChild(r,i),a.add(r),u=r.nextSibling;break}}}if(null===c&&a.has(r))continue}let f=c??r;for(a.add(f);null!==u&&u!==f&&!a.has(u)&&Ut(u);)u=u.nextSibling;f!==u&&e.insertBefore(f,u),u=f.nextSibling}for(let t of Array.from(e.childNodes))a.has(t)||t.remove()}(e,t,n),Dt(a),e}function xt(e,t,n){return e instanceof Element&&t instanceof Element?Pt(e,t,n):(e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e)}function Ut(e){return e.nodeType===Node.TEXT_NODE&&0===(e.nodeValue??"").trim().length}function It(e,t){return e.nodeType===t.nodeType&&(!(e instanceof Element&&t instanceof Element)||e.tagName===t.tagName&&e.namespaceURI===t.namespaceURI)}function jt(e){let t=e.ownerDocument.activeElement;return t instanceof HTMLElement&&e.contains(t)?{element:t,selection:t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?[t.selectionStart,t.selectionEnd]:null}:null}function Dt(e){if(null===e)return;let{element:t,selection:n}=e;if(t.ownerDocument.activeElement!==t&&t.isConnected)try{t.focus({preventScroll:!0});let[e,i]=n??[null,null];null!==e&&null!==i&&t.setSelectionRange(e,i)}catch{}}function Wt(e){ta.has(e)||(ta.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(na)?"A binding inside CMS content is refused by design \\u2014 an editor could otherwise aim a write at any element on the page (docs/security.md)":"id"===e||"name"===e?"CMS content that can name an element can shadow a global of that name \\u2014 DOM clobbering, refused by design (docs/security.md)":"Put it on an element the template owns, or set `sanitizerPolicy: \'compat\'` to keep every `data-*` as 1.x did"}(e)}.`))}function Bt(e,t){return _t(e,void 0,t)}function _t(e,t,n){let i=n?.document??qt();if(!i)throw zt();if(""===e)return"";let r=function(e,t){let n=e?.policy??t??ma;if(!e){let e=new Map;for(let[t,n]of Object.entries(da))e.set(t,n);return{allowedTags:ia,attrByTag:e,allowFormControls:!1,templateMode:!1,mode:n,allowedData:new Set}}let i=new Set(ia);if(e.additionalAllowedTags?.forEach(e=>i.add(e)),!0===e.allowFormControls)for(let e of ra)i.add(e);let r=new Map;for(let[e,t]of Object.entries(da))r.set(e,t);for(let[t,n]of Object.entries(e.additionalAllowedAttributes??{})){let e=new Set(r.get(t));for(let t of n)e.add(t);r.set(t,e)}return{allowedTags:i,attrByTag:r,allowFormControls:!0===e.allowFormControls,templateMode:!0===e.templateMode,mode:n,allowedData:new Set(e.allowedDataAttributes?.map(e=>e.toLowerCase()))}}(n,t),l=e;for(let e=0;e<ha;e+=1){let e=i.createElement("template");e.innerHTML=Et(l);let t=e.content;Ht(t,r);let n=Vt(t);if(n===l)return n;l=n}return function(e,t){if(!function(){try{let e=glo','balThis.process?.env;return void 0!==e&&"production"!==e.NODE_ENV}catch{return!1}}())return;let n=globalThis,i=n[ea]??(n[ea]=new Set);if(!i.has(e)){i.add(e);try{console.warn(`[payload-live-preview] ${t}`)}catch{}}}("sanitizer-unsettled",`sanitizeHtml: the output did not settle after ${String(ha)} passes, so it returned an empty string (ADR 0016).`),""}function zt(){return new Error("sanitizeHtml needs a DOM")}function Vt(e){let t=e.ownerDocument?.createElement("div");if(void 0===t)throw zt();let n=e.firstChild;if(t.append(e),t.firstChild!==n)throw zt();return t.innerHTML}function qt(){if(!(typ','eof document>"u"))return document}function Ht(e,t){for(let n of Array.from(e.childNodes))n.nodeType===fa?Gt(n,t):n.nodeType===pa&&n.remove()}function Gt(e,t){let n=e.tagName.toLowerCase();!la.has(n)||t.allowFormControls&&ra.has(n)?t.allowedTags.has(n)?(function(e,t,n){let i=n.attrByTag.get(t);for(let t of Array.from(e.attributes)){let r=t.name.toLowerCase();if(r.startsWith("on")||"style"===r)e.removeAttribute(t.name);else if("is"!==r){if("strict"===n.mode){if(n.templateMode&&ga.has(r))continue;if("id"===r||"name"===r||r.startsWith(ua)){e.removeAttribute(t.name),("name"!==r||!0===i?.has(r))&&Wt(r);continue}if(r.startsWith(sa)){n.allowedData.has(r)||(e.removeAttribute(t.name),Wt(r));continue}if(aa.has(r)||r.startsWith(oa))continue}else if(aa.has(r)||r.startsWith(oa)||r.startsWith(sa))continue;i?.has(r)?(ca.has(r)&&!M(t.value)||"srcset"===r&&!Kt(t.value)||"ping"===r&&!t.value.trim().split(/\\s+/u).every(M))&&e.removeAttribute(t.name):e.removeAttribute(t.name)}else e.setAttribute("is","")}}(e,n,t),"a"===n&&function(e){let t=e.getAttribute("href");null===t||!O(t)||(e.setAttribute("rel","noopener noreferrer"),e.hasAttribute("target")||e.setAttribute("target","_blank"))}(e),Ht(e,t)):(Ht(e,t),e.replaceWith(...e.childNodes)):e.remove()}function Kt(e){for(let t of e.split(",")){let e=t.trim();if(0===e.length)continue;let[n=e]=e.split(/\\s/,1);if(!M(n)||!M(e))return!1}return!0}function Jt(e){return e.replace(ya,e=>va[e])}function Xt(e){return e.replace(wa,e=>ba[e])}function Qt(e){let t=new Set;for(let n of e)if("object"==typeof n&&null!==n)for(let e of Object.keys(n))t.add(e);return t}function Zt(e,t,n,i,r){let l="object"==typeof t&&null!==t?t:null;return e.replace(Sa,(e,a)=>null!==l&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(l,a)?Jt(i(Reflect.get(l,a))):null===l&&"value"===a?Jt(i(t)):"index"===a?String(n):null!==l&&!0===r?.has(a)?"":e)}function Yt(e){let t=e.children,n=t[0];if(void 0===n)return[];let i=[];for(let{name:e,value:r}of Array.from(n.attributes)){if(!E(e)||e.startsWith(Aa))continue;let n=!0;for(let i=1;i<t.length&&n;i+=1)n=t[i]?.getAttribute(e)===r;n&&i.push([e,r])}return i}function en(e,t){for(let[n,i]of t)e.hasAttribute(n)||e.setAttribute(n,i)}function tn(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 nn(e){return null==e||""===e}function rn(e,t){let n=e.get(t);return void 0!==n&&(e.delete(t),e.set(t,n)),n}function ln(e,t,n,i){return e.set(t,n),function(e,t){for(let n of e.keys()){if(e.size<=t)break;e.delete(n)}}(e,i),n}function an(e){let t=rn($a,e);if(void 0!==t)return t;let n=new Set(ka);for(let t of e.matchAll(Ca)){let e=t[1]?.toLowerCase();void 0!==e&&n.add(e)}let i={};for(let e of n)i[e]=Ta;let r={additionalAllowedTags:[...n],additionalAllowedAttributes:i,allowFormControls:!0,templateMode:!0};return ln($a,e,r,Ra)}function on(e){let t=un(e.container,e.patches,e);return null===t?null:dn(t,e.store,{morph:e.morph??!0,onDuplicateKey:e.onDuplicateKey})}function sn(e,t){return t.hasAttribute(Na)&&t.hasAttribute(Ma)}function un(e,t,n){let i=function(e,t,n){let{template:i,nextItems:r,forceRender:l=!1,store:a,sanitizerPolicy:o}=n,s=a.get(e),u=Yt(e),d=Qt(r),c=Array.from(e.children),h=vn(c,Fa),f=new Set,p=[];for(let a=0;a<r.length;a+=1){let g=r[a],m=mn(g),v=void 0===m?c[a]??null:yn(h,m)??null;null!==v&&f.has(v)&&(v=null),null!==v&&f.add(v);let y=t.replaces.has(a),b=l||t.renders.has(a)||null===v?bn(e.ownerDocument,i,g,a,o,u,d):void 0;if(null===b)return null;let w=void 0===b?[]:cn(y?null:v,b,g,void 0===m?void 0:s?.get(m),n);if(null===w)return null;p.push([a,v,b,w,y])}return p}(e,function(e){let t=new Set,n=new Set;for(let i of e)"insert"===i.kind||"update"===i.kind?t.add(i.index):"replace"===i.kind&&(t.add(i.index),n.add(i.index));return{renders:t,replaces:n}}(t),n);return null===i?null:[e,i,n.nextItems]}function dn(e,t,n){let[i,r,l]=e,a=new Set,o=!1,s=jt(i);for(let[e,l,s,u,d]of r){let r=l;if(void 0!==s){let e=!(!n.morph||d||null===l)&&Pt(l,s,{keyAttributes:[Fa,Na],boundary:Ae,retainBoundary:Fe,retainChildrenOf:sn,...void 0!==n.onDuplicateKey?{onDuplicateKey:n.onDuplicateKey}:{}})===l;if(!e)for(let[e,t]of u)null!==e&&(fn(e,t),t.replaceWith(e));for(let[,,e]of u)void 0!==e&&dn(e,t,n);e?o=!0:(null!==l&&(l.replaceWith(s),o=!0),r=s)}if(null===r)continue;let c=i.children[e]??null;r!==c&&(i.insertBefore(r,c),o=!0),a.add(r)}for(let e of Array.from(i.children))a.has(e)||(e.remove(),o=!0);Dt(s);let u=function(e,t){let n=t.get(e);return n||(n=new Map,t.set(e,n)),n}(i,t);u.clear();for(let e of l)gn(u,e);return o}function cn(e,t,n,i,r){let l=vn(null===e?[]:hn(e),Na),a=[];for(let e of hn(t)){let t=e.getAttribute(Na);if(null===t)continue;let o,s=yn(l,t)??null,u=e.getAttribute(Ma),d=u?s:null,c=d?.getAttribute(Ma)??null;if(u){let l=pn(n,t);if(void 0!==l||null!==d){let n=l??[],a=F(null===d?[]:pn(i,t)??[],n),s=null!==d&&c!==u;if((a.length>0||s)&&(o=un(d??e,a,{template:u,nextItems:n,forceRender:s,store:r.store,sanitizerPolicy:r.sanitizerPolicy})??void 0,void 0===o))return null}}a.push([d,e,o])}return a}function hn(e){return Array.from(e.querySelectorAll(`[${Na}]`)).filter(t=>{let n=t.parentElement;for(;null!==n&&n!==e;){if(n.hasAttribute(Na))return!1;n=n.parentElement}return n===e})}function fn(e,t){for(let n of Array.from(e.attributes))t.hasAttribute(n.name)||e.removeAttribute(n.name);for(let n of Array.from(t.attributes))e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value)}function pn(e,t){if("object"!=typeof e||null===e)return;let n=e[t];return Array.isArray(n)?n:void 0}function gn(e,t){let n=mn(t);void 0!==n&&e.set(n,t)}function mn(e){if("object"!=typeof e||null===e)return;let t=e.id;return"string"==typeof t||"number"==typeof t?String(t):void 0}function vn(e,t){let n=new Map;for(let i=e.length-1;i>=0;i-=1){let r=e[i];if(void 0===r)continue;let l=r.getAttribute(t);if(null===l)continue;let a=n.get(l);void 0===a?n.set(l,[r]):a.push(r)}return n}function yn(e,t){return e.get(t)?.pop()}function bn(e,t,n,i,r,l,a){let o=_t(Zt(t,n,i,tn,a),r,an(t)),s=e.createElement("template");s.innerHTML=Et(o);let u=s.content.firstElementChild;if(!u)return null;en(u,l);let d=mn(n);return void 0!==d&&u.setAttribute(Fa,d),u}function wn(e,t,n){if(t.warnedEscalationUnavailable)return;t.warnedEscalationUnavailable=!0;let i=`[live-preview] LP0808: onUnfaithfulPatch: \'escalate\' has nowhere to go: ${String(n)} field(s) fell short`,r="or onUnfaithfulPatch: \'warn\' to keep the patch and say so.";e.warn(void 0===e.strategies.fragment?`${i} and no route or fragment strategy is configured. Set routeStrategy: true or fragments: { endpoint }, ${r}`:`${i}, not all of them inside a data-payload-fragment boundary of this document, and no route strategy is configured. Cover them with a boundary or add the route strategy, ${r}`)}function Sn(e,t){return!1===t||q(Oe(e),t)}function An(t,n,i,r,l){let a=t.transformValue;if(void 0===a)return i;try{let t=a(n.fieldName,i,{element:n.element,allFields:r},l),o=e(t);if(!l())return i;if(o)throw new TypeError(`Transform for "${n.fieldName}" returned a thenable; transforms must be synchronous`);return t}catch(e){if(!l())return i;let n=e instanceof Error?e:new Error(String(e));return t.emitter.emit("error",{error:n,context:"transform",code:"LP0602"}),i}}function kn(e){if(!0!==e.hidesWhenEmpty)return!1;let{element:t}=e;if(t.hasAttribute("hidden"))return!0;let n=t.getBoundingClientRect();return 0===n.width||0===n.height}function Tn(e){let t=e.trim();if(0!==t.length)try{let e=new URL(t);return"http:"!==e.protocol&&"https:"!==e.protocol||!Da.test(e.origin)?void 0:e.origin}catch{return}}function Cn(e){let t=e.format;return"string"==typeof t&&Ha.has(t)?t:"number"==typeof t?qa[t]:void 0}function Rn(e){let t=e.indent;return"number"==typeof t&&t>0?t:0}function $n(e){return"rtl"===e.direction?\' dir="rtl"\':"ltr"===e.direction?\' dir="ltr"\':""}function Fn(e){let t=Cn(e),n=Rn(e),i=[];return void 0!==t&&i.push(`lp-align-${t}`),n>0&&i.push(`lp-indent-${String(n)}`),0===i.length?"":` class="${i.join(" ")}"`}function Nn(e){return"object"==typeof e&&null!==e?e:void 0}function Mn(e){return Nn(e)}function On(e,t){if(void 0===t||""===t||!e.startsWith("/"))return e;try{let n=new URL(t),i=new URL(e,n);return i.origin===n.origin?i.href:e}catch{return e}}function En(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-").toLowerCase()}function Ln(e){return"string"==typeof e&&e.length>0?e:void 0}function Pn(e){let t=Ln(e.title)??Ln(e.name)??Ln(e.slug);return void 0!==t?t:void 0===e.id?void 0:String(e.id)}function xn(e){if("string"==typeof e.text)return e.text;if(!e.children)return"";let t="";for(let n of e.children)t+=xn(n);return t}function Un(e){return`${"number"==typeof e.width?` width="${String(e.width)}"`:""}${"number"==typeof e.height?` height="${String(e.height)}"`:""}`}function In(e){return"string"==typeof e.mimeType?` type="${Xt(e.mimeType)}"`:""}function jn(e){return Qa.get(e)}function Dn(e,t,n,i){let r=Nn(e.fields)??{},l="string"==typeof r.blockType?r.blockType:"",a=En(l),o=""===a?i:`${i} ${i}--${a}`;if(""!==l){let e=jn(l)??jn(a);if(e)return e(r,{renderChildren:t.renderChildren});t.onUnrenderedBlock?.(l,o,r)}return`<${n} class="${o}"></${n}>`}function Wn(e,t){return"number"==typeof t&&t>1?` ${e}="${String(t)}"`:""}function Bn(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 _n(e,t){let n=function(e){return eo.get(e)??Ya[e]}(e.type);return n?n(e,t):void 0!==e.children?t.renderChildren(e.children):""}function zn(e){if("string"==typeof e.text)return e.text;if("linebreak"===e.type)return"\\n";if(void 0===e.children)return"";let t="";for(let n of e.children)t+=zn(n);return t}function Vn(e="text"){let t=new WeakSet;return{name:e,render:L((e,n)=>{let i=e.element,r=function(e){return null==e?"":Bn(e)?function(e){return Bn(e)?e.root.children.map(zn).join("\\n").trim():""}(e):"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):JSON.stringify(e)}(n);if("INPUT"!==i.tagName&&"TEXTAREA"!==i.tagName){if(i.textContent.trim()!==r.trim()){if(function(e){return null!==e.querySelector(":scope > :not(br)")}(i)&&!i.hasAttribute(no))return function(e,t,n){e.has(t)||(e.add(t),Ri(`[live-preview] LP0402: Skipping text update for "${n}": <${t.tagName.toLowerCase()}> has structured children. Move data-payload-field to the value element, or add data-payload-text to replace them.`))}(t,i,e.fieldName),!1;if(r.includes("\\n")||r.includes("\\r")){i.innerHTML=Et(function(e){return Jt(e).replace(/\\r\\n|\\r|\\n/g,"<br>")}(r));return}i.textContent=r}}else i.value=r})}}function qn(e,t){let n=e.cloneNode(!1);n.innerHTML=Et(t);let i=function(e,t){let n=e.firstElementChild,i=1===t.children.length?t.firstElementChild:null;if(null!==n?.nextElementSibling||0===t.children.length||!ao.has(n.tagName)||n.hasAttribute(Er)||i?.tagName===n.tagName||!0===i?.matches(Za))return null;for(let e of t.children)if(e.tagName===n.tagName&&e.className===n.className)return null;return n}(e,n)??e,r=new Map,l=n.querySelectorAll(Za);if(l.length>0&&null!==i.firstElementChild){let e=[];Hn(i,n,e);for(let[t,n]of e)t.replaceWith(n),n.matches(Za)||r.set(t.className,!1);for(let e of l)null!==e.parentNode&&r.set(e.className,!0)}return i.replaceChildren(...n.childNodes),r}function Hn(e,t,n){let i=(e,t)=>{e.matches(Za)?n.push([e,t]):Hn(t,e,n)},r=e.firstElementChild,l=t.firstElementChild;if(e.children.length===t.children.length){for(;null!==r&&null!==l;r=r.nextElementSibling)i(l,r),l=l.nextElementSibling;return}let a=new Set;for(let e of t.children)e.matches(Za)||a.add(e.tagName);let o=(e,t)=>e.matches(Za)?!a.has(t.tagName):e.tagName===t.tagName,s=0;for(;null!==r&&null!==l&&o(l,r);s+=1)i(l,r),r=r.nextElementSibling,l=l.nextElementSibling;let u=Math.min(e.children.length,t.children.length);r=e.lastElementChild,l=t.lastElementChild;for(let e=s;e<u&&null!==r&&null!==l;e+=1){if(!o(l,r))return;i(l,r),r=r.previousElementSibling,l=l.previousElementSibling}}function Gn(e,t,n,i){i&&t.reportUnfaithful?.(e,`lost the markup the server drew for block "${n}"`);let r=i?ro:io;r.has(n)||(r.add(n),Ri(`[live-preview] ${i?`LP0413: no renderer for block "${n}", and the markup the server rendered for it is lost.`:`LP0410: no renderer for block "${n}"; keeping what the server rendered for it.`} Register one with registerBlockRenderer().`))}function Kn(e,t,n,i){if("string"!=typeof n||0===n.length)return{kind:"none"};let r=On(n,i);return M(r)?{kind:"safe",url:r}:(uo.has(e)||(uo.add(e),Ri(`[live-preview] LP0401: refused an unsafe URL for "${t}" on <${e.tagName.toLowerCase()}>; the attribute was cleared.`)),{kind:"unsafe"})}function Jn(e,t=e=>e){return{name:e,render(e,n,i){let r=e.element;if(nn(n)){!function(e){"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):e.value=""}(r);return}let l=tn(n);if("INPUT"!==r.tagName&&"TEXTAREA"!==r.tagName){if("A"===r.tagName){let n=e.hrefField,a=void 0===n||0===n.length?t(l):x(i.allFields,n,i.locale,void 0!==e.locale),o=Kn(r,e.fieldName,a);"safe"===o.kind?r.setAttribute("href",o.url):"unsafe"===o.kind&&r.removeAttribute("href")}r.textContent=l}else r.value=l}}}function Xn(e){for(let t of po)e.removeAttribute(t);Qn(e)}function Qn(e){if("PICTURE"===e.parentElement?.tagName)for(let t of e.parentElement.querySelectorAll("source"))t.remove()}function Zn(e,t,n,i){let r=function(e,t){let n=[];for(let[i,r]of Object.entries(e?.sizes??e?.variants??{})){if("string"!=typeof r.url||"number"!=typeof r.width)continue;let e=On(r.url,t);M(e)&&n.push({...r,name:i,url:e,width:r.width})}return n}(n,i),l=e.getAttribute("src"),a=r.find(t=>null!==l&&Yn(e,t.url,l))??r.find(t=>t.name===go.get(e));void 0===a?.name?go.delete(e):go.set(e,a.name),(null===l||!(Yn(e,t,l)||r.some(t=>Yn(e,t.url,l))))&&Qn(e),e.src=a?.url??t;let o=a??n,s=r.filter(e=>ei(e,o)),u=s.length>0?s:r.filter(e=>ei({...e,mimeType:void 0},o));if(0===u.length){e.removeAttribute("srcset"),e.removeAttribute("sizes");return}if("number"==typeof n?.width&&"string"==typeof n.url){let e=On(n.url,i),t={...n,url:e,width:n.width};M(e)&&ei(t,o)&&u.push(t)}let d=new Set,c=[];for(let e of u)d.has(e.width)||(d.add(e.width),c.push(`${ti(e.url)} ${String(e.width)}w`));let h=c.join(", ");e.setAttribute("srcset",h)}function Yn(e,t,n){try{return new URL(t,e.baseURI).href===new URL(n,e.baseURI).href}catch{return t===n}}function ei(e,t){if(void 0===t)return!0;if("string"==typeof e.mimeType&&"string"==typeof t.mimeType&&e.mimeType!==t.mimeType)return!1;let{width:n,height:i}=t;return"number"!=typeof n||"number"!=typeof i||"number"!=typeof e.width||"number"!=typeof e.height||Math.abs(e.width*i-e.height*n)<=Math.max(n,e.width)}function ti(e){return e.replace(/[\\s,]/g,encodeURIComponent)}function ni(e){"IMG"===e.tagName?Xn(e):e.style.backgroundImage=""}function ii(e){"IMG"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):Xn(e)}function ri(e){let t=Nn(e);return void 0===t?tn(e):Pn(t)??""}function li(e,t){let n=e??"";if(null==t)return n;let i=ai(t);return"{}"===i?n:`${n}|${i}`}function ai(e){if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(e=>ai(e)).join(",")}]`;let t=e,n=Object.keys(t).sort(),i=[];for(let e of n){let n=t[e];void 0!==n&&i.push(`${JSON.stringify(e)}:${ai(n)}`)}return`{${i.join(",")}}`}function oi(e){return{kind:"date",options:e}}function si(e){return{kind:"number",options:e}}function ui(e,t,n,i){if(void 0===t||""===t)return;let r=function(e){let t=e.indexOf(":"),n=-1===t?e:e.slice(0,t),i=-1===t?void 0:e.slice(t+1);switch(n){case"date":return void 0===i?oi({dateStyle:"medium"}):Co.has(i)?oi({dateStyle:i}):void 0;case"time":return void 0===i?oi({timeStyle:"short"}):Ro.has(i)?oi({timeStyle:i}):void 0;case"datetime":return void 0===i?oi({dateStyle:"medium",timeStyle:"short"}):Co.has(i)?oi({dateStyle:i,timeStyle:"short"===i?"short":"medium"}):void 0;case"number":return void 0===i?si({}):Fo.test(i)?si({minimumFractionDigits:Number(i),maximumFractionDigits:Number(i)}):void 0;case"currency":return void 0!==i&&$o.test(i)?si({style:"currency",currency:i.toUpperCase()}):void 0;case"percent":return void 0===i?si({style:"percent"}):void 0;default:return}}(t);if(void 0!==r)return r.kind===e?r.options:void 0;!function(e,t,n){No.has(e)||(No.add(e),Ri(`[live-preview] LP0408: data-payload-format="${n}" on "${t}" is not a known format; the default formatting was used. Known: date, time, datetime (each also :short|medium|long|full), number, number:0-4, currency:XXX, percent.`))}(n,i,t)}function di(e){return String(e).padStart(2,"0")}function ci(){let e=new WeakMap,t=new WeakSet,n=new WeakMap,i=new WeakMap;return{name:"structural-array",render:L((r,l,a)=>{let o=nn(l)?[]:l;if(!Array.isArray(o))return!1;let s=r.element,u=r.arrayTemplate;if(void 0===u||0===u.length)return function(e,t,n){e.has(t)||(e.add(t),Ri(`[live-preview] LP0403: Skipping structural update for "${n}": <${t.tagName.toLowerCase()} data-payload-structural> needs data-payload-array-template (for example "<li>{{label}}</li>").`))}(t,s,r.fieldName),!1;let d=e.get(s),c=hi(s),h=d?.values??function(e){return e.map((e,t)=>null===e?{__payloadDomPosition:t}:{id:e})}(c),f=F(h,o),p=function(e,t,n){return void 0===e||e.template!==t||!function(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}(e.domSnapshot,n)}(d,u,c);if(0===f.length&&!p)return e.set(s,{values:o.slice(),template:u,domSnapshot:c}),!1;!function(e,t,n,i,r){let l=r.map(fi),a=new Set,o=l.find(e=>!(void 0===e||!a.has(e)&&(a.add(e),1)));if(void 0!==o&&pi(e,t,n,o),l.some(e=>void 0===e)&&gi(e,t,"LP0404",`LP0404: an item of "${n}" has no id and pairs by position, so an insert re-renders every row after it. Give items a stable id.`),i?.length===r.length&&r.length>1){let r=new Set(i.map(fi).filter(e=>void 0!==e)),a=l.some(e=>void 0!==e&&r.has(e));r.size>0&&!a&&gi(e,t,"LP0406",`LP0406: every key of "${n}" changed at once; the source generates ids per message, so no item can be retained across updates.`)}}(n,s,r.fieldName,d?.values,o);let g=on({template:u,container:s,patches:f,nextItems:o,store:i,forceRender:p,sanitizerPolicy:a.sanitizerPolicy,onDuplicateKey:(e,t)=>{pi(n,e,r.fieldName,t)}});return null!==g&&(e.set(s,{values:o.slice(),template:u,domSnapshot:hi(s)}),!!g&&void 0)})}}function hi(e){return Array.from(e.children,e=>e.getAttribute(Fa))}function fi(e){if("object"!=typeof e||null===e)return;let t=e.id;return"string"==typeof t||"number"==typeof t?String(t):void 0}function pi(e,t,n,i){gi(e,t,"LP0405",`LP0405: two items of "${n}" share the key "${i}"; later ones pair by position. Make \\`id\\` unique per item.`)}function gi(e,t,n,i){let r=e.get(t);void 0===r&&(r=new Set,e.set(t,r)),!r.has(n)&&(r.add(n),Ri(`[live-preview] ${i}`))}function mi(){return typeof __LIVE_PREVIEW_CONFIG__>"u"?[]:__LIVE_PREVIEW_CONFIG__}var vi=Object.defineProperty,yi=e=>{throw TypeError(e)},bi=(e,t,n)=>((e,t,n)=>t in e?vi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),wi=(e,t,n)=>t.has(e)||yi("Cannot "+n),Si=(e,t,n)=>(wi(e,t,"read from private field"),n?n.call(e):t.get(e)),Ai=(e,t,n)=>t.has(e)?yi("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ki=(e,t,n,i)=>(wi(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),Ti=(e,t,n)=>(wi(e,t,"access private method"),n),Ci=t((...e)=>console.error(...e)),Ri=t((...e)=>console.warn(...e)),$i=t((...e)=>console.debug(...e)),Fi=class{constructor(){Ai(this,Oi);Ai(this,Ni,new Map);Ai(this,Mi,new Map)}on(e,t){return Ti(this,Oi,Li).call(this,Si(this,Ni),e,t)}once(e,t){return Ti(this,Oi,Li).call(this,Si(this,Mi),e,t)}off(e,t){Ti(this,Oi,Pi).call(this,Si(this,Ni),e,t),Ti(this,Oi,Pi).call(this,Si(this,Mi),e,t)}async emit(e,t){await Ti(this,Oi,Ei).call(this,e,t)}async emitWhile(e,t,n){return Ti(this,Oi,Ei).call(this,e,t,n)}listenerCount(e){return(Si(this,Ni).get(e)?.size??0)+(Si(this,Mi).get(e)?.size??0)}removeAllListeners(e){void 0!==e?(Si(this,Ni).delete(e),Si(this,Mi).delete(e)):(Si(this,Ni).clear(),Si(this,Mi).clear())}eventNames(){let e=new Set;for(let t of Si(this,Ni).keys())e.add(t);for(let t of Si(this,Mi).keys())e.add(t);return[...e]}},Ni=new WeakMap,Mi=new WeakMap,Oi=new WeakSet,Ei=async function(e,t,n){let i=()=>n?.()??!0;if(!i())return!1;let r=Si(this,Ni).get(e);if(r)for(let n of[...r])if(!i()||(await Ti(this,Oi,xi).call(this,n,t,e),!i()))return!1;if(!i())return!1;let l=Si(this,Mi).get(e);if(l&&l.size>0){let n=[...l];Si(this,Mi).delete(e);for(let r of n)if(!i()||(await Ti(this,Oi,xi).call(this,r,t,e),!i()))return!1}return i()},Li=function(e,t,n){let i=e.get(t);return i||(i=new Set,e.set(t,i)),i.add(n),()=>{Ti(this,Oi,Pi).call(this,e,t,n)}},Pi=function(e,t,n){let i=e.get(t);void 0!==i&&(i.delete(n),0===i.size&&e.delete(t))},xi=async function(e,t,n){try{await e(t)}catch(e){let t="string"==typeof n||"number"==typeof n?String(n):"<event>";Ci(`[live-preview] LP0601: handler for "${t}" threw:`,e)}},Ui=1e3,Ii=new Set(["date","number","checkbox","select","radio"]),ji=40,Di="payload-live-preview-a11y",Wi=new WeakMap,Bi=class{constructor(e,t){bi(this,"german");bi(this,"document");bi(this,"lease",null);let n=t??(typ','eof document>"u"?null:document),i=n?.documentElement.getAttribute("lang")??"";this.german=function(e){return/^de(?:[-_]|$)/i.test(e)}(e??(i.length>0?i:d())),this.document=n}mount(){let e=this.document;if(null==e?.body)return null;this.lease??(this.lease=function(e){let t=Wi.get(e);return void 0===t&&(t={element:null,owned:!1,messageNode:null,refs:0,timer:null},Wi.set(e,t)),t.refs+=1,t}(e));let t=this.lease,n=t.element;if(n?.isConnected&&n.ownerDocument===e)return n;if(null!==n){let e=t.owned;c(t),e&&n.remove()}let i=e.getElementById(Di);return t.owned=null===i,null===i&&(i=e.createElement("div"),i.id=Di,i.setAttribute("role","status"),i.setAttribute("aria-live","polite"),i.setAttribute("aria-atomic","true"),i.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0",e.body.appendChild(i)),t.element=i,i}announceConnected(){this.say(this.german?"Vorschau verbunden":"Live preview connected")}announceDisconnected(){this.say(this.german?"Vorschau getrennt":"Live preview disconnected")}announceUpdate(e){e<=0||this.say(this.german?`${String(e)} ${1===e?"\\xc4nderung":"\\xc4nderungen"} angewendet`:`${String(e)} ${1===e?"change":"changes"} applied`)}announcePartial(){this.say(this.german?"Vorschau teilweise aktualisiert":"Preview partly updated")}detach(){let e=this.lease,t=this.document;if(null===e||null===t||(this.lease=null,e.refs-=1,e.refs>0))return;let n=e.element;null!==n&&c(e),e.owned&&n?.remove(),e.element=null,Wi.delete(t)}say(e){let t=this.mount(),n=this.lease;if(null===t||null===n)return;let i=n.messageNode;i?.parentNode!==t?(i?.remove(),i=t.ownerDocument.createTextNode(t.hasChildNodes()?` ${e}`:e),n.messageNode=i,t.appendChild(i)):i.data=null===i.previousSibling?e:` ${e}`,null!==n.timer&&clearTimeout(n.timer);let r=setTimeout(()=>{n.timer===r&&n.element===t&&c(n)},1500);n.timer=r}},_i=["data","fieldSchemaJSON","globalSlug","collectionSlug","locale","ready","previewToken","protocolVersion"],zi={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"}},Vi=Object.keys(zi),qi=class{constructor(e,t){bi(this,"matcher");bi(this,"handlers");bi(this,"boundListener");bi(this,"attachedTarget");bi(this,"generation",0);bi(this,"revision",0);bi(this,"queueHead");bi(this,"queueTail");bi(this,"lastAccepted");bi(this,"replayedGeneration",0);bi(this,"latestAcceptedAttempt");this.matcher=e,this.handlers=t}attach(e=window){if(void 0!==this.attachedTarget)return;let t=!1,n=i=>{if(!t||this.boundListener!==n)return;let r=this.generation;try{this.receive(i,r,e)}catch{let e;try{e=i.origin}catch{e=""}this.reportInvalid("shape",e,r)}};this.generation+=1,this.resetQueue(),this.attachedTarget=e,this.boundListener=n;try{e.addEventListener("message",n)}catch(t){this.boundListener===n&&(this.attachedTarget=void 0,this.boundListener=void 0,this.resetQueue());try{e.removeEventListener("message",n)}catch{}throw t}if(this.boundListener===n)t=!0;else try{e.removeEventListener("message",n)}catch{}}detach(){let e=this.attachedTarget,t=this.boundListener;void 0===e||void 0===t||(this.attachedTarget=void 0,this.boundListener=void 0,this.resetQueue(),e.removeEventListener("message",t))}advanceGeneration(){return void 0!==this.attachedTarget&&(this.generation+=1,this.resetQueue(),!0)}replayLastAccepted(){let e=this.lastAccepted,t=this.generation,n=this.handlers.onReplay;if(void 0===n||void 0===e||e.generation>=t||this.replayedGeneration===t||!this.matchesOrigin(e.origin,t)||this.lastAccepted!==e)return!1;this.replayedGeneration=t;let i={generation:t,revision:this.revision+=1};return this.invokeHandler(t,n,structuredClone(e.message),e.origin,i),!0}forgetLastAccepted(){this.lastAccepted=void 0,this.replayedGeneration=0,this.latestAcceptedAttempt=void 0}static sendReady(e,t){let n={type:"payload-live-preview",ready:!0,protocolVersion:4};for(let i of e)for(let e of t)try{i.postMessage(n,e)}catch{}}receive(e,t,n){let i=e.origin;if(!this.matchesOrigin(i,t)){this.reportInvalid("origin",i,t);return}if(!this.matchesSource(e,n)){this.reportInvalid("source",i,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&&!b(t.data))&&y(t.fieldSchemaJSON,e=>Array.isArray(e))&&y(t.globalSlug,e=>"string"==typeof e)&&y(t.collectionSlug,e=>"string"==typeof e)&&y(t.locale,e=>"string"==typeof e)&&y(t.ready,e=>"boolean"==typeof e)&&y(t.previewToken,e=>"string"==typeof e)&&y(t.protocolVersion,e=>"number"==typeof e)}(r)){this.reportInvalid("shape",i,t);return}this.dispatchUpdate(function(e){let t={...e};for(let e of _i)null===Reflect.get(t,e)&&Reflect.deleteProperty(t,e);return Array.isArray(t.fieldSchemaJSON)?{...t,fieldSchemaJSON:p(t.fieldSchemaJSON)}:t}(r),i,t);return;case"payload-document-event":if(!function(e){let t=e;return v(t.action,e=>"updated"===e||"created"===e||"deleted"===e)&&v(t.slug,e=>"string"==typeof e)&&v(t.id,e=>"string"==typeof e||Number.isFinite(e))}(r)){this.reportInvalid("shape",i,t);return}this.invokeHandler(t,this.handlers.onDocumentEvent,r,i);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",i,t);return}this.invokeHandler(t,this.handlers.onFocusField,e,i);return}default:this.reportInvalid("type",i,t)}else this.reportInvalid("shape",i,t)}dispatchUpdate(e,t,n){let i=b(e.data);if(!this.isCurrentGeneration(n))return;let r=i?{generation:n,revision:this.revision+=1}:void 0,l=this.handlers.validateToken;if(!this.isCurrentGeneration(n))return;if(void 0===l){this.commitUpdate(e,t,n,r);return}if(!0===e.ready&&void 0===e.data){this.commitUpdate(e,t,n,void 0);return}let a={generation:n,message:e,origin:t,messageRevision:r,verdict:void 0,next:void 0};this.enqueue(a);let o;try{o=l(e.previewToken,t)}catch{this.settleValidation(a,!1);return}"boolean"!=typeof o?Promise.resolve(o).then(e=>{this.settleValidation(a,!0===e)},()=>{this.settleValidation(a,!1)}):this.settleValidation(a,o)}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,n,i){if(void 0===i)this.invokeHandler(n,this.handlers.onUpdate,e,t);else{let r={};this.latestAcceptedAttempt=r;let l=function(e){let t={...e};delete t.previewToken;try{return structuredClone(t)}catch{return null}}(e);if(this.latestAcceptedAttempt!==r||!this.isCurrentGeneration(n))return;this.lastAccepted=null===l?void 0:{generation:n,message:l,origin:t},this.invokeHandler(n,this.handlers.onUpdate,e,t,i)}}reportInvalid(e,t,n){this.invokeHandler(n,this.handlers.onInvalid,e,t)}matchesSource(e,t){if("parent-or-opener"!==this.handlers.sourcePolicy)return!0;try{let n=e.source;if("object"!=typeof n||null===n)return!1;let i=t.parent;return i!==t&&n===i||n===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,n,...i){if(void 0!==n&&this.isCurrentGeneration(t))try{e(n(...i))}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}},Hi=new Set(["tabs","row","collapsible"]),Gi={text:"text",textarea:"textarea",richText:"richText",email:"email",number:"number",checkbox:"checkbox",date:"date",select:"select",radio:"radio",array:"array",blocks:"blocks",group:"text",tabs:"text",row:"text",collapsible:"text",relationship:"relationship",upload:"upload",point:"text",json:"text",code:"text",ui:"text"},Ki=new Set(["http:","https:","mailto:","tel:"]),Ji=/^(?:\\.{1,2}\\/|[a-zA-Z0-9_-]+\\/?)/,Xi=/^[\\\\/]{2}/,Qi=/[\\t\\n\\r]/g,Zi=/[\\s\\u0000-\\u001f\\u180e\\u2000-\\u2029]/g,Yi=/^([a-z][a-z0-9+.-]*):/i,er=new Set(["style","srcdoc","formaction","form","id","name","is","srcset","imagesrcset"]),tr=new Set(["href","src","poster","cite","action","xlink:href","data"]),nr=new WeakSet,ir=class{constructor(){bi(this,"previous",null);bi(this,"lastFields");bi(this,"priorFields");bi(this,"keepValues",!1)}get previousFields(){return this.priorFields}get isBaseline(){return null===this.previous}diff(e,t,n=P){let r=this.previous,l=null===r,a=new Map,o=new Set,s=Object.entries(e);if(!n())return null;for(let[e,t]of s){let l=i(t);if(!n())return null;a.set(e,l),(null===r||void 0===l||r.get(e)!==l)&&o.add(e)}if(null!==r)for(let e of r.keys())a.has(e)||o.add(e);let u=new Set,d=Object.entries(t);if(!n())return null;for(let[e,t]of d)if(o.has(e))for(let e of t)if(u.add(e),!n())return null;return n()?(this.previous=a,this.priorFields=this.keepValues?this.lastFields:void 0,this.lastFields=this.keepValues?e:void 0,{changed:o,invalidated:u,baseline:l}):null}reset(){this.previous=null,this.lastFields=void 0,this.priorFields=void 0}},rr=new Set(["__proto__","prototype","constructor"]),lr="data-payload-fragment",ar="data-payload-fragment-key",or="data-payload-strategy",sr=8,ur=1024,dr=new Set(["id","_id","createdAt","updatedAt","createdBy","updatedBy","_status","globalType","collection","locale","localized"]),cr=new Set(["text","textarea","email","number","checkbox","date","select","radio","point","code","json","ui","html"]),hr=new Set(["root","paragraph","text","heading","quote","list","listitem","linebreak","tab","horizontalrule","code","code-highlight","table","tablerow","tablecell","link","autolink"]),fr={},pr=class{constructor(){bi(this,"rawChanges",new ir);bi(this,"resolved",null);bi(this,"resolvedLocale",null);bi(this,"trailing",null);bi(this,"openUntil",0);bi(this,"requestAttempt",0)}decide(e,t){let n=t.rawData;if(!function(e){let{cache:t,emitter:n}=e;if(t.islands.length>0||n.listenerCount("beforeUpdate")>0||n.listenerCount("afterUpdate")>0)return!0;for(let e of t.values())if(ae(e)||e.fieldName.includes(".")||ue(e.hrefField)||ue(e.srcField)||ue(e.altField))return!0;return void 0!==e.strategies.fragment&&null!==e.root.querySelector(`[${lr}]`)}(e)&&!function(e,t,n){for(let i of e.values()){if("text"!==i.fieldType||!0===i.explicitFieldType)continue;let e=I(t,i,i.fieldName,n);if(ve(e)&&oe(e.root))return!0}return!1}(e.cache,n,t.locale))return t.forceRender&&(this.resolvedLocale=null),{merge:!1,fields:n};let{changed:i}=this.rawChanges.diff(n,fr),r=this.resolvedLocale!==t.locale,l=this.resolved;if(null===l)return this.resolved=n,{merge:!0,fields:n};let a={...l};t.forceRender&&(this.resolvedLocale=null);let o=t.forceRender||r;for(let r of i){let i=n[r];if(dr.has(r)){a[r]=i;continue}let s=le(r,l[r],i,e.cache,t.schemaIndex);"own"!==s&&(o=!0,this.resolvedLocale=null),"keep"!==s&&(a[r]=i)}return this.resolved=a,{merge:o,fields:a}}request(e,t,n){let i=++this.requestAttempt,r=Date.now();if(r>=this.openUntil)return this.openUntil=r+t,this.dropQueued(),this.requestAttempt!==i?{leading:!0,result:Promise.resolve({status:"superseded"})}:{leading:!0,result:e.merge(n)};let l=this.trailing,a=l?.pending??function(){let e;return{promise:new Promise(t=>{e=t}),settle:e}}(),o={request:n,pending:a,timer:null};if(this.trailing=o,this.openUntil=r+t,null!==l&&null!==l.timer&&clearTimeout(l.timer),this.trailing!==o)return{leading:!1,result:a.promise};let s=setTimeout(()=>{this.flush(e,o)},t);return this.trailing===o?o.timer=s:clearTimeout(s),{leading:!1,result:a.promise}}recordMerged(e,t){this.resolved=e,this.resolvedLocale=t}resetRawChanges(){this.rawChanges.reset()}destroy(){this.requestAttempt+=1,this.openUntil=0,this.dropQueued()}dropQueued(){let e=this.trailing;this.trailing=null,null!==e&&(null!==e.timer&&clearTimeout(e.timer),e.pending.settle({status:"superseded"}))}flush(e,t){this.trailing===t&&(this.trailing=null,t.timer=null,e.merge(t.request).then(t.pending.settle))}},gr=class{constructor(){bi(this,"negotiation",w(void 0));bi(this,"observed",new Set)}observe(e,t,n){let i=e.filter(e=>!this.observed.has(e));if(0!==i.length){for(let e of i)this.observed.add(e);this.negotiation=w(this.negotiation.theirs,this.observed),t("protocol",`observed=${i.join(",")}`),i.includes("schema-json")&&ce()&&n("[payload-live-preview] This admin sends fieldSchemaJSON, which only Payload 2 does. Every 2.x release of this package supports Payload 2; 3.0 supports Payload 3 and 4.")}}applyVersion(e,t){let n=this.negotiation;if(n.theirs===e)return;let i=w(e,this.observed);this.negotiation=i,i.negotiated!==n.negotiated&&t("protocol","ours=4",`theirs=${e}`,`negotiated=${i.negotiated}`)}},mr=class{constructor(){bi(this,"lastIdentity")}inspect(e){let t=e.externallyUpdatedRelationship;if("object"!=typeof t||null===t)return null;let n=JSON.stringify([t.entitySlug,H(t),t.updatedAt]);return{identity:n,edit:n!==this.lastIdentity&&he(t,e)?t:null}}commit(e){let t=e.identity!==this.lastIdentity;return this.lastIdentity=e.identity,t?e.edit:null}},vr=class{constructor(){Ai(this,yr)}reveal(e,t,n){return e===Si(this,yr)?"skipped-same":(ki(this,yr,e),function(e,t){for(let t;t=e.closest?.("details:not([open])");)t.setAttribute("open","");return function(e,t){let n=e.getBoundingClientRect(),i=n.bottom>0&&n.top<t.innerHeight,r=n.right>0&&n.left<t.innerWidth;return i&&r}(e,t)?"already-visible":(e.scrollIntoView({behavior:pe(t)?"auto":"smooth",block:"center"}),"revealed")}(t,n))}reset(){ki(this,yr,void 0)}},yr=new WeakMap,br=class{constructor(){bi(this,"seen",new Map)}note(e,t,n){let r=i(n);if(void 0===r)return;let l=`${t.owner??""}\\0${t.locale??""}\\0${t.fieldName}`,a=this.seen.get(l);void 0!==a?a!==r&&(e.revealIdentities.push([l,r]),e.revealTarget??(e.revealTarget=t)):this.seen.set(l,r)}commit(e){for(let[t,n]of e.revealIdentities)this.seen.set(t,n);e.revealIdentities=[];let t=e.revealTarget;return e.revealTarget=void 0,t}},wr=()=>{},Sr=class{constructor(){bi(this,"host",{outstanding:()=>!1,report:wr,failed:wr});bi(this,"entry",null);bi(this,"ended")}begin(e,t){let n=this.entry,i=null===n?void 0:this.view(n);null!==n&&(n.key=void 0),this.ended=void 0,this.entry={key:e,revision:t,shortfalls:[],seen:new Set,deferred:0,awaiting:0,reported:void 0,queued:!1},null!==n&&void 0!==i&&this.publish(n,"pending"===i.state?{...i,state:"superseded"}:i)}end(){let e=this.entry;if(null!==e){this.entry=null;try{this.ended=this.view(e)}finally{e.key=void 0}}}snapshot(){return null!==this.entry?this.view(this.entry):void 0===this.ended?void 0:{...this.ended,shortfalls:[...this.ended.shortfalls]}}shortfall(e,t){let n=this.entry;if(n?.key!==e)return;let i=JSON.stringify(t);n.seen.has(i)||(n.seen.add(i),n.shortfalls.push(t),this.requestSettle(n.key))}deferred(e,t){this.entry?.key===e&&(this.entry.deferred=t)}handIsland(e){let t=this.entry;if(t?.key!==e)return wr;t.awaiting+=1;let n=!1;return()=>{n||this.entry!==t||(n=!0,t.awaiting-=1,this.settle(t))}}requestSettle(e){let t=this.entry;t?.key!==e||t.queued||(t.queued=!0,queueMicrotask(()=>{t.queued=!1;try{this.entry===t&&this.settle(t)}catch(e){this.host.failed(e)}}))}settle(e){let t=this.view(e);"pending"!==t.state&&this.publish(e,t)}publish(e,t){e.reported!==t.state&&(e.reported=t.state,this.host.report(t))}view(e){let t=void 0!==e.key&&this.host.outstanding(e.key)?"pending":e.shortfalls.length>0?"partial":e.awaiting>0?"unconfirmed":"current";return{revision:e.revision,state:t,shortfalls:[...e.shortfalls],deferred:e.deferred,awaitingIslands:e.awaiting}}},Ar=class{constructor(){bi(this,"started",!1);bi(this,"suspended",!1);bi(this,"deferredStart",null);bi(this,"hydration","idle");bi(this,"activeUpdate",null);bi(this,"locale");bi(this,"schema");bi(this,"schemaIndex");bi(this,"updateCount",0);bi(this,"supersededCount",0);bi(this,"completedCount",0);bi(this,"skippedUnchangedCount",0);bi(this,"lastFlush",null);bi(this,"absentFields",new Set);bi(this,"warnedOrphanFields",new Set);bi(this,"warnedStrategy",new WeakSet);bi(this,"warnedUnattributableMessage",!1);bi(this,"warnedVisibilityGate",!1);bi(this,"warnedFragmentFallback",!1);bi(this,"warnedIslandStart",!1);bi(this,"warnedEscalationUnavailable",!1);bi(this,"warnedProtocolShape",!1);bi(this,"reportedUnfaithful",new WeakMap);bi(this,"checkedServerFormat",new WeakSet);bi(this,"rowsOfBinding",new WeakMap);bi(this,"unfaithfulPatches",[]);bi(this,"unfaithfulCount",0);bi(this,"escalatedCount",0);bi(this,"unfaithfulFields",new Set);bi(this,"autoBindSearchMs");bi(this,"autoBindGuesses",null);bi(this,"warnedForeignSource",!1);bi(this,"lastAppliedIdentity",new WeakMap);bi(this,"navigationReplayPending",!1);bi(this,"navigationBindingReplay",!1);bi(this,"revealLedger",new br);bi(this,"display",new Sr);bi(this,"fragmentStats",{rendered:0,failed:0,superseded:0});bi(this,"routeStats",{refreshes:0,partial:0,failed:0,refused:0,loopStopped:0});bi(this,"fragmentControllers",new Map);bi(this,"routeController",null);bi(this,"routeRetry",null);bi(this,"routeRefreshOwed",!1);bi(this,"routeAwaitsSave",!1);bi(this,"fragmentsOwed",new Set);bi(this,"readyTimers",[]);bi(this,"revealer",new vr);bi(this,"changes",new ir);bi(this,"merges",new pr);bi(this,"protocol",new gr);bi(this,"relationships",new mr)}isRunning(){return this.started}isCurrent(e){return this.started&&this.activeUpdate===e}complete(e){this.display.requestSettle(e),!e.completed&&(e.completed=!0,e.countsAsUpdate&&(this.completedCount+=1))}forgetOwedWork(){this.routeRefreshOwed=!1,this.routeAwaitsSave=!1,this.fragmentsOwed.clear()}supersedeStrategies(){null!==this.routeRetry&&(clearTimeout(this.routeRetry),this.routeRetry=null,this.routeRefreshOwed=!0);for(let[e,t]of this.fragmentControllers){for(let e of t)this.fragmentsOwed.add(e);e.abort()}this.fragmentControllers.clear()}abortStrategies(){this.supersedeStrategies();let e=this.routeController;this.routeController=null,e?.abort()}},kr=class{constructor(e,t){bi(this,"deps",e);bi(this,"state",t);bi(this,"writing");bi(this,"instanceContext");this.instanceContext=function(e){let t={};for(let[n,i]of Object.entries(e))void 0!==i&&(t[n]=i);return t}({renderRichText:e.renderRichText,internalLinkPattern:e.internalLinkPattern,sanitizerPolicy:e.sanitizerPolicy,serverURL:e.serverURL,reportUnfaithful:(n,i)=>{l(e,t,n,i,this.writing)}})}apply(e){let{deps:t,state:n}=this,i=n.activeUpdate;if(null===i||void 0===e.revision||!S(i.revision,e.revision)||!n.isCurrent(i))return!1;let{target:r,value:a}=e,d=void 0!==i.schemaIndex?C(i.schemaIndex,r.fieldName):void 0,c=function(e,t){if(e.explicitFieldType)return e.fieldType;if(void 0!==t){let e=function(e){if(Object.prototype.hasOwnProperty.call(Gi,e))return Gi[e]}(t);if(void 0!==e)return e}return e.fieldType}(r,d?.type);"text"===c&&!0!==r.explicitFieldType&&ve(a)&&(c="richText");let h;try{h=t.resolveRenderer(c,r)}catch(e){return this.fail(i,r.fieldName,e)}if(!n.isCurrent(i))return!1;let f=t.emitter.listenerCount("elementUpdate")>0,p=f?function(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value:"IMG"===e.tagName?e.src:e.textContent}(r.element):void 0;if(!n.isCurrent(i))return!1;let g={allFields:e.allFields,locale:r.locale??i.locale,schema:d,...this.instanceContext};!0===r.hidesWhenEmpty&&r.element.toggleAttribute("hidden",function(e){return null==e||("string"==typeof e?0===e.trim().length:Array.isArray(e)&&0===e.length||ye(e))}(a));try{if(void 0!==r.targetAttribute){if("blocked"===function(e,t,n){let i=t.toLowerCase().trim();if(0===i.length||!E(i))return"blocked";if(null==n)return e.removeAttribute(i),"applied";if("string"!=typeof n&&"number"!=typeof n&&"boolean"!=typeof n)return"blocked";let r=String(n);return tr.has(i)&&!M(r)?"blocked":(e.setAttribute(i,r),"applied")}(r.element,r.targetAttribute,a))return t.warn(`[live-preview] LP0401: refused to write "${r.fieldName}" into attribute "${r.targetAttribute}"`),n.display.shortfall(i,{kind:"write",field:r.fieldName,code:"LP0401"}),!1}else{if(void 0===h)return t.log("no renderer for",c),l(t,n,r,`has no renderer for "${c}"`,a),!1;{let e=function(e,t,n,i){if("ignore"===e.onUnfaithfulPatch||void 0!==n.format||!Ii.has(i)||o(i)&&n.element.matches("select,input")||t.checkedServerFormat.has(n.element))return;t.checkedServerFormat.add(n.element);let r=s(n.element);return r.trim().length>0?r:void 0}(t,n,r,c);if(this.writing=a,!1===function(e,t,n,i){return e.render(t,n,i)}(h,r,a,g)&&function(e){return nr.has(e.render)}(h))return l(t,n,r,`is a value ${h.name} cannot render`,a),!1;void 0!==e&&function(e,t,n,i){let r=s(t.element);r!==n&&e.warn(`[live-preview] LP0412: "${t.fieldName}" showed ${u(n)}, the patch wrote ${u(r)} \\u2014 `+(o(i)?\'Payload sends the value of an option, not its label. Render the label in a data-payload-fragment boundary, or bind it with data-payload-strategy="route".\':"either an edit that arrived before the preview connected, or a template that formats this value differently. Set data-payload-format to match it."))}(t,r,e,c)}}}catch(e){return this.fail(i,r.fieldName,e)}if(!n.isCurrent(i))return!1;f&&t.emitter.emitWhile("elementUpdate",{element:r.element,fieldName:r.fieldName,previousValue:p,nextValue:a,revision:i.revision.revision,receivedAt:i.receivedAt,source:"patch"},()=>n.isCurrent(i));let m=n.isCurrent(i);return m&&(void 0!==e.valueIdentity?n.lastAppliedIdentity.set(r.element,e.valueIdentity):n.lastAppliedIdentity.delete(r.element)),m}fail(e,t,n){if(!this.state.isCurrent(e))return!1;this.state.display.shortfall(e,{kind:"write",field:t,code:"LP0603"});let i=n instanceof Error?n:new Error(String(n));return this.deps.emitter.emitWhile("error",{error:i,context:"renderer",code:"LP0603"},()=>this.state.isCurrent(e)),!1}},Tr="payload-live-preview:update",Cr="data-payload-island",Rr=`astro-island, [${Cr}]`,$r="data-payload-owned",Fr="data-payload-morph",Nr=["component-url","component-export","renderer-url","client","opts","before-hydration-url"],Mr=new WeakMap,Or=new WeakSet,Er="data-payload-field",Lr="data-payload-type",Pr="data-payload-attribute",xr="data-payload-href",Ur="data-payload-src",Ir="data-payload-alt",jr="data-payload-array-template",Dr="data-payload-array-separator",Wr="data-payload-locale",Br="data-payload-format",_r="data-payload-richtext",zr="data-payload-html",Vr="data-payload-array",qr="data-payload-structural",Hr="data-payload-owner",Gr="data-payload-depends",Kr="data-payload-strategy",Jr="data-payload-boundary",Xr="data-payload-guessed",Qr="data-payload-covers",Zr=[Er,Lr,Pr,xr,Ur,Ir,jr,Dr,Wr,Br,_r,zr,Vr,qr,Hr,Gr,Kr,Jr,"type"],Yr=`[${Er}]`,el=`[${Hr}]`,tl=`[${lr}], [${Kr}="route"]`,nl=/^[a-z][a-z0-9-]*:[a-z][a-z0-9-]*$/i,il=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"]),rl=class{constructor(e={}){bi(this,"entriesByField",new Map);bi(this,"entryByElement",new WeakMap);bi(this,"filter");bi(this,"count",0);bi(this,"dependencies",null);bi(this,"islandRoots",[]);bi(this,"ownersByIsland",new Map);bi(this,"navigationRoots",[]);bi(this,"coverDeclarations",[]);bi(this,"renderedDeclarations",[]);this.filter=e.filter??xe}dependencyMap(){if(null!==this.dependencies)return this.dependencies;let e=[];for(let t of this.values())void 0!==t.dependsOn&&e.push(Se(t.fieldName,t.dependsOn));return this.dependencies=we(...e),this.dependencies}get islands(){return this.islandRoots}get islandOwners(){return this.ownersByIsland}get covers(){return this.coverDeclarations}get rendered(){return this.renderedDeclarations}get navigationReplayRoots(){return this.navigationRoots}buildFromRoot(e){let t=performance.now();this.clear();let n=0;for(let t of e.querySelectorAll(Yr))void 0!==this.add(t)&&(n+=1);return this.islandRoots=function(e){let t=[];for(let n of e.querySelectorAll(Rr))ke(n)||t.push(n);return t}(e),this.ownersByIsland=new Map(this.islandRoots.map(e=>[e,Oe(e)])),this.navigationRoots=[...e.querySelectorAll(tl)].filter(e=>this.filter(e)&&(e.hasAttribute(lr)||0===(e.getAttribute(Er)??"").length)),this.coverDeclarations=[...e.querySelectorAll(`[${Qr}]`)].filter(e=>this.filter(e)).map(e=>({paths:be(e.getAttribute(Qr)),owner:Oe(e)})),this.renderedDeclarations=[...e.querySelectorAll(`[${Gr}]`)].filter(e=>this.filter(e)).flatMap(e=>{let t=function(e){if((e.getAttribute(lr)??"").length>0)return"fragment";let t=e.getAttribute(Kr);return null!==t?"route"===t?"route":void 0:e.hasAttribute(Er)&&null!==e.closest("head")?"route":void 0}(e);return void 0===t?[]:[{strategy:t,paths:be(e.getAttribute(Gr)),owner:Oe(e)}]}),{elementCount:n,fieldCount:this.entriesByField.size,durationMs:performance.now()-t}}add(e){let t=this.filter(e)?this.resolveBinding(e):void 0,n=this.entryByElement.get(e);if(this.dependencies=null,void 0!==t)return void 0!==n&&this.replaceEntry(n,t)?(this.entryByElement.set(e,t),t):(void 0!==n&&this.removeEntry(e,n),this.append(t),this.entryByElement.set(e,t),t);void 0!==n&&this.removeEntry(e,n)}remove(e){let t=this.entryByElement.get(e);return!!t&&(this.dependencies=null,this.removeEntry(e,t))}get(e){return this.entriesByField.get(e)}getByElement(e){return this.entryByElement.get(e)}get fieldCount(){return this.entriesByField.size}get elementCount(){return this.count}entries(){return this.entriesByField.entries()}*values(){for(let e of this.entriesByField.values())yield*e}has(e){return this.entryByElement.has(e)}clear(){this.entriesByField.clear(),this.entryByElement=new WeakMap,this.count=0,this.dependencies=null,this.islandRoots=[],this.ownersByIsland=new Map,this.navigationRoots=[],this.coverDeclarations=[],this.renderedDeclarations=[]}replaceEntry(e,t){if(e.fieldName!==t.fieldName)return!1;let n=this.entriesByField.get(e.fieldName),i=void 0===n?-1:n.indexOf(e);return!(void 0===n||i<0||(n[i]=t,0))}removeEntry(e,t){this.entryByElement.delete(e);let n=this.entriesByField.get(t.fieldName),i=void 0===n?-1:n.indexOf(t);return!(void 0===n||i<0||(n.splice(i,1),0===n.length&&this.entriesByField.delete(t.fieldName),this.count-=1,0))}append(e){let t=this.entriesByField.get(e.fieldName);t?t.push(e):this.entriesByField.set(e.fieldName,[e]),this.count+=1}resolveBinding(e){let t=e.getAttribute(Er);if(null===t||0===t.length)return;let n=e.getAttribute(Lr),i=e.getAttribute(Pr),r=e.getAttribute(xr),l=e.getAttribute(Ur),a=e.getAttribute(Ir),o=e.getAttribute(jr),s=e.getAttribute(Dr),u=e.getAttribute(Wr),d=e.getAttribute(Br),c=Oe(e),h=be(e.getAttribute(Gr)),f=e.getAttribute(Kr),p=e.getAttribute(Xr),g=D(e);return{element:e,fieldName:t,fieldType:Pe(e),explicitFieldType:null!==n&&Ee(n),strategyKind:B(e)??"unknown",...null!==g?{fragmentBoundary:g}:{},...null!==i&&i.length>0?{targetAttribute:i}:{},...null!==r&&r.length>0?{hrefField:r}:{},...null!==l&&l.length>0?{srcField:l}:{},...null!==a&&a.length>0?{altField:a}:{},...null!==o?{arrayTemplate:o}:{},...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(Jr)?{hidesWhenEmpty:!0}:{},...null!==p?{guessed:p}:{}}}},ll=64,al=1e4,ol=1e3,sl=64,ul=8192,dl=1048576,cl=1e4,hl=20,fl=new Set(["__proto__","constructor","prototype"]),pl=new Error,gl=class{constructor(e){bi(this,"serverURL");bi(this,"apiRoute");bi(this,"depth");bi(this,"fetchFn");bi(this,"log");bi(this,"timeoutMs");bi(this,"inflight",null);bi(this,"attempt",0);bi(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 i=e.apiRoute??"/api";this.apiRoute=i.startsWith("/")?i:`/${i}`,this.depth=e.depth??1,this.fetchFn=e.fetchFn,this.log=t(e.log??n);let r=e.timeoutMs??0;this.timeoutMs=r>0&&r<Number.POSITIVE_INFINITY?r:void 0}canMerge(e){try{let t=e.schema;return void 0!==t?(qe(e.data,t,this.serverURL,this.apiRoute,this.depth,e.locale),!0):null!==this.endpointOf(e)}catch{return!1}}endpointOf(e){try{let t=e.globalSlug;if(t)return Je(t)?{path:`globals/${encodeURIComponent(t)}`,field:"globalType",value:t}:null;let n=e.collectionSlug??"",i=e.data.id;return Je(n)&&Xe(i)?{path:`${encodeURIComponent(n)}/${encodeURIComponent(String(i))}`,field:"id",value:String(i)}:null}catch{return null}}async merge(e){if(this.destroyDepth>0)return{status:"superseded"};let t=this.attempt+=1,n=this.inflight;this.inflight=null;let i,r,l=null,a=!1,o=()=>this.attempt!==t,s=this.timeoutMs,u=!1,d=(e,t)=>void 0===s?e:(void 0===r&&(r=new Promise((e,n)=>{i=setTimeout(()=>{u=!0,t.abort(),n(pl)},s)}),r.catch(()=>{})),Promise.race([e,r]));try{if(n?.abort(),o())return{status:"superseded"};let t=e.schema;if(a=void 0!==t,void 0!==t){let n=qe(e.data,t,this.serverURL,this.apiRoute,this.depth,e.locale);if(o())return{status:"superseded"};if(0===n.requests.length)return{status:"merged",doc:n.doc};let i=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(o())return{status:"superseded"};if(void 0===i)return{status:"unavailable"};l=new AbortController,this.inflight=l;for(let e of n.requests){let t=await d(i(e.url,{method:"GET",credentials:"include",redirect:"error",signal:l.signal}),l);if(o())return{status:"superseded"};let n=t.ok;if(o())return{status:"superseded"};if(!n){let e=t.status;return o()?{status:"superseded"}:(l.abort(),o()?{status:"superseded"}:(this.log("merge HTTP",e),o()?{status:"superseded"}:{status:"unavailable"}))}let r=await d(He(t,l.signal,()=>!o()),l);if(o())return{status:"superseded"};if(Ge(e,r),o())return{status:"superseded"}}return{status:"merged",doc:n.doc}}let i=this.endpointOf(e);if(o())return{status:"superseded"};if(null===i)return{status:"unavailable"};let r=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(o())return{status:"superseded"};if(void 0===r)return{status:"unavailable"};let s=JSON.stringify({data:e.data,depth:this.depth,flattenLocales:!1,locale:e.locale});if(o())return{status:"superseded"};l=new AbortController,this.inflight=l;let u=`${this.serverURL}${this.apiRoute}/${i.path}`,c=await d(r(u,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","X-Payload-HTTP-Method-Override":"GET"},body:s,signal:l.signal}),l);if(o())return{status:"superseded"};let h=c.ok;if(o())return{status:"superseded"};if(!h){let e=c.status;return o()?{status:"superseded"}:(this.log("merge HTTP",e,u),o()?{status:"superseded"}:{status:"unavailable"})}let f=c.json.bind(c);if(o())return{status:"superseded"};let p=await d(f(),l);if(o())return{status:"superseded"};if(null===p||"object"!=typeof p||Array.isArray(p))return this.log("merge invalid",u),o()?{status:"superseded"}:{status:"unavailable"};let g=p,m=g[i.field],v=Object.hasOwn(g,i.field)&&("id"===i.field?!Xe(m)||String(m)!==i.value:m!==i.value);return o()?{status:"superseded"}:v?(this.log("merge invalid",u),o()?{status:"superseded"}:{status:"unavailable"}):{status:"merged",doc:g}}catch(e){return o()?{status:"superseded"}:u?(this.log("merge timeout",s),{status:"unavailable"}):a&&(l?.abort(),o())?{status:"superseded"}:(this.log("merge exception",a?new Error("legacy population could not be resolved"):e),o()?{status:"superseded"}:{status:"unavailable"})}finally{clearTimeout(i),this.inflight===l&&(this.inflight=null)}}destroy(){this.attempt+=1;let e=this.inflight;this.inflight=null,this.destroyDepth+=1;try{e?.abort()}finally{this.destroyDepth-=1}}},ml="2.3.2",vl={name:"payload-2",fieldTyping:"schema",populatesRelationships:"admin",documentEvents:!1},yl={name:"payload-3",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!0},bl={name:"unknown",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!1},wl="ssr",Sl=1,Al=[Er,Hr,Qr,Gr],kl=`[${Er}], [${Qr}], ${Rr}, ${tl}`,Tl=class{constructor(e,t={}){bi(this,"callbacks");bi(this,"debounceMs");bi(this,"rootMargin");bi(this,"visible",new Set);bi(this,"mutation",null);bi(this,"intersection",null);bi(this,"debounceTimer",null);bi(this,"generation",0);this.callbacks=e,this.debounceMs=t.mutationDebounceMs??100,this.rootMargin=t.intersectionRootMargin??"200px"}start(e){let t=this.generation;this.stop();let n=t+1;if(this.generation!==n)return;let i=null,r=null;try{i=new MutationObserver(e=>{this.handleMutations(e,n)}),r=new IntersectionObserver(e=>{this.handleIntersection(e,n)},{rootMargin:this.rootMargin,threshold:0}),i.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...Zr,Qr,Cr,wl]})}catch(e){throw i?.disconnect(),r?.disconnect(),e}this.generation===n?(this.mutation=i,this.intersection=r):(i.disconnect(),r.disconnect())}observeElement(e){this.intersection?.observe(e)}unobserveElement(e){this.intersection?.unobserve(e),this.visible.delete(e)}markVisible(e,t){t?this.visible.add(e):this.visible.delete(e)}isVisible(e){return this.visible.has(e)}stop(){this.generation+=1;let e=this.debounceTimer,t=this.mutation,n=this.intersection;this.debounceTimer=null,this.mutation=null,this.intersection=null,this.visible.clear(),null!==e&&clearTimeout(e);try{t?.disconnect()}finally{n?.disconnect()}}handleMutations(e,t){if(!this.isCurrentGeneration(t))return;for(let n of e){let e=Ze(n);if(null!==e&&(this.callbacks.onIslandHydrated?.(e),!this.isCurrentGeneration(t)))return}if(!function(e){for(let t of e){if("attributes"===t.type&&t.attributeName===Cr||"attributes"===t.type&&null!==t.attributeName&&(Al.includes(t.attributeName)||Zr.includes(t.attributeName)&&t.target.nodeType===Sl&&t.target.hasAttribute(Er)))return!0;for(let e of t.addedNodes)if(Ye(e))return!0;for(let e of t.removedNodes)if(Ye(e))return!0}return!1}(e))return;null!==this.debounceTimer&&clearTimeout(this.debounceTimer);let n=setTimeout(()=>{!this.isCurrentGeneration(t)||this.debounceTimer!==n||(this.debounceTimer=null,this.callbacks.onStructuralChange())},this.debounceMs);this.debounceTimer=n}handleIntersection(e,t){for(let n of e){if(!this.isCurrentGeneration(t))return;let{target:e}=n;if(n.isIntersecting){if(this.visible.has(e))continue;this.visible.add(e),this.callbacks.onVisibilityChange(e,!0)}else this.visible.has(e)&&(this.visible.delete(e),this.callbacks.onVisibilityChange(e,!1))}}isCurrentGeneration(e){return this.generation===e&&null!==this.intersection}},Cl=class{constructor(e){Ai(this,Nl);Ai(this,Rl,[]);Ai(this,$l);Ai(this,Fl,!1);ki(this,$l,e)}get closed(){return Si(this,Fl)}own(e){Si(this,Fl)?Ti(this,Nl,Ml).call(this,e):Si(this,Rl).push(e)}close(){if(Si(this,Fl))return;ki(this,Fl,!0);let e=Si(this,Rl).splice(0).reverse();for(let t of e)Ti(this,Nl,Ml).call(this,t)}},Rl=new WeakMap,$l=new WeakMap,Fl=new WeakMap,Nl=new WeakSet,Ml=function(e){try{e()}catch(e){Si(this,$l).call(this,"runtime cleanup failed:",e)}},Ol="__livePreviewHydration",El="[data-payload-field]",Ll="__vue_app__",Pl="__livePreviewVueHydration",xl="app:suspense:resolve",Ul="__livePreviewHydrated",Il={react:(e,t)=>function(e,t=5e3){tt();let n=et();if(void 0===n)return null;if(void 0===n.onCommit){let e=e=>{!n.committed&&function(e){let t=e;return null!=t&&function(e){let t=e;return 9===t?.nodeType||null!=t?.querySelector?.(El)}(t.containerInfo)&&!function(e){let t=[];for(null!==e.current&&void 0!==e.current&&t.push(e.current);t.length>0;){let e=t.pop();if(void 0===e)continue;let n=e.memoizedState;if((13===e.tag||31===e.tag)&&"object"==typeof n&&null!==n&&"dehydrated"in n&&"object"==typeof n.dehydrated&&null!==n.dehydrated&&"nodeType"in n.dehydrated&&8===n.dehydrated.nodeType)return!0;null!==e.sibling&&void 0!==e.sibling&&t.push(e.sibling),null!==e.child&&void 0!==e.child&&t.push(e.child)}return!1}(t)}(e)&&nt(n)};n.onCommit=e;for(let t of n.commits.splice(0))e(t)}return rt(n,e,t)}(t),vue:function(e,t,n=5e3){ot();let i=lt();return void 0===i?null:(!i.committed&&function(e){for(let t=e.querySelector(El);null!==t;t=t.parentElement)if(void 0!==at(t))return!0;return!1}(e)&&nt(i),rt(i,t,n))},sveltekit:function(e,t,n=5e3){let i=e.ownerDocument??e,r=()=>null!==i.querySelector("#svelte-announcer");if(r()||!Object.keys(window).some(e=>e.startsWith("__sveltekit_")))return null;let l={committed:!1,waiters:[]},a=new MutationObserver(()=>{!l.committed&&r()&&nt(l)});a.observe(i,{childList:!0,subtree:!0});let o=rt(l,e=>{a.disconnect(),t(e)},n);return()=>{a.disconnect(),o?.()}},manual:function(e,t,n=5e3){let i=function(){if(typ','eof window>"u")return;let e=window;return e[Ul]??(e[Ul]={committed:!1,waiters:[]})}();return void 0===i?null:rt(i,t,n)}},jl={react:"React commit",vue:"Vue mount",sveltekit:"SvelteKit mount",manual:"markHydrated() call"},Dl=class{constructor(e){bi(this,"timeoutMs");bi(this,"onTimeout");bi(this,"handle",null);bi(this,"lastKick",null);this.timeoutMs=e.timeoutMs??0,this.onTimeout=e.onTimeout}kick(){this.lastKick=Date.now(),!(this.timeoutMs<=0)&&(this.stop(),this.arm(this.timeoutMs))}resume(){if(this.timeoutMs<=0||null!==this.handle||null===this.lastKick)return!1;let e=Math.max(0,Date.now()-this.lastKick),t=this.timeoutMs-e;return t<=0?(this.lastKick=null,this.onTimeout(),!0):(this.arm(Math.min(t,this.timeoutMs)),!1)}arm(e){let t=setTimeout(()=>{this.handle===t&&(this.handle=null,this.lastKick=null,this.onTimeout())},e);this.handle=t}stop(){null!==this.handle&&(clearTimeout(this.handle),this.handle=null)}get lastKickAt(){return this.lastKick??0}get pending(){return null!==this.handle}},Wl=class{constructor(){bi(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)}},Bl="data-payload-no-bind",_l=13,zl=new Set(["true","false","yes","no","on","off"]),Vl=/^[\\d\\s.,:+/-]+$/u,ql=/^[a-z][a-z0-9_-]*$/u,Hl=/^[a-z]{2,3}(?:[-_][A-Za-z0-9]{2,8})*$/u,Gl=new Set(["SCRIPT","STYLE","TEMPLATE","TITLE","NOSCRIPT","TEXTAREA","SELECT","OPTION","INPUT","IFRAME"]),Kl="http://www.w3.org/1999/xhtml",Jl=class{constructor(e,t,n){bi(this,"deps",e);bi(this,"state",t);bi(this,"host",n);bi(this,"awaitingHydration",new WeakSet);bi(this,"delivered",new WeakMap);bi(this,"confirmations",new WeakMap)}reapplyBindings(e){let t=this.currentTransaction();void 0!==t?.renderData&&this.host.schedule(t,t.renderData,e)}reapplyIslands(e,t=!1){let n=t?e.filter(e=>this.awaitingHydration.delete(e)):e,i=this.state.activeUpdate,r=t&&null!==i&&this.state.isCurrent(i)?i:this.currentTransaction();void 0!==r?.renderData&&this.dispatchIslands(r,r.renderData,n)}dispatchIslands(e,t,n){let i=Rt(this.deps,this.state,e,t.fields),r=()=>!e.cancelled&&this.state.isCurrent(e);if(!r())return;let l=this.delivered.get(t);void 0===l&&(l=new WeakSet,this.delivered.set(t,l));for(let a of n){let n=Oe(a);if(!r())return;if(!1!==i&&!q(n,i)){this.awaitingHydration.delete(a);continue}let o=this.confirmation(a,e);if(Ce(a))this.awaitingHydration.add(a);else{if(this.awaitingHydration.delete(a),l.has(a))continue;l.add(a),$t(e,t,[a],r,o)}}}hasLateRouteBinding(e,t,n,i){for(let i of e){if((i.getAttribute(Er)??"").length>0||"route"!==i.getAttribute(Kr)||!1!==t&&!q(Oe(i),t))continue;let e=be(i.getAttribute(Gr));if(0===e.length||e.some(e=>n.touched.has(e)))return!0}for(let[r,l]of this.deps.cache.entries())for(let a of l){if(!e.has(a.element)||!1!==t&&!q(a.owner,t)||"route"!==(a.strategyKind??B(a.element)??"unknown"))continue;let l=I(i.fields,a,r,n.locale);if(!this.state.isCurrent(n))return!1;if(void 0!==l)return!0}return!1}fieldsForElements(e,t){let n=new Set(t);for(let[t,i]of this.deps.cache.entries())i.some(t=>e.has(t.element))&&n.add(t);return n}unrunFragmentPlan(e,t,n){if(null===t)return null;let i=t.boundaries.filter(t=>!e.fragmentBoundariesRun.has(t)&&(void 0===n||[...n].some(e=>e===t||t.contains(e))));return W(t.strategy,i,t.ownerKeys)}confirmation(e,t){let n=this.confirmations.get(e);if(n?.transaction===t)return n.displayed;let i=this.state.display.handIsland(t);return this.confirmations.set(e,{transaction:t,displayed:i}),i}currentTransaction(){let e=this.state.activeUpdate;return this.state.navigationBindingReplay&&null!==e&&this.state.isCurrent(e)?e:null}},Xl=" subfieldCoverage",Ql="payload-live-preview",Zl=Symbol.for("payload-live-preview.trusted-types"),Yl=new Set(["open","value","checked","selected"]),ea="__payloadLivePreviewDeprecationsWarned",ta=new Set,na="data-payload-",ia=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"]),ra=new Set(["input","button","textarea","select","option","label"]),la=new Set(["script","style","iframe","object","embed","link","meta","base","form","input","button","select","textarea","svg","math","template","frame","frameset","noframes","noscript"]),aa=new Set(["id","class","lang","dir","title","role","tabindex"]),oa="aria-",sa="data-",ua="data-payload-",da={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"])},ca=new Set(["href","src","cite","poster","action","formaction"]),ha=6,fa=1,pa=8,ga=(Error,new Set(["id","name","data-payload-key","data-payload-morph","data-payload-nested-key","data-payload-nested-template"])),ma="strict",va=(Object.freeze({allowedTags:ia,removeCompletely:la,globalAttributes:aa,attributesByTag:da,urlAttributes:ca}),Object.freeze({"&":"&amp;","<":"&lt;",">":"&gt;",\'"\':"&quot;","\'":"&#x27;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"})),ya=/[&<>"\'/`=]/g,ba=Object.freeze({"&":"&amp;","<":"&lt;",">":"&gt;",\'"\':"&quot;","\'":"&#x27;"}),wa=/[&<>"\']/g,Sa=/\\{\\{([\\s\\S]*?)\\}\\}/g,Aa="data-payload-",ka=["input","textarea","select","option","button","label","details","summary","dialog","video","audio","progress","meter"],Ta=["type","name","placeholder","open","disabled","readonly","required","checked","selected","value","min","max","step","rows","cols","for","controls","muted","loop","poster","src"],Ca=/<([a-z][a-z0-9]*(?:-[a-z0-9]+)+)\\b/gi,Ra=64,$a=new Map,Fa="data-payload-key",Na="data-payload-nested-key",Ma="data-payload-nested-template",Oa=class{constructor(e,t,n){bi(this,"deps",e);bi(this,"state",t);bi(this,"host",n)}planFragments(e,t){let{deps:n,state:i}=this,r=n.strategies.fragment;if(void 0===r)return null;let l=new Set(r.plan(n.root,e));for(let e of i.fragmentsOwed)n.root.contains(e)?l.add(e):i.fragmentsOwed.delete(e);return W(r,[...l].filter(e=>Sn(e,t)),t)}escalateUnfaithful(e,t,n,i){if(e.routeRefreshed){this.kept(e,n);return}let{fragment:r,route:l}=this.deps.strategies,a=void 0===r?void 0:function(e){let t=[];for(let n of e){let e=n.fragmentBoundary;if(void 0===e)return;t.includes(e)||t.push(e)}return t}(n),o=void 0===a||a.every(e=>Sn(e,i))?a:void 0;void 0===r||void 0===o?void 0!==l?(this.state.escalatedCount+=n.length,this.refreshRoute(e,t,l)):(wn(this.deps,this.state,n.length),this.kept(e,n)):(this.state.escalatedCount+=n.length,e.pendingFragments+=o.length,this.runFragments(e,t,W(r,o,i)))}kept(e,t){for(let n of t)this.state.display.shortfall(e,{kind:"unfaithful",field:n.fieldName})}hasUnboundChange(e,t){let{deps:n,state:i}=this;if(e.baseline||e.routeRefreshed)return!1;let r=function(e,t,n,i,r,l){let a=te(e,i,l),o=ie(e,n,i,a),s=[];for(let e of t){if(dr.has(e))continue;let t=o(e);if("none"===t&&s.push(e),"below"!==t||void 0===r)continue;let i=ne(e,n),{previous:l,next:u}=r;for(let{path:t}of ee(i,l[e],u[e],a))s.push(t)}return s}(n.cache,e.touched,e.locale,t,this.subfields(e),n.strategies),l=0;for(let e of r)a(i,e)&&(l+=1);let[o]=r;if(void 0===o)return!1;if("escalate"!==n.onUnfaithfulPatch||void 0===n.strategies.route){"escalate"===n.onUnfaithfulPatch&&wn(n,i,r.length);for(let t of r)i.display.shortfall(e,{kind:"unbound",field:t});return!1}return e.navigated?(i.routeAwaitsSave=!0,i.display.shortfall(e,{kind:"route-saved"}),!1):(n.log("route","LP0807",`field "${o}" has no binding; refreshing the route`),i.escalatedCount+=l,!0)}subfields(e){let{previousFields:t}=this.state.changes;return function(e,t,n){return"declared"===e&&void 0!==t&&void 0!==n?{previous:t,next:n}:void 0}(this.deps.subfieldCoverage,t,e.renderData?.fields)}plansRoute(e,t,n){let i=e=>!1===n||q(e,n),r=function(e,t,n){let i=e.rendered.flatMap(e=>"route"===e.strategy?e.paths:[]);for(let[t,n]of e.entries())n.some(e=>"route"===e.strategyKind)&&i.push(t);let r=new Set(t);for(let e of i){let[i=e]=e.split(".");t.has(i)&&(void 0===n||Y(e,n.previous,n.next))&&r.add(e)}return r}(this.deps.cache,t.touched,this.subfields(t));if(e.plan(this.deps.root,r,{inScope:e=>i(Oe(e))}))return!0;for(let[e,t]of this.deps.cache.entries())if(r.has(e)&&t.some(e=>"route"===e.strategyKind&&i(e.owner)))return!0;return!1}async runFragments(e,t,n){let{deps:i,state:r}=this,l=new AbortController,a=new Set(n.boundaries);for(let e of a)r.fragmentsOwed.delete(e);r.fragmentControllers.set(l,a);let o=t=>{a.delete(t)&&(e.pendingFragments-=1)},s=()=>r.isCurrent(e)&&!l.signal.aborted,u=e=>function(e,t,n){if(t.isConnected)return t;let i,r=t.getAttribute(lr),l=t.getAttribute(ar);for(let t of e.querySelectorAll(`[${lr}]`))if(t.getAttribute(lr)===r&&t.getAttribute(ar)===l&&n(t)){if(void 0!==i)return;i=t}return i}(i.root,e,e=>Sn(e,n.ownerKeys)),{emitter:d}=i,{message:c}=e,h=e.revision.revision,f=e.receivedAt,p={root:i.root,revision:h,receivedAt:f,fields:t.fields,locale:e.locale,collectionSlug:"string"==typeof c.collectionSlug?c.collectionSlug:void 0,globalSlug:"string"==typeof c.globalSlug?c.globalSlug:void 0,signal:l.signal,isCurrent:s,log:(e,t)=>{i.log("fragment",e,t)},morph:(e,t)=>{let n=s()?u(e):void 0;void 0!==n&&function(e,t,n){let i=e.ownerDocument.createElement("template");i.innerHTML=Et(t);let r=e.cloneNode(!1);r.append(i.content);let l=Ne(e);Pt(e,r,{keyAttributes:[Fa],boundary:Ae,retainBoundary:Fe}),function(e){for(let t of e)t.isConnected||Or.has(t)||(Or.add(t),t.dispatchEvent(new CustomEvent("astro:unmount")))}(l);let a=new Set(l);for(let t of Ne(e)){let e=a.has(t)?void 0:Me(t);void 0!==e&&n(t,e)}}(n,t,(e,t)=>{!function(e,t,n,i){if(t.warnedIslandStart)return;t.warnedIslandStart=!0;let r="element"===i?"<astro-island>":`client:${n.getAttribute("client")??""}`;e.warn(`[live-preview] LP0809: a fragment island cannot start: this page never loaded ${r}; render one on the page`)}(this.deps,this.state,e,t)})},patch:i=>{let r=u(i);void 0!==r&&(r!==i&&this.host.rebuildCache(),this.patchFallback(e,t,r,n.ownerKeys,s))},rendered:(e,t,n)=>{o(e);let i=u(e)??e;d.emitWhile("fragmentRender",{element:i,id:t,key:n,status:"rendered",revision:h,receivedAt:f},s)},failed:(t,n,l,a,c)=>{o(t);let p=u(t)??t;r.display.shortfall(e,{kind:"fragment",id:n,key:l,code:a});let g=`fragment "${n}" fell back to patch: ${c}`;i.log("fragment",a,g),d.emitWhile("error",{error:new Error(g),context:"fragment",code:a},s),d.emitWhile("fragmentRender",{element:p,id:n,key:l,status:"failed",code:a,revision:h,receivedAt:f},s)}},g={rendered:0,failed:0,superseded:0};try{g=await n.strategy.render(p,n.boundaries)}catch(t){if(i.log("fragment","LP0801",t),s()){for(let t of n.boundaries)p.patch(t),r.display.shortfall(e,me(t));g={rendered:0,failed:n.boundaries.length,superseded:0}}}r.fragmentStats.rendered+=g.rendered,r.fragmentStats.failed+=g.failed,r.fragmentStats.superseded+=g.superseded,r.fragmentControllers.delete(l);for(let e of a)o(e);s()&&(g.rendered>0&&this.host.restoreGuesses(e,t),0===e.pendingFragments&&0===i.scheduler.pendingCount&&r.complete(e),this.host.revealPending(e),s()&&(0===g.rendered||0===d.listenerCount("afterUpdate")||d.emitWhile("afterUpdate",{data:t,updatedCount:g.rendered,durationMs:Date.now()-f,revision:h,receivedAt:f,source:"fragment"},s)))}async refreshRoute(e,t,n){let{deps:i,state:r}=this;e.routeRefreshed?(r.routeStats.loopStopped+=1,i.log("route","LP0805",`revision ${String(e.revision.revision)} asked for a second refresh`)):(e.routeRefreshed=!0,await this.runRoute(e,t,n,!1).catch(e=>{this.routeFailed(e)}))}refreshAfterSave(){let{deps:e,state:t}=this,{route:n}=e.strategies,i=t.activeUpdate;!t.routeAwaitsSave||void 0===n||void 0===i?.renderData||(e.log("route","document saved; refreshing the route"),this.runRoute(i,i.renderData,n,!0).catch(e=>{this.routeFailed(e)}))}routeFailed(e){this.deps.log("route refresh failed:",e)}armRouteRetry(e,t,n,i,r){let{state:l}=this;null!==l.routeRetry&&clearTimeout(l.routeRetry),l.routeRetry=setTimeout(()=>{l.routeRetry=null,l.isCurrent(e)&&this.runRoute(e,t,n,r).catch(e=>{this.routeFailed(e)})},i)}async runRoute(e,t,n,i){let{deps:r,state:l}=this;if(r.routeAfterSave&&!i){l.routeAwaitsSave=!0,l.display.shortfall(e,{kind:"route-saved"});return}let a=l.routeStats,o=new AbortController;l.routeController?.abort(),l.routeController=o;let s,u=()=>!o.signal.aborted;try{s=await n.refresh({revision:e.revision.revision,receivedAt:e.receivedAt,signal:o.signal,isCurrent:u,log:(e,t)=>{r.log("route",e,t)},retryAfter:r=>{this.armRouteRetry(e,t,n,r,i)}})}catch(e){r.log("route","LP0801",e),s="failed"}if(!u())return;l.routeController=null;let d=l.activeUpdate;if(null===d)return;let c=d.renderData,h=()=>l.isCurrent(d);if("partial"===s?l.display.shortfall(d,{kind:"route-saved"}):("failed"===s||"superseded"===s||"refused"===s&&null===l.routeRetry)&&l.display.shortfall(d,{kind:"route-failed",outcome:s}),"refreshed"!==s&&"partial"!==s)"failed"===s?a.failed+=1:"refused"===s&&(a.refused+=1),void 0!==c&&this.host.reapply(d,c);else{if(a.refreshes+=1,"partial"===s&&(a.partial+=1),l.routeAwaitsSave="partial"===s&&!i,l.lastAppliedIdentity=new WeakMap,void 0!==c&&this.host.restoreGuesses(d,c),this.host.rebuildCache(),void 0===c||!h())return;this.host.reapply(d,c),r.emitter.listenerCount("afterUpdate")>0&&r.emitter.emitWhile("afterUpdate",{data:c,updatedCount:r.cache.elementCount,durationMs:Date.now()-d.receivedAt,revision:d.revision.revision,receivedAt:d.receivedAt,source:"route"},h)}}warnFragmentFallback(e){!function(e,t,n){t.warnedFragmentFallback||(t.warnedFragmentFallback=!0,e.warn(`[live-preview] LP0806: "${n.fieldName}" asks for the fragment strategy but no handler is configured; patching instead`))}(this.deps,this.state,e)}warnUnsupportedStrategy(e){!function(e,t,n){t.warnedStrategy.has(n.element)||(t.warnedStrategy.add(n.element),e.warn(`[live-preview] LP0407: "${n.fieldName}" asks for strategy "${String(n.strategy)}"; only patch, fragment and route exist`))}(this.deps,this.state,e)}patchFallback(e,t,n,i,r){if(r())for(let[l,a]of this.deps.cache.entries())for(let o of a){if(o.fragmentBoundary!==n||!1!==i&&!q(o.owner,i))continue;let a=I(t.fields,o,l,e.locale);void 0===a||!r()||this.deps.scheduler.schedule({target:o,value:this.host.transform(o,a,t.fields,r),allFields:t.fields,revision:e.revision,data:t})}}},Ea=new Set,La={kind:"merge"},Pa=class{constructor(e,t,n){bi(this,"deps",e);bi(this,"state",t);bi(this,"strategies");bi(this,"navigationReplay");t.changes.keepValues="declared"===e.subfieldCoverage,t.display.host=function(e,t){return{outstanding:n=>!n.completed||n.pendingFragments>0||null!==t.routeController||null!==t.routeRetry||e.scheduler.pendingCount>0,report:t=>{"partial"===t.state&&e.a11y?.announcePartial(),e.emitter.emit("revisionDisplay",t)},failed:t=>{e.log("revision display failed:",t)}}}(e,t),this.strategies=new Oa(e,t,{reapply:(e,t)=>{this.scheduleAllFields(e,t)},transform:(t,n,i,r)=>An(e,t,n,i,r),rebuildCache:n,restoreGuesses:(e,t)=>{this.restoreGuesses(e,t)},revealPending:e=>{this.revealPending(e)}}),this.navigationReplay=new Jl(e,t,{schedule:(e,t,n)=>{this.scheduleAllFields(e,t,n)}})}handleUpdate(e,t,n){let{deps:i,state:r}=this;i.heartbeat.kick(),r.protocol.observe(function(e){let t=[];return Array.isArray(e.fieldSchemaJSON)&&t.push("schema-json"),"string"==typeof e.locale&&t.push("locale"),"string"==typeof e.previewToken&&t.push("preview-token"),"object"==typeof e.externallyUpdatedRelationship&&null!==e.externallyUpdatedRelationship&&t.push("relationship-events"),t}(e),i.log,i.warn);let l=e.data;void 0!==l?void 0!==n&&this.acceptDataUpdate(e,l,t,n,!0):void 0!==e.protocolVersion&&r.protocol.applyVersion(e.protocolVersion,i.log)}handleReplay(e,t,n){let i=e.data;void 0!==i&&this.acceptDataUpdate(e,i,t,n,!1)}reapplyNavigationBindings(e){this.navigationReplay.reapplyBindings(e)}reapplyNavigationIslands(e,t=!1){this.navigationReplay.reapplyIslands(e,t)}acceptDataUpdate(e,t,n,i,r){let{deps:l,state:a}=this,o=r?a.relationships.inspect(e):null,s="string"==typeof e.locale?e.locale:a.locale,u=a.schema,d=a.schemaIndex;Array.isArray(e.fieldSchemaJSON)&&(u=e.fieldSchemaJSON,d=function(e,t=""){let n=new Map;return T(e,t,n,!1),T(e,t,n,!0),n}(e.fieldSchemaJSON));let c=a.activeUpdate;if(!a.isRunning()||null!==c&&c.revision.revision>i.revision)return;let h=null===o?null:a.relationships.commit(o),f=c,p={revision:i,message:e,rawData:t,locale:s,schema:u,schemaIndex:d,receivedAt:Date.now(),forceRender:null!==h||fe(f),countsAsUpdate:r,renderData:void 0,fragmentBoundariesRun:new WeakSet,touched:new Set,baseline:!1,navigated:!1,invalidated:new Set,revealTarget:void 0,revealIdentities:[],pendingFragments:0,routeRefreshed:!1,cancelled:!1,completed:!1};a.locale=s,a.schema=u,a.schemaIndex=d,null!==f&&!f.completed&&f.countsAsUpdate&&(a.supersededCount+=1),a.activeUpdate=p,r&&(a.updateCount+=1),a.display.begin(p,i.revision),a.isCurrent(p)&&(l.scheduler.acceptRevision(i),a.isCurrent(p)&&(a.supersedeStrategies(),a.isCurrent(p)&&(null!==h&&(l.emitter.emitWhile("relationshipUpdate",{detail:h,timestamp:Date.now()},()=>a.isCurrent(p)),!a.isCurrent(p))||r&&void 0!==e.protocolVersion&&(a.protocol.applyVersion(e.protocolVersion,l.log),!a.isCurrent(p))||r&&l.connection.markConnected()&&(l.a11y?.announceConnected(),l.emitter.emit("connect",{origin:n,timestamp:Date.now()}),!a.isCurrent(p)||(l.log("connection","disconnected","\\u2192","connected"),!a.isCurrent(p)))||this.processUpdate(p).catch(e=>{l.log("update failed:",e)}))))}async processUpdate(e){let{deps:t,state:n}=this,i=await this.resolveIncomingFields(e);if(null===i||!n.isCurrent(e))return;let r=this.dataFor(e,i);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&&n.isCurrent(e))||e.cancelled||!n.isCurrent(e))||this.applyFields(e,r,!1)}dataFor(e,t){let{message:n}=e;return{fields:t,...void 0!==e.schema?{schema:e.schema}:{},..."string"==typeof n.globalSlug?{globalSlug:n.globalSlug}:{},..."string"==typeof n.collectionSlug?{collectionSlug:n.collectionSlug}:{},...void 0!==e.locale?{locale:e.locale}:{}}}applyFields(e,t,n){let{deps:i,state:r}=this;if(!r.isCurrent(e))return;if(r.changes.isBaseline&&!n&&"off"!==i.autoBind){{let n=Rt(i,r,e,t.fields);!function(e,t,n,i,r,l){if(!l())return 0;let a=performance.now(),o=At(e.root),s=pt(n,i);if(!l())return 0;let u=null===o?[]:St(o,s);if(!l())return 0;let d=Tt(e,u,r,"on the first message",l);if(!l())return 0;let c=function(e,t){let n=new Set;for(let{fieldName:e,stamps:i}of t){n.add(e);for(let e of[xr,Ir]){let t=i[e];void 0!==t&&n.add(t)}}let i=new Map;for(let[t,r]of e)null!==r&&n.has(r.field)&&i.set(t,r);return{fields:n,values:i}}(s,d),h=performance.now()-a;l()&&(t.autoBindGuesses=c,t.autoBindSearchMs=h,d.length)}(i,r,t.fields,e.locale,n,()=>r.isCurrent(e))}if(!r.isCurrent(e))return}let l=we(i.dependencies,i.cache.dependencyMap());if(!r.isCurrent(e))return;let a=r.changes.diff(t.fields,l,()=>r.isCurrent(e));if(null===a)return;let o=!n&&r.navigationReplayPending;o&&(r.navigationReplayPending=!1,r.navigationBindingReplay=!0),e.baseline=a.baseline&&!o,e.navigated=o,e.invalidated=n?Ea:a.invalidated,e.touched=n?Ea:new Set([...a.changed,...a.invalidated]),e.renderData=t,this.scheduleAllFields(e,t)}async resolveIncomingFields(e){let{deps:t,state:n}=this,i=e.rawData;if(null===t.merger)return i;let r=n.merges.decide(t,e);if(!r.merge)return r.fields;let{message:l}=e,a=n.merges.request(t.merger,t.mergeWindowMs,{collectionSlug:l.collectionSlug,globalSlug:l.globalSlug,data:i,...void 0===e.schema?{}:{schema:e.schema},locale:e.locale});if(!a.leading)return this.applyMerged(e,a.result).catch(e=>{t.log("update failed:",e)}),r.fields;let o=await a.result;return n.isCurrent(e)?"merged"===o.status?(n.merges.recordMerged(o.doc,e.locale),o.doc):"superseded"===o.status?null:(n.display.shortfall(e,La),r.fields):null}async applyMerged(e,t){let{state:n}=this,i=await t;"unavailable"===i.status&&n.display.shortfall(e,La),"merged"===i.status&&n.isCurrent(e)&&(n.merges.recordMerged(i.doc,e.locale),this.applyFields(e,this.dataFor(e,i.doc),!0))}scheduleAllFields(e,t,n){let{deps:i,state:r}=this;if(!r.isCurrent(e))return;let l=void 0!==n,a=()=>r.isCurrent(e),o=Rt(i,r,e,t.fields);if(!a())return;let{touched:s}=e,u=i.strategies.route;if(l&&void 0!==u&&!e.routeRefreshed&&this.navigationReplay.hasLateRouteBinding(n,o,e,t)){a()&&this.strategies.refreshRoute(e,t,u);return}let d=!l&&this.strategies.hasUnboundChange(e,o),c=r.routeRefreshOwed;if(!l&&void 0!==u&&!e.routeRefreshed&&(d||c||this.strategies.plansRoute(u,e,o))&&a()){r.routeRefreshOwed=!1,this.strategies.refreshRoute(e,t,u);return}let h=l?this.navigationReplay.fieldsForElements(n,s):s,f=this.navigationReplay.unrunFragmentPlan(e,this.strategies.planFragments(h,o),n);if(!a())return;let p=i.skipUnchanged,g=0;for(let[s,u]of i.cache.entries()){if(!a())return;for(let d of u){if(void 0!==n&&!n.has(d.element)||!1!==o&&!q(d.owner,o))continue;if(!0===f?.covers(d)){if(i.revealEditedField){let n=I(t.fields,d,s,e.locale);r.revealLedger.note(e,d,n)}continue}let u=d.strategyKind??B(d.element)??"unknown";if("unknown"===u){this.strategies.warnUnsupportedStrategy(d);continue}"fragment"===u&&null===f&&this.strategies.warnFragmentFallback(d);let c=I(t.fields,d,s,e.locale);if(void 0===c){r.absentFields.add(s);continue}if(Ct(i,r,d,t.fields,e.navigated),!l&&i.revealEditedField&&r.revealLedger.note(e,d,c),!a())return;let h=An(i,d,c,t.fields,a);if(!a())return;let m=p?j(d,h,t.fields,e.locale):void 0,v=r.lastAppliedIdentity.get(d.element);if(!e.forceRender&&i.skipUnchanged&&void 0!==m&&v===m&&!e.invalidated.has(s)){r.skippedUnchangedCount+=1;continue}let y={target:d,value:h,allFields:t.fields,revision:e.revision,...l?{}:{data:t},valueIdentity:m};i.scheduler.schedule(y),g+=1}}if(l||function(e,t,n,i,r){let{cache:l,strategies:a}=e,o={cache:l,warned:t,warn:e.warn};if(0===l.fieldCount||!1!==r&&!function(e,t){for(let n of e.values())if(q(n.owner,t))return!0;return!1}(l,r))return;let s=function(e,t,n,i){let r=ie(e,t,n,te(e,n,i));return e=>"none"!==r(e)}(l,i,r,a);for(let[e,t]of Object.entries(n)){if(dr.has(e))continue;if(Nt(t)){Ft(o,s,e,i,t);continue}if(!Ot(t)||s(e)||Mt(t))continue;let n=ne(e,i);for(let[e,r]of Object.entries(t))!Nt(r)||dr.has(e)||Ft(o,s,`${n}.${e}`,i,r)}if("declared"!==e.subfieldCoverage){!function(e,t,n,i,r){if(!e.coverageByDefault||t.has(Xl)||!ce())return;t.add(Xl);let[l]=re(e.cache,n,i,r,e.strategies);void 0!==l&&e.warn(`[live-preview] LP0204: no binding names "${l.path}", and a binding elsewhere in its group covers it, so an edit there changes nothing on the page. 3.0 makes subfieldCoverage: \'declared\' the default, where it refreshes the route. Set the option to choose now.`)}(e,t,n,i,r);return}let u=re(l,n,i,r,a);for(let{path:e,value:t}of u)if(Nt(t)&&Ft(o,s,e,i,t),Ot(t)&&!Mt(t))for(let[n,r]of Object.entries(t))Nt(r)&&Ft(o,s,`${e}.${n}`,i,r)}(i,r.warnedOrphanFields,e.rawData,e.locale,o),a()){if(null!==f&&f.boundaries.length>0){for(let t of f.boundaries)e.fragmentBoundariesRun.add(t);e.pendingFragments+=f.boundaries.length,this.strategies.runFragments(e,t,f)}l||!a()||0===g&&(0===e.pendingFragments&&0===i.scheduler.pendingCount&&(r.complete(e),this.revealPending(e)),this.notifyIslands(e,t))}}notifyIslands(e,t){0!==e.touched.size&&this.navigationReplay.dispatchIslands(e,t,this.deps.cache.islands)}restoreGuesses(e,t){let{deps:n,state:i}=this;if("off"!==n.autoBind&&null!==i.autoBindGuesses){let r=Rt(n,i,e,t.fields);!function(e,t,n,i,r,l){if(!l())return 0;let a=t.autoBindGuesses,o=At(e.root);if(null===a||0===a.fields.size||null===o)return 0;let s=new Map(a.values);for(let[e,t]of pt(n,i)){if(null===t||!a.fields.has(t.field))continue;let n=s.get(e);void 0===n?s.set(e,t):n?.field!==t.field&&s.set(e,null)}if(!l())return 0;let u=St(o,s);l()&&Tt(e,u,r,"after a server render",l).length}(n,i,t.fields,e.locale,r,()=>i.isCurrent(e))}}onFlush(e){let{deps:t,state:n}=this;n.lastFlush=e,e.deferred>0&&!n.warnedVisibilityGate&&(n.warnedVisibilityGate=!0,t.warn(`[live-preview] LP0301: visibility gate held ${String(e.deferred)} off-screen update(s) until scrolled into view; see visibilityGateThreshold`));let{revision:i,data:r}=e;if(void 0===i)return;let l=n.activeUpdate;if(null===l||!n.isCurrent(l)||!S(l.revision,i))return;n.display.deferred(l,e.deferred),0===l.pendingFragments&&n.complete(l);let a=()=>n.isCurrent(l)&&S(l.revision,i),o=r??l.renderData;if(this.revealPending(l),!a())return;let s=n.unfaithfulPatches;if(s.length>0){if(n.unfaithfulPatches=[],void 0!==o){let e=Rt(t,n,l,o.fields);this.strategies.escalateUnfaithful(l,o,s,e)}if(!a())return}void 0!==r&&(e.applied>0&&t.a11y?.announceUpdate(e.applied),a()&&(this.notifyIslands(l,r),a()&&0!==e.applied&&0!==t.emitter.listenerCount("afterUpdate")&&t.emitter.emitWhile("afterUpdate",{data:r,updatedCount:e.applied,durationMs:e.durationMs,revision:i.revision,receivedAt:l.receivedAt,source:"patch"},a)))}revealPending(e){let t=this.state.revealLedger.commit(e);if(void 0!==t)try{ge(this.state.revealer,t)}catch(e){this.deps.log("reveal",e)}}revealField(e){let t=this.deps.cache.get(e)?.[0];return void 0===t?"no-element":ge(this.state.revealer,t)}documentSaved(){this.strategies.refreshAfterSave()}},xa=class{constructor(e,t){bi(this,"apply");bi(this,"debounceMs");bi(this,"maxWaitMs");bi(this,"isVisible");bi(this,"gateThresholdValue");bi(this,"gateDisabled");bi(this,"getCacheSize");bi(this,"onFlush");bi(this,"scheduleFrame");bi(this,"cancelFrame");bi(this,"pending",new Map);bi(this,"replay",new Map);bi(this,"activeFlushes",new Set);bi(this,"debounceTimer",null);bi(this,"debounceToken",0);bi(this,"deadlineTimer",null);bi(this,"frameHandle",null);bi(this,"frameFallback",null);bi(this,"frameToken",0);bi(this,"windowUntil",0);bi(this,"activeRevision",null);bi(this,"activeRevisionCancelled",!1);bi(this,"destroying",!1);this.apply=e,this.debounceMs=t.debounceMs??50,this.maxWaitMs=t.maxWaitMs??4*this.debounceMs,this.isVisible=t.isVisible,this.gateThresholdValue=t.visibilityGateThreshold??50,this.gateDisabled=t.disableVisibilityGate??!1,this.getCacheSize=t.getCacheSize,this.onFlush=t.onFlush,this.scheduleFrame=t.scheduleFrame??("function"==typeof requestAnimationFrame?requestAnimationFrame.bind(globalThis):e=>setTimeout(()=>{e(performance.now())},0)),this.cancelFrame=t.cancelFrame??("function"==typeof cancelAnimationFrame?cancelAnimationFrame.bind(globalThis):e=>{clearTimeout(e)})}schedule(e){if(this.destroying||void 0!==e.revision&&(this.activeRevisionCancelled||null===this.activeRevision||!S(e.revision,this.activeRevision)))return;let t=this.pending.get(e.target.element);t?(t.value=e.value,t.allFields=e.allFields,t.revision=e.revision,t.data=e.data,t.valueIdentity=e.valueIdentity):this.pending.set(e.target.element,{target:e.target,value:e.value,allFields:e.allFields,revision:e.revision,data:e.data,valueIdentity:e.valueIdentity}),this.armDebounce()}acceptRevision(e){this.destroying||null!==this.activeRevision&&S(e,this.activeRevision)||null!==this.activeRevision&&function(e,t){return e.generation!==t.generation?e.generation-t.generation:e.revision-t.revision}(e,this.activeRevision)<0||(this.clearWork(),this.activeRevision=e,this.activeRevisionCancelled=!1,this.cancelScheduledWork())}cancelRevision(e){null===this.activeRevision||!S(e,this.activeRevision)||(this.clearWork(),this.activeRevisionCancelled=!0,this.cancelScheduledWork())}flushNow(){return this.cancelScheduledWork(),this.flush()}notifyVisible(e){let t=this.replay.get(e);if(!t||(this.replay.delete(e),!this.isCurrent(t)))return;let n=performance.now(),i=this.didApply(t)?1:0;this.onFlush?.(this.statsFor(t,i,0,performance.now()-n,1===i?[t.target.fieldName]:[]))}retarget(e){this.retargetBuffer(this.pending,e),this.retargetBuffer(this.replay,e);for(let t of this.activeFlushes)this.retargetBuffer(t,e)}forget(e){this.pending.delete(e),this.replay.delete(e);for(let t of this.activeFlushes)t.delete(e)}destroy(){if(!this.destroying){this.destroying=!0;try{this.clearWork(),this.activeRevision=null,this.activeRevisionCancelled=!1,this.windowUntil=0,this.cancelScheduledWork()}finally{this.destroying=!1}}}get pendingCount(){return this.pending.size}get replayCount(){return this.replay.size}get gateThreshold(){return this.gateThresholdValue}get gateActive(){return!this.gateDisabled&&this.getCacheSize()>this.gateThresholdValue}armDebounce(){let e=Date.now(),t=e>=this.windowUntil;if(this.windowUntil=e+this.debounceMs,t){this.requestFrame();return}let n=this.debounceToken+=1,i=this.debounceTimer;if(this.debounceTimer=null,null!==i&&clearTimeout(i),this.debounceToken!==n)return;let r=setTimeout(()=>{this.debounceToken===n&&(this.debounceTimer=null,this.pending.size>0&&this.requestFrame())},this.debounceMs);this.debounceToken===n&&(this.debounceTimer=r),null===this.deadlineTimer&&this.maxWaitMs>this.debounceMs&&(this.deadlineTimer=setTimeout(()=>{this.deadlineTimer=null,this.pending.size>0&&this.requestFrame()},this.maxWaitMs))}requestFrame(){let e=this.frameToken+=1,t=this.frameHandle;if(this.frameHandle=null,this.clearFrameFallback(),null!==t&&this.cancelFrame(t),this.frameToken!==e)return;let n=!1,i=()=>{if(this.frameToken!==e||n)return;n=!0;let t=this.frameHandle;this.frameHandle=null,this.clearFrameFallback(),null!==t&&this.cancelFrame(t),this.flush()},r=this.scheduleFrame(i);n||this.frameToken!==e||(this.frameHandle=r,this.frameFallback=setTimeout(i,100))}clearFrameFallback(){clearTimeout(this.frameFallback??void 0),this.frameFallback=null}flush(){let e=performance.now();this.clearDeadline();let t=this.gateActive,n=this.pending;this.pending=new Map;let i,r=0,l=[],a=0;this.activeFlushes.add(n);try{for(let e of n.values()){if(!this.isCurrent(e))continue;let n=!t||this.isVisible(e.target.element)||kn(e.target);if(this.isCurrent(e)){if(i??(i=e),!n){this.replay.set(e.target.element,e),a+=1;continue}this.replay.delete(e.target.element),this.didApply(e)&&(r+=1,l.push(e.target.fieldName))}}}finally{this.activeFlushes.delete(n)}let o=this.statsFor(i,r,a,performance.now()-e,l);return this.onFlush?.(o),o}isCurrent(e){return void 0===e.revision||!this.activeRevisionCancelled&&null!==this.activeRevision&&S(e.revision,this.activeRevision)}didApply(e){return!1!==this.apply(e)||!function(e){return nr.has(e)}(this.apply)}retargetBuffer(e,t){let n=e.get(t.element);if(void 0!==n){if(!Le(n.target,t)){e.delete(t.element);return}n.target=t}}clearWork(){this.pending.clear(),this.replay.clear();for(let e of this.activeFlushes)e.clear()}statsFor(e,t,n,i,r){return{applied:t,appliedFields:r,deferred:n,durationMs:i,...void 0!==e?.revision?{revision:e.revision}:{},...void 0!==e?.data?{data:e.data}:{}}}clearDeadline(){null!==this.deadlineTimer&&(clearTimeout(this.deadlineTimer),this.deadlineTimer=null)}cancelScheduledWork(){let e=this.debounceTimer,t=this.frameHandle;this.debounceToken+=1,this.frameToken+=1,this.debounceTimer=null,this.frameHandle=null,this.clearDeadline(),this.clearFrameFallback(),null!==e&&clearTimeout(e),null!==t&&this.cancelFrame(t)}},Ua=[0,500,1e3,2e3],Ia=class{constructor(e){bi(this,"deps");bi(this,"state",new Ar);bi(this,"pipeline");bi(this,"writer");bi(this,"rootSentinel",null);bi(this,"scope",null);bi(this,"closingSession",!1);bi(this,"observedRoot",null);bi(this,"replayRetainedOnStart",!1);let{emitter:i,renderers:l}=e,a=void 0===e.log?n:t(e.log),o=void 0===e.warn?Ri: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 rl({filter:e=>!function(e){let t=e;for(;null!==t;){if(Te(t))return!0;t=t.parentElement}return!1}(e)}),d=new Tl({onStructuralChange:()=>{this.rebuildCache()},onIslandHydrated:e=>{this.pipeline.reapplyNavigationIslands([e],!0)},onVisibilityChange:(e,t)=>{t&&c.notifyVisible(e)}},void 0!==e.intersectionRootMargin?{intersectionRootMargin:e.intersectionRootMargin}:{}),c=new xa(L(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 qi(e.originMatcher,{onUpdate:(e,t,n)=>{this.pipeline.handleUpdate(e,t,n)},onReplay:(e,t,n)=>{this.pipeline.handleReplay(e,t,n)},onDocumentEvent:()=>{this.state.protocol.observe(["document-events"],a,o),i.emit("documentSave",{timestamp:Date.now()}),this.pipeline.documentSaved()},onFocusField:e=>{this.deps.revealEditedField&&this.pipeline.revealField(e)},onInvalid:(e,t)=>{if("token"===e){let e=new Error(`Preview token rejected (origin: ${t})`);i.emit("error",{error:e,context:"token",code:"LP0502"})}("shape"===e||"type"===e)&&!this.state.warnedProtocolShape&&(this.state.warnedProtocolShape=!0,o(`[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,o(`[live-preview] LP0501: a message from ${t} was ignored because it did not come from the window that framed or opened this page. \\`eventSourcePolicy\\` is \'parent-or-opener\' by default since 2.0, where 1.x accepted any window on a trusted origin. Set \\`eventSourcePolicy: \'any\'\\` if the admin posts from elsewhere.`)),a("LP0501 message rejected:",e,t)},...void 0!==e.validateToken?{validateToken:e.validateToken}:{},...void 0!==e.eventSourcePolicy?{sourcePolicy:e.eventSourcePolicy}:{}}),f=e.dataMerge;this.deps={emitter:i,cache:u,observers:d,scheduler:c,bus:h,connection:new Wl,heartbeat:new Dl({...void 0!==e.heartbeatMs?{timeoutMs:e.heartbeatMs}:{},onTimeout:()=>{this.onHeartbeatTimeout()}}),renderers:l,resolveRenderer:e.resolveRenderer??(e=>l[e]),transformValue:e.transformValue,renderRichText:e.renderRichText,internalLinkPattern:e.internalLinkPattern,routeAfterSave:!0===e.routeAfterSave,sanitizerPolicy:e.sanitizerPolicy,root:s,readyTargets:"function"==typeof e.readyTargets?e.readyTargets:(e=>()=>e)(e.readyTargets),sendReady:e.sendReady??k,onHeartbeatTimeout:e.onHeartbeatTimeout,log:a,warn:o,a11y:A(e),serverURL:f?.serverURL,merger:void 0===f?null:new gl({...f,log:a}),mergeWindowMs:e.debounceMs??50,scopeBindingsByOwner:!0===e.scopeBindingsByOwner,subfieldCoverage:e.subfieldCoverage??"descendant",coverageByDefault:void 0===e.subfieldCoverage,lockedOrigin:e.lockedOrigin??(()=>{}),skipUnchanged:!0===e.skipUnchanged,dependencies:e.dependencies??{},strategies:e.strategies??{},revealEditedField:!0===e.revealEditedField,onUnfaithfulPatch:r(e),autoBind:e.autoBind??"off",hydration:e.hydration},this.writer=new kr(this.deps,this.state),this.pipeline=new Pa(this.deps,this.state,()=>{this.rebuildCache()})}start(){let{state:e}=this;if(e.isRunning()||this.closingSession)return!1;e.suspended&&(this.replayRetainedOnStart=!0),e.started=!0,e.suspended=!1,this.openScope();try{return function(e){"react"===e.hydration?tt():"vue"===e.hydration&&ot();let{root:t}=e;if(!dt(t)||"loading"!==t.readyState){st(e);return}let n=()=>{e.isRunning()&&e.later(()=>{st(e)})};t.addEventListener("DOMContentLoaded",n,{once:!0}),e.defer(()=>{t.removeEventListener("DOMContentLoaded",n)})}(this.startupHost()),!0}catch(e){throw this.rollbackFailedStart(),e}}startupHost(){let{state:e,deps:t}=this;return{root:t.root,hydration:t.hydration,isRunning:()=>e.isRunning(),defer:t=>{e.deferredStart=t,this.scope?.own(()=>{e.deferredStart===t&&(e.deferredStart=null,t())})},later:t=>{e.deferredStart=null;try{t()}catch(e){this.rollbackFailedStart(),this.reportError(e,"startup","LP0605")}},hydrated:t=>{e.hydration=t},warn:t.warn,startNow:()=>{this.startNow()}}}startNow(){let{state:e,deps:t}=this;if(!e.isRunning())return;let n=dt(t.root)?ct(t.root):t.root;if(null===n)throw new Error("LivePreviewRuntime: document.body unavailable");if(t.observers.start(n),this.observedRoot=n,this.watchRootReplacement(),this.buildCacheAndObserve(),!e.isRunning()||(t.bus.attach(),t.emitter.emitWhile("init",{timestamp:Date.now()},()=>e.isRunning()),!e.isRunning()))return;let i=this.replayRetainedOnStart;this.replayRetainedOnStart=!1;let r=i&&t.heartbeat.resume();if(e.isRunning()&&(!i||r||(e.forgetOwedWork(),e.merges.resetRawChanges(),e.unfaithfulPatches=[],e.revealer.reset(),e.lastAppliedIdentity=new WeakMap,e.changes.reset(),e.navigationReplayPending=!0,t.bus.replayLastAccepted()||(e.navigationReplayPending=!1),e.isRunning())))for(let n of Ua){if(!e.isRunning())return;0===n?t.sendReady(t.readyTargets()):e.readyTimers.push(setTimeout(()=>{e.isRunning()&&this.sendReadyAfterStart()},n))}}suspend(){if(!this.state.isRunning())return!1;let e=this.release();return this.state.suspended=!0,e&&this.deps.emitter.emit("disconnect",{reason:"unload",timestamp:Date.now()}),!0}destroy(){let{state:e,deps:t}=this;if(!e.isRunning()&&!e.suspended)return;let n=!!e.isRunning()&&this.release();e.suspended=!1,this.replayRetainedOnStart=!1,t.bus.forgetLastAccepted(),n&&t.emitter.emit("disconnect",{reason:"destroy",timestamp:Date.now()}),t.a11y?.detach(),t.emitter.emit("destroy",{timestamp:Date.now()})}openScope(){let{state:e,deps:t}=this,n=new Cl(t.log);n.own(()=>{t.merger?.destroy(),e.merges.destroy()}),n.own(()=>{t.scheduler.destroy()}),n.own(()=>{t.observers.stop()}),n.own(()=>{this.rootSentinel?.disconnect(),this.rootSentinel=null,this.observedRoot=null}),n.own(()=>{e.abortStrategies()}),n.own(()=>{t.bus.detach()}),n.own(()=>{t.heartbeat.stop()}),n.own(()=>{for(let t of e.readyTimers)clearTimeout(t);e.readyTimers.length=0}),this.scope=n}release(){let{state:e,deps:t}=this;e.display.end(),e.activeUpdate=null,e.navigationBindingReplay=!1,e.started=!1;let n=this.scope;this.scope=null,this.closingSession=!0;try{n?.close()}finally{this.closingSession=!1}return t.cache.clear(),t.connection.markDisconnected()}rollbackFailedStart(){this.release();try{this.deps.a11y?.detach()}catch(e){this.deps.log("runtime cleanup failed:",e)}}refreshCache(){this.state.isRunning()&&(this.state.revealer.reset(),this.followReplacedRoot()||this.rebuildCache())}navigationCommit(){let{state:e,deps:t}=this;!e.isRunning()||null!==e.deferredStart||(this.cancelActiveUpdate(!0),t.merger?.destroy(),e.merges.destroy(),e.abortStrategies(),this.cancelActiveUpdate(!0),e.forgetOwedWork(),e.merges.resetRawChanges(),e.unfaithfulPatches=[],e.revealer.reset(),e.lastAppliedIdentity=new WeakMap,e.changes.reset(),e.isRunning()&&(t.bus.advanceGeneration(),e.navigationReplayPending=!0,this.followReplacedRoot()||this.rebuildCache(),e.isRunning()&&(t.bus.replayLastAccepted(),e.isRunning()&&this.sendReadyAfterStart())))}watchRootReplacement(){let{root:e}=this.deps;!dt(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()||!dt(e))return!1;let t=ct(e);return null!==t&&t!==this.observedRoot&&(this.observedRoot=t,this.deps.observers.start(t),this.rebuildCache(),!0)}get status(){return this.deps.connection.status}get cache(){return this.deps.cache}get updateCount(){return this.state.updateCount}get protocol(){return this.state.protocol.negotiation}inspect(){return function(e,t){let{cache:n,scheduler:i}=e,r=t.protocol.negotiation,l=t.activeUpdate,a=t.lastFlush,o=[],s=new Set,u=[];for(let[e,t]of n.entries()){o.push(e);for(let n of t)void 0!==n.owner&&s.add(n.owner),void 0!==n.guessed&&u.push({field:e,matched:n.guessed,attribute:n.targetAttribute??("IMG"===n.element.tagName?"src":void 0)})}return{version:ml,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:Qe(r.observed).name},revisions:{accepted:t.updateCount,superseded:t.supersededCount,completed:t.completedCount,skippedUnchanged:t.skippedUnchangedCount,active:null===l?void 0:l.revision.revision,display:t.display.snapshot()},bindings:{elements:n.elementCount,fields:n.fieldCount,fieldNames:o.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,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:l?.pendingFragments??0,...t.fragmentStats},scheduler:{pending:i.pendingCount,deferred:i.replayCount,visibilityGateThreshold:i.gateThreshold,visibilityGateActive:i.gateActive,lastFlush:null===a?void 0:{applied:a.applied,appliedFields:a.appliedFields,deferred:a.deferred,durationMs:a.durationMs}},plugins:[],renderers:Object.keys(e.renderers).sort()}}(this.deps,this.state)}buildCacheAndObserve(){let{state:e,deps:t}=this;if(!e.isRunning())return;let n=t.cache.buildFromRoot(t.root);if(t.log("cache",n),e.isRunning()&&(t.emitter.emitWhile("cacheRefresh",n,()=>e.isRunning()),e.isRunning()))for(let n of t.cache.values()){if(!e.isRunning())return;t.observers.observeElement(n.element)}}rebuildCache(){let{state:e,deps:t}=this;if(!e.isRunning())return;let n=new Map,i=t.cache.islandOwners,r=new Set(t.cache.navigationReplayRoots);for(let e of t.cache.values())n.set(e.element,e),t.observers.unobserveElement(e.element);if(this.buildCacheAndObserve(),!e.isRunning())return;let l=new Set(t.cache.navigationReplayRoots.filter(e=>!r.has(e)));for(let e of t.cache.values()){let i=n.get(e.element);void 0!==i&&Le(i,e)?t.scheduler.retarget(e):(t.scheduler.forget(e.element),l.add(e.element)),n.delete(e.element)}for(let e of n.values())t.scheduler.forget(e.element);l.size>0&&this.pipeline.reapplyNavigationBindings(l);let a=t.cache.islands.filter(e=>!i.has(e)||t.scopeBindingsByOwner&&i.get(e)!==t.cache.islandOwners.get(e));a.length>0&&this.pipeline.reapplyNavigationIslands(a)}onHeartbeatTimeout(){let{state:e,deps:t}=this;if(!e.isRunning()||(this.cancelActiveUpdate(!1),t.merger?.destroy(),e.merges.destroy(),e.abortStrategies(),this.cancelActiveUpdate(!1),!e.isRunning()))return;t.bus.advanceGeneration(),t.bus.forgetLastAccepted(),e.navigationBindingReplay=!1;let 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())}cancelActiveUpdate(e){let{state:t,deps:n}=this,i=t.activeUpdate;t.display.end(),t.activeUpdate=null,null!==i&&(i.cancelled=!0,n.scheduler.cancelRevision(i.revision),e&&!i.completed&&i.countsAsUpdate&&(t.supersededCount+=1))}sendReadyAfterStart(){try{this.deps.sendReady(this.deps.readyTargets())}catch(e){this.reportError(e,"ready","LP0606")}}reportError(e,t,n){let i=e instanceof Error?e:new Error(String(e));this.deps.emitter.emit("error",{error:i,context:t,code:n})}isIdleDisconnected(){return this.state.isRunning()&&"disconnected"===this.deps.connection.status&&null===this.state.activeUpdate}},ja=/^https?:\\/\\/(localhost|127\\.0\\.0\\.1)(?::\\d+)?$/i,Da=/^https?:\\/\\/[^/?#\\s]+$/i,Wa=[3e3,3001,3333,4e3,4321,5e3,5173,5174,8e3,8080,8888,9e3],Ba=class{constructor(e={}){Ai(this,_a);let t=new Set;for(let n of e.additionalOrigins??[]){let e=Tn(n);void 0!==e&&t.add(e)}let n;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&&(n=e)}catch{}}let i=(e.enableLocalhostMatching??!0)&&(e.forceDevMode??ce());ki(this,_a,[t,n,i,void 0!==n,void 0,typeof location>"u"?void 0:location.ancestorOrigins?.[0]])}matches(e){return 0!==e.length&&"null"!==e&&(void 0!==Si(this,_a)[4]?e===Si(this,_a)[4]:!!(Si(this,_a)[0].has(e)||0===Si(this,_a)[0].size&&void 0!==Si(this,_a)[1]&&e===Si(this,_a)[1]||Si(this,_a)[2]&&ja.test(e)))}lockOrigin(e){return!!this.matches(e)&&(Si(this,_a)[4]=e,!0)}unlockOrigin(){let e=Si(this,_a)[4];return Si(this,_a)[4]=void 0,e}get lockedOrigin(){return Si(this,_a)[4]}enumerate(){if(void 0!==Si(this,_a)[4])return[Si(this,_a)[4]];let e=new Set(Si(this,_a)[0]);0===Si(this,_a)[0].size&&void 0!==Si(this,_a)[1]&&e.add(Si(this,_a)[1]);let t=Si(this,_a)[5];if(Si(this,_a)[2]&&void 0!==t)ja.test(t)&&e.add(t);else if(Si(this,_a)[2])for(let t of Wa)e.add(`http://localhost:${String(t)}`),e.add(`http://127.0.0.1:${String(t)}`);return[...e]}get referrerWasAvailable(){return Si(this,_a)[3]}get isProductionUnconfigured(){return!(!de()||Si(this,_a)[0].size>0||Si(this,_a)[2]||void 0!==Si(this,_a)[1])}get isReferrerOnlyTrust(){return!(Si(this,_a)[0].size>0||Si(this,_a)[2])&&void 0!==Si(this,_a)[1]}},_a=new WeakMap,za="astro:page-load",Va="astro:after-swap",qa={1:"left",2:"center",3:"right",4:"justify"},Ha=new Set(["left","center","right","justify","start","end"]),Ga=new Set(["h1","h2","h3","h4","h5","h6"]),Ka=/\\{(slug|id|collection|locale)\\}/gu,Ja=\' target="_blank" rel="noopener noreferrer"\',Xa=(e,t)=>{let n=t.renderChildren(e.children??[]),i=Nn(e.fields),r=function(e,t,n){if("internal"===t?.linkType)return function(e,t){let n=Nn(e),i=Nn(n?.value),r=i?.url;if("string"==typeof r&&r.length>0)return r;let l=void 0===t.internalLinkPattern?void 0:function(e,t){let n=e=>{let n=t[e];return"string"==typeof n&&n.length>0||"number"==typeof n?encodeURIComponent(n):void 0};for(let[,t=""]of e.matchAll(Ka))if(void 0===n(t))return;return e.replace(Ka,(e,t)=>n(t)??"")}(t.internalLinkPattern,{slug:i?.slug,id:void 0===i?n?.value:i.id,collection:n?.relationTo,locale:t.locale});if(void 0!==l)return l;let a=i?.slug;return"string"==typeof a&&a.length>0?`/${a}`:void 0}(t.doc,n);let i=t?.url??e.url;return"string"==typeof i&&i.length>0?i:void 0}(e,i,t);if(void 0===r||!M(r))return n;let l="string"==typeof e.title?` title="${Jt(e.title)}"`:"";return`<a href="${Xt(r)}"${function(e,t,n){if(!0===t?.newTab||O(n))return Ja;let i="string"==typeof e.target?e.target:"";return""===i?"":"_blank"===i?Ja:` target="${Jt(i)}"`}(e,i,r)}${l}>${n}</a>`},Qa=new Map,Za=".lp-block:empty,.lp-inline-block:empty",Ya={text:e=>{let t=Jt("string"==typeof e.text?e.text:""),n="number"==typeof e.format?e.format:0;return!!(16&n)&&(t=`<code>${t}</code>`),!!(1&n)&&(t=`<strong>${t}</strong>`),!!(2&n)&&(t=`<em>${t}</em>`),!!(8&n)&&(t=`<u>${t}</u>`),!!(4&n)&&(t=`<s>${t}</s>`),!!(32&n)&&(t=`<sub>${t}</sub>`),!!(64&n)&&(t=`<sup>${t}</sup>`),!!(128&n)&&(t=`<mark>${t}</mark>`),t},paragraph:(e,t)=>{let n=t.renderChildren(e.children??[]);return`<p${$n(e)}${Fn(e)}>${n}</p>`},heading:(e,t)=>{let n="string"==typeof e.tag?e.tag.toLowerCase():"h2",i=Ga.has(n)?n:"h2",r=t.renderChildren(e.children??[]);return`<${i}${$n(e)}${Fn(e)}>${r}</${i}>`},list:(e,t)=>{let n="string"==typeof e.listType?e.listType:"bullet",i="number"===n?"ol":"ul",r="number"===n&&"number"==typeof e.start&&e.start>1?` start="${String(e.start)}"`:"",l="check"===n?\' role="list"\':"",a=t.renderChildren(e.children??[]);return`<${i}${$n(e)}${Fn(e)}${r}${l}>${a}</${i}>`},listitem:(e,t)=>{let n=t.renderChildren(e.children??[]);if("boolean"==typeof e.checked)return`<li role="checkbox" aria-checked="${e.checked?"true":"false"}"${Fn(e)}>${n}</li>`;let i="number"==typeof e.value?` value="${Jt(String(e.value))}"`:"";return`<li${$n(e)}${Fn(e)}${i}>${n}</li>`},link:Xa,autolink:Xa,quote:(e,t)=>{let n=t.renderChildren(e.children??[]);return`<blockquote${$n(e)}${Fn(e)}>${n}</blockquote>`},code:e=>{let t=En("string"==typeof e.language?e.language:"");return`<pre><code${""===t?"":` class="language-${t}"`}>${Jt(xn(e))}</code></pre>`},"code-highlight":e=>{let t="string"==typeof e.text?e.text:"";return`<span${"string"==typeof e.highlightType?` class="token-${En(e.highlightType)}"`:""}>${Jt(t)}</span>`},linebreak:()=>"<br>",horizontalrule:()=>"<hr>",tab:()=>"\\t",upload:e=>{let t=Mn(e.value);if(void 0===t)return"";let n=t.url;if("string"!=typeof n||!M(n))return"";let i="string"==typeof t.mimeType?t.mimeType:"";return i.startsWith("video/")?function(e,t){return`<video controls${Un(e)}><source src="${Xt(t)}"${In(e)}></video>`}(t,n):i.startsWith("audio/")?function(e,t){return`<audio controls><source src="${Xt(t)}"${In(e)}></audio>`}(t,n):""===i||i.startsWith("image/")?function(e,t){let n="string"==typeof e.alt?Jt(e.alt):"";return`<img src="${Xt(t)}" alt="${n}"${Un(e)} loading="lazy" decoding="async">`}(t,n):function(e,t){let n="string"==typeof e.filename?Jt(e.filename):Jt(t);return`<a href="${Xt(t)}" target="_blank" rel="noopener noreferrer">${n}</a>`}(t,n)},relationship:e=>{let t="string"==typeof e.relationTo?e.relationTo:"",n=Nn(e.value),i=Jt((n&&Pn(n))??`#${t}`),r=En(t),l=""===r?\' class="lp-relation"\':` class="lp-relation lp-relation--${r}"`,a=n?.url;return"string"==typeof a&&M(a)?`<a href="${Xt(a)}"${l}>${i}</a>`:`<span${l}>${i}</span>`},block:(e,t)=>Dn(e,t,"div","lp-block"),inlineBlock:(e,t)=>Dn(e,t,"span","lp-inline-block"),table:(e,t)=>`<table${$n(e)}><tbody>${t.renderChildren(e.children??[])}</tbody></table>`,tablerow:(e,t)=>`<tr>${t.renderChildren(e.children??[])}</tr>`,tablecell:(e,t)=>{let n="number"==typeof e.headerState?e.headerState:0,i=3&n?"th":"td";return`<${i}${1===n?\' scope="col"\':2===n?\' scope="row"\':""}${Wn("colspan",e.colSpan)}${Wn("rowspan",e.rowSpan)}>${t.renderChildren(e.children??[])}</${i}>`}},eo=new Map,to=!1,no="data-payload-text",io=new Set,ro=new Set,lo=new WeakMap,ao=new Set(["DIV","SECTION","ARTICLE"]),oo={name:"richText",render:L((e,t,n)=>{let i=e.element;if(nn(t)){i.textContent="";return}let r=n.sanitizerPolicy;if(void 0!==n.renderRichText){let l=n.renderRichText(t,{fieldName:e.fieldName,element:i,locale:n.locale});i.innerHTML=Et(_t(l,r));return}if(Bn(t)){if(ye(t)){i.textContent="";return}let l=new Map,a=[],o=qn(i,_t(function(e,t={}){if(!Bn(e))return"";let n=function(e){let t={renderChildren:e=>{let n="";for(let i of e)n+=_n(i,t);return n},resolveAlignment:Cn,resolveIndent:Rn,onUnrenderedBlock:e.onUnrenderedBlock,internalLinkPattern:e.internalLinkPattern,locale:e.locale};return t}(t).renderChildren(e.root.children);return!1===t.sanitize?n:void 0!==t.document?Bt(n,{document:t.document}):!0===t.requireDocument||void 0!==qt()?Bt(n):(function(){if(!to){to=!0;try{console.warn(\'[live-preview] lexicalToHtml() has no sanitizer document and returned unsanitised HTML; pass { document } (linkedom, jsdom) per call. 3.0 throws here instead: opt in now with { requireDocument: true }. See "HTML sanitization" in docs/security.md.\')}catch{}}}(),n)}(t,{sanitize:!1,internalLinkPattern:n.internalLinkPattern,locale:n.locale,onUnrenderedBlock:(e,t,n)=>{l.set(t,e),a.push(n)}}),r));for(let[t,i]of o){let r=l.get(t);void 0!==r&&Gn(e,n,r,i)}!function(e,t,n,i){let r=function(e){try{return JSON.stringify(e,(e,t)=>"object"==typeof t&&null!==t&&"id"in t&&"updatedAt"in t?t.id:t)}catch{return}}(n),l=lo.get(e.element);void 0===r?lo.delete(e.element):lo.set(e.element,r),void 0!==r&&void 0!==l&&r!==l&&[...i.values()].includes(!1)&&t.reportUnfaithful?.(e,"changed a block no renderer draws")}(e,n,a,o);return}if("string"!=typeof t)return!1;i.innerHTML=Et(_t(t,r))})},so={name:"html",render(e,t,n){if(nn(t)){e.element.textContent="";return}let i="string"==typeof t?t:tn(t);e.element.innerHTML=Et(_t(i,n.sanitizerPolicy))}},uo=new WeakSet,co=Jn("url"),ho=/^[a-zA-Z][a-zA-Z0-9+.-]*:/,fo=Jn("email",function(e){let t=e.trim();return ho.test(t)||!t.includes("@")?t:`mailto:${t}`}),po=["src","srcset","sizes"],go=new WeakMap,mo=/^(?:\\.{0,2}\\/|\\S*[/.:]\\S*$|.*\\.(?:avif|bmp|gif|ico|jpe?g|png|svg|tiff?|webp)$)/i,vo={name:"image",render:L((e,t,n)=>{let i=e.element;if("IMG"===i.tagName&&e.altField===e.fieldName&&void 0===e.srcField&&("string"==typeof t||nn(t))){i.alt=t??"";return}if(nn(t)){ni(i);return}let r=void 0!==e.locale,{media:l,candidate:a}=function(e,t,n,i){let r=void 0!==e.srcField&&e.srcField.length>0?x(n.allFields,e.srcField,n.locale,i):t,l=Mn(r);return{media:l,candidate:void 0===l?r:l.url}}(e,t,n,r);if(void 0===l&&"string"==typeof a&&!mo.test(a.trim()))return!1;let o=Kn(i,e.fieldName,a,void 0===l?void 0:n.serverURL);if("none"===o.kind)return!1;if("unsafe"!==o.kind){if("IMG"===i.tagName){let t=i;Zn(t,o.url,l,n.serverURL);let a=function(e,t,n,i,r){if(void 0!==t&&t.length>0){let e=x(n,t,i,r);return"string"==typeof e?e:void 0}return e?.alt}(l,e.altField,n.allFields,n.locale,r);void 0!==a&&(t.alt=a);return}i.style.backgroundImage=`url(\'${function(e){return e.replace(/[\'"()\\\\]/g,"\\\\$&")}(o.url)}\')`}else ni(i)})},yo={name:"upload",render:L((e,t,n)=>{let i=e.element;if(nn(t)){ii(i);return}let r=Mn(t);if(void 0===r)return!1;let l=Kn(i,e.fieldName,r.url,n.serverURL);if("none"===l.kind)return!1;if("unsafe"===l.kind){ii(i);return}let a=l.url;if("IMG"===i.tagName){let e=i;Zn(e,a,r,n.serverURL),void 0!==r.alt&&(e.alt=r.alt);return}if("A"===i.tagName){i.setAttribute("href",a),i.textContent=r.filename??a;return}let o=Jt(r.filename??a);i.innerHTML=Et(`<a href="${Xt(a)}">${o}</a>`)})},bo={name:"relationship",render(e,t){let n=e.element;if(nn(t))n.removeAttribute("href"),n.textContent="";else{if("A"===n.tagName&&!Array.isArray(t)){let i=Kn(n,e.fieldName,Nn(t)?.url);"safe"===i.kind?n.setAttribute("href",i.url):"unsafe"===i.kind&&n.removeAttribute("href")}n.textContent=Array.isArray(t)?t.map(ri).join(", "):ri(t)}}},wo={name:"select",render(e,t,n){let i=e.element,r=nn(t)?[]:function(e){return Array.isArray(e)?e.map(tn):[tn(e)]}(t);if("SELECT"!==i.tagName){if("INPUT"===i.tagName&&"radio"===i.type){let e=i;e.checked=r.includes(e.value);return}i.textContent=r.map(e=>function(e,t){let n=t.schema?.options;if(!Array.isArray(n))return e;for(let t of n){let n=Nn(t);if(void 0!==n&&tn(n.value)===e)return"string"==typeof n.label?n.label:e}return e}(e,n)).join(", ")}else!function(e,t){if(e.multiple)for(let n of Array.from(e.options))n.selected=t.includes(n.value);else e.value=t[0]??""}(i,r)}},So=new Set(["","false","0","off","no"]),Ao={name:"checkbox",render(e,t){let n=e.element,i=function(e){return"boolean"==typeof e?e:"string"==typeof e?!So.has(e.trim().toLowerCase()):"number"==typeof e?0!==e:null!=e}(t);"INPUT"!==n.tagName||"checkbox"!==n.type?n.hasAttribute("aria-checked")?n.setAttribute("aria-checked",i?"true":"false"):n.textContent=i?"true":"false":n.checked=i}},ko=new Map,To=new Map,Co=new Set(["short","medium","long","full"]),Ro=new Set(["short","medium","long","full"]),$o=/^[A-Za-z]{3}$/u,Fo=/^[0-4]$/u,No=new WeakSet,Mo={name:"date",render(e,t,n){let i=e.element;if(nn(t)){"INPUT"===i.tagName?i.value="":(i.removeAttribute("datetime"),i.textContent="");return}let r="number"==typeof t?t:tn(t),l=new Date(r),a=!Number.isNaN(l.getTime()),o=String(r);"INPUT"!==i.tagName?("TIME"===i.tagName&&i.setAttribute("datetime",a?l.toISOString():o),i.textContent=a?function(e,t,n){let i=t.locale??n.locale??d(),r=ui("date",t.format,t.element,t.fieldName)??Oo;try{return function(e,t){let n=li(e,t);return rn(To,n)??ln(To,n,new Intl.DateTimeFormat(e,t),64)}(i,r).format(e)}catch{return e.toISOString()}}(l,e,n):o):i.value=a?function(e,t){let n=`${String(t.getFullYear()).padStart(4,"0")}-${di(t.getMonth()+1)}-${di(t.getDate())}`,i=`${di(t.getHours())}:${di(t.getMinutes())}`;return"date"===e?n:"datetime-local"===e?`${n}T${i}`:"time"===e?i:t.toISOString()}(i.type,l):o}},Oo={dateStyle:"medium",timeStyle:"short"},Eo={name:"number",render(e,t,n){let i=e.element;if(nn(t)){"INPUT"===i.tagName?i.value="":i.textContent="";return}let r="number"==typeof t?t:Number(tn(t));Number.isNaN(r)?i.textContent=tn(t):"INPUT"!==i.tagName?i.textContent=function(e,t,n){let i=t.locale??n.locale??d(),r=ui("number",t.format,t.element,t.fieldName);try{return function(e,t){let n=li(e,t);return rn(ko,n)??ln(ko,n,new Intl.NumberFormat(e,t),64)}(i,r).format(e)}catch{return String(e)}}(r,e,n):i.value=String(r)}},Lo={name:"array",render:L((e,t,n)=>{let i=e.element;if(nn(t)){i.textContent="";return}if(!Array.isArray(t))return!1;let r=e.arrayTemplate;if(void 0!==r&&r.length>0){let e=function(e,t){let n=Qt(t),i="";for(let r=0;r<t.length;r+=1)i+=Zt(e,t[r],r,tn,n);return i}(r,t),l=n.sanitizerPolicy,a=an(r),o=Yt(i);i.innerHTML=Et(_t(e,l,a));for(let e of Array.from(i.children))en(e,o);return}i.textContent=t.map(tn).join(e.arraySeparator??", ")})},Po=new Map;!function(){if(typ','eof window>"u"||!de()&&(typ','eof window>"u"||null==window.opener))return;let e=window.__livePreview,t=JSON.stringify(mi());if(void 0!==e&&(void 0===e.configSignature||e.configSignature===t))return e.refresh(),e;let[n=[],i="",l="/api",a=1,o=!1,s=50,u=!0,d=0,c=!1,h=50,f="200px",p=!0,g=!1,m=!1,v=!0,y="parent-or-opener",b="strict",w,S=!1,A=!1,k,T,C="off",R,$,F=[],N,M,O]=mi(),E=function(e){let t=typeof __LIVE_PREVIEW_FRAGMENT__<"u"?__LIVE_PREVIEW_FRAGMENT__:void 0,n=t??(typeof __LIVE_PREVIEW_ROUTE__<"u"?__LIVE_PREVIEW_ROUTE__:void 0);if(void 0===n)return;let i=n.createRouteStrategy();return void 0===t||void 0===e||""===e?{route:i}:{fragment:t.createFragmentStrategy({endpoint:e}),route:i}}(w),L=new Ba({additionalOrigins:n,enableReferrerDetection:!p,enableLocalhostMatching:!g});L.isProductionUnconfigured?Ri("[live-preview] LP0101: No trusted origin. Pass allowedOrigins to generateInlineScript() (or to the adapter) \\u2014 the runtime reads no environment variable in the browser."):L.isReferrerOnlyTrust&&Ri("[live-preview] LP0102: document.referrer fallback trusts any framing site. Set allowedOrigins and a frame-ancestors CSP in production.");let P=new Fi,x=function(){let e=[oo,so,co,fo,vo,yo,bo,wo,{...wo,name:"radio"},Ao,Mo,Eo,Lo,{...Lo,name:"blocks"}];return function(e=[]){let t={};for(let n of e)t[n.name]=n;for(let[e,n]of Po)t[e]=n;return Object.freeze(t)}([Vn("text"),Vn("textarea"),...e,ci()])}(),U=new Ia({renderers:x,originMatcher:e=>L.matches(e),lockedOrigin:()=>L.lockedOrigin,readyTargets:()=>L.enumerate(),emitter:P,eventSourcePolicy:y,...""!==i?{dataMerge:{serverURL:i,apiRoute:l,depth:a,...void 0===M?{}:{timeoutMs:M}}}:{},...void 0===O?{}:{internalLinkPattern:O},..."after-save"===A?{routeAfterSave:!0}:{},debounceMs:s,heartbeatMs:d,intersectionRootMargin:f,disableVisibilityGate:c,visibilityGateThreshold:h,enableA11y:u,scopeBindingsByOwner:m,...void 0===N?{}:{subfieldCoverage:N},skipUnchanged:v,revealEditedField:S,onUnfaithfulPatch:r({onUnfaithfulPatch:T,onUnboundChange:k}),autoBind:C,...void 0!==R?{hydration:R}:{},sanitizerPolicy:b,...void 0!==E?{strategies:E}:{},onHeartbeatTimeout:()=>{L.unlockOrigin()},...o?{log:(...e)=>{$i("[live-preview]",...e)}}:{}});P.on("connect",e=>{L.lockOrigin(e.origin)}),U.start(),e?.destroy();let I=function(e,t={}){let n=t.windowTarget??globalThis.window,i=t.documentTarget??globalThis.document,r=[...new Set(t.softNavigationEvents??[])],l=()=>{e.suspend()},a=t=>{!0===t.persisted&&e.resume()},o=!1,s=()=>{o=!0},u=t=>{if(t.type===za){if(!o)return;o=!1}void 0===e.refreshAfterNavigation?e.refreshCache():e.refreshAfterNavigation()},d=!1;n?.addEventListener("pagehide",l),n?.addEventListener("pageshow",a);for(let e of r)i?.addEventListener(e,u);let c=r.includes(za);return c&&i?.addEventListener(Va,s),()=>{if(!d){d=!0,n?.removeEventListener("pagehide",l),n?.removeEventListener("pageshow",a);for(let e of r)i?.removeEventListener(e,u);c&&i?.removeEventListener(Va,s)}}}({suspend:()=>U.suspend(),resume:()=>U.start(),refreshCache:()=>{U.refreshCache()},refreshAfterNavigation:()=>{U.navigationCommit()}},{softNavigationEvents:F}),j=Object.freeze({version:ml,configSignature:t,destroy:()=>{I(),U.destroy();let e=window;e.__livePreview===j&&delete e.__livePreview},refresh:()=>{U.refreshCache()},refreshAfterNavigation:()=>{U.navigationCommit()},enumerateOrigins:()=>L.enumerate(),inspect:()=>U.inspect()});try{Object.defineProperty(window,"__livePreview",{value:j,writable:!1,configurable:!0})}catch(e){throw I(),U.destroy(),e}}()})();'].join(""),ea={generatedAt:"2026-11-03T13:36:02.000Z",size:153603},ta=/* @__PURE__ */['"use strict";var __LIVE_PREVIEW_FRAGMENT__=(()=>{var P=Object.defineProperty;var fe=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var ye=Object.prototype.hasOwnProperty;var pe=(e,t)=>{for(var n in t)P(e,n,{get:t[n],enumerable:!0})},ge=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of me(t))!ye.call(e,o)&&o!==n&&P(e,o,{get:()=>t[o],enumerable:!(a=fe(t,o))||a.enumerable});return e};var he=e=>ge(P({},"__esModule",{value:!0}),e);var Ye={};pe(Ye,{createFragmentStrategy:()=>ce,createRouteStrategy:()=>ue});function k(e,t){let n=new AbortController,a=!1,o=()=>{n.abort()};e.addEventListener("abort",o,{once:!0});let r=setTimeout(()=>{a=!0,n.abort()},t);return{signal:n.signal,timedOut:()=>a,dispose:()=>{clearTimeout(r),e.removeEventListener("abort",o)}}}function R(e){return e instanceof Error?e.message:String(e)}var D="data-payload-island",Qe=`astro-island, [${D}]`,w="data-payload-owned",be="data-payload-morph";function F(e){if(e.tagName.toLowerCase().includes("-")&&!e.hasAttribute(be)||z(e)||e.hasAttribute(w))return!0;let n=e.getAttribute("contenteditable");return n!==null&&n!=="false"}function Ee(e){return e.tagName.toLowerCase()==="astro-island"||e.hasAttribute(D)}function Se(e){return e.getAttribute(D)==="patch"}function z(e){return Ee(e)&&!Se(e)}function V(e){let t=e;for(;t!==null;){if(z(t))return!0;t=t.parentElement}return!1}var Re=["component-url","component-export","renderer-url","client","opts","before-hydration-url"],v=new WeakMap,G=new WeakSet;function W(e){return e.tagName.toLowerCase()==="astro-island"}function q(e){let t="";for(let n of e.querySelectorAll("astro-slot, template[data-astro-template]")){if(n.parentElement?.closest("astro-island")!==e)continue;let a=n.getAttribute("name")??n.getAttribute("data-astro-template")??"";t+=`${a}\\0${n.innerHTML}\\0`}return t}function Ae(e){let t=e.ownerDocument.defaultView?.customElements.get("astro-island");return t!==void 0&&e instanceof t&&Array.isArray(t.observedAttributes)&&t.observedAttributes.includes("props")}function j(e,t){if(!W(e)||!W(t))return!0;let n=q(t);if(!(Re.every(r=>e.getAttribute(r)===t.getAttribute(r))&&(v.get(e)??q(e))===n&&(e.getAttribute("props")===t.getAttribute("props")||Ae(e))))return v.set(t,n),!1;v.set(e,n);let o=t.getAttribute("props");return o!==e.getAttribute("props")&&(e.setAttribute("ssr",""),o===null?e.removeAttribute("props"):e.setAttribute("props",o)),!0}function Y(e){return Array.from(e.querySelectorAll("astro-island"))}function X(e){for(let t of e)t.isConnected||G.has(t)||(G.add(t),t.dispatchEvent(new CustomEvent("astro:unmount")))}function O(e){if(e==null)return[];let t=new Set,n=[];for(let a of e.split(/[\\s,]+/)){let o=a.trim();o.length===0||t.has(o)||(t.add(o),n.push(o))}return n}var A="data-payload-fragment",I="data-payload-fragment-key";var Te="data-payload-depends";function B(e){let t=e.getAttribute(A);if(t===null||t.length===0)return null;let n=e.getAttribute(I);return{element:e,id:t,key:n===null||n.length===0?void 0:n,dependsOn:O(e.getAttribute(Te))}}function J(e,t){let n=[];for(let a of e.querySelectorAll(`[${A}]`)){let o=B(a);o===null||V(a)||o.dependsOn.length>0&&!o.dependsOn.some(r=>t.has(r))||n.push(o)}return n}var Q="x-payload-fragment-version";function _(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Z(e){if(!_(e))return null;let{html:t,boundary:n,revision:a,metadata:o}=e;return typeof t!="string"||!_(n)||typeof n.id!="string"||n.key!==void 0&&typeof n.key!="string"||typeof a!="number"||!_(o)||typeof o.renderedAt!="string"||typeof o.renderer!="string"?null:e}function ee(e){let t={};for(let[n,a]of Object.entries(e))a!==void 0&&(t[n]=a);return t}function L(e){return e.reason instanceof Error?e.reason:new DOMException("The operation was aborted.","AbortError")}function C(e){return e?.aborted===!0}function te(e){let t=0,n=[],a=()=>{let o=n.shift();o===void 0?t-=1:o.resume()};return async(o,r)=>{if(r!==void 0&&C(r))throw L(r);if(t<e)t+=1;else if(await new Promise((d,m)=>{let l=()=>{},u={resume:()=>{l(),d()}};if(n.push(u),r!==void 0){let s=()=>{let c=n.indexOf(u);c!==-1&&(n.splice(c,1),l(),m(L(r)))};l=()=>{r.removeEventListener("abort",s)},r.addEventListener("abort",s,{once:!0}),C(r)&&s()}}),r!==void 0&&C(r))throw a(),L(r);try{return await o()}finally{a()}}}var xe=5e3,ke=4,Fe=512*1024,T={status:"superseded"};function b(e,t){return{status:"failed",code:e,reason:t}}function Oe(e){let t=()=>{throw new TypeError(\'createFragmentStrategy: endpoint must be a same-origin path starting with "/"\')};if((typeof e!="string"||!e.startsWith("/")||e.startsWith("//")||e.includes("\\\\"))&&t(),typeof location<"u"){let n;try{n=new URL(e,location.href)}catch{n=void 0}n?.origin!==location.origin&&t()}return e}function Ie(e){return typeof e=="object"&&e!==null&&typeof e.getReader=="function"}async function Ne(e,t,n){let a=e.body;if(!Ie(a)){let u=await e.text();return new TextEncoder().encode(u).byteLength>t?null:u}let o=a.getReader(),r=()=>{o.cancel().catch(()=>{})};n.addEventListener("abort",r,{once:!0});let d=new TextDecoder,m="",l=0;try{for(;;){let{done:u,value:s}=await o.read();if(u)break;if(l+=s.byteLength,l>t)return r(),null;m+=d.decode(s,{stream:!0})}}finally{n.removeEventListener("abort",r),o.releaseLock()}return m+d.decode()}function ne(e){let t=Oe(e.endpoint),n=e.timeoutMs??xe,a=e.maxResponseBytes??Fe,o=te(Math.max(1,e.maxConcurrent??ke)),r=new Map,d=new WeakMap,m=0,l=s=>{let c=d.get(s);return c!==void 0?c:(m+=1,d.set(s,m),m)};async function u(s,c){let i=()=>s.signal.aborted;if(i())return T;let h=e.location??location,p=ee({fragment:c.id,key:c.key,route:h.pathname,search:h.search,revision:s.revision,locale:s.locale,collectionSlug:s.collectionSlug,globalSlug:s.globalSlug,fields:s.fields}),f=k(s.signal,n),y=E=>i()?T:f.timedOut()?b("LP0801",`timeout after ${String(n)} ms`):b("LP0801",R(E)),g,x=!1;try{try{g=await(e.fetch??fetch)(t,{method:"POST",credentials:"same-origin",headers:{...e.headers,accept:"application/json","content-type":"application/json",[Q]:String(1)},body:JSON.stringify(p),signal:f.signal})}catch(M){return y(M)}if(i())return T;if(g.status===401||g.status===403)return b("LP0803",`endpoint refused the preview (${String(g.status)})`);if(!g.ok)return b("LP0801",`endpoint answered ${String(g.status)}`);let E=g.headers.get("content-type")??"";if(!E.toLowerCase().startsWith("application/json"))return b("LP0802",`unexpected content type "${E}"`);if(Number(g.headers.get("content-length")??"0")>a)return b("LP0802","response exceeds the size limit");if(f.signal.aborted)return y(f.signal.reason);let N;try{x=!0,N=await Ne(g,a,f.signal)}catch(M){return y(M)}if(i())return T;if(f.timedOut())return b("LP0801",`timeout after ${String(n)} ms`);if(N===null)return b("LP0802","response exceeds the size limit");let $;try{$=JSON.parse(N)}catch{return b("LP0802","response is not JSON")}let S=Z($);return S===null?b("LP0802","response has the wrong shape"):S.boundary.id!==c.id||S.boundary.key!==c.key?b("LP0802","response is for another boundary"):S.revision!==s.revision?T:{status:"rendered",html:S.html,metadata:S.metadata}}finally{if(f.dispose(),g!==void 0&&!x)try{g.body?.cancel().catch(()=>{})}catch{}}}return(s,c)=>{let i=JSON.stringify([l(s.signal),c.id,c.key,s.revision]),h=r.get(i);if(h!==void 0)return h;let p=!1,f=o(()=>(p=!0,u(s,c)),s.signal).catch(g=>{if(!p&&s.signal.aborted)return T;throw g});r.set(i,f);let y=()=>{r.get(i)===f&&r.delete(i)};return f.then(y,y),f}}var Me=new Set(["open","value","checked","selected"]);function oe(e,t){for(let n of t.keyAttributes){let a=e.getAttribute(n);if(a!==null&&a.length>0)return`${n}=${a}`}}function H(e,t,n){if(!U(e,t))return t;let a=n.boundary??F,o=a(e),r=a(t);if(o||r)return!o||!r?t:n.retainBoundary?.(e,t)??!0?e:t;let d=_e(e);return Pe(e,t),n.retainChildrenOf?.(e,t)!==!0&&ve(e,t,n),Le(d),e}function Pe(e,t){for(let n of Array.from(e.attributes))t.hasAttribute(n.name)||Me.has(n.name.toLowerCase())||e.removeAttribute(n.name);for(let n of Array.from(t.attributes))e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value)}function ve(e,t,n){let a=Be(e,n),o=new Set(a.values()),r=Array.from(e.childNodes).filter(c=>!o.has(c)),d=new Set,m=new Set,l=Array.from(t.childNodes),u=e.firstChild,s=0;for(let c=0;c<l.length;c+=1){let i=l[c],h=null,p=i instanceof Element?oe(i,n):void 0;if(p!==void 0&&m.has(p)&&(p=void 0),p!==void 0){m.add(p);let y=a.get(p);if(y!==void 0&&!d.has(y)&&(h=re(y,i,n)===y?y:null,h===null)){y.replaceWith(i),d.add(i),u=i.nextSibling;continue}}else{for(;s<r.length;){let y=r[s];if(s+=1,!d.has(y)){if(U(y,i)){h=re(y,i,n)===y?y:null,h===null&&(e.replaceChild(i,y),d.add(i),u=i.nextSibling);break}if(y instanceof Element){let g=l[c+1];if(!(i instanceof Element)||g!==void 0&&U(y,g)){s-=1;break}e.replaceChild(i,y),d.add(i),u=i.nextSibling;break}if(!(i instanceof Element)){e.replaceChild(i,y),d.add(i),u=i.nextSibling;break}}}if(h===null&&d.has(i))continue}let f=h??i;for(d.add(f);u!==null&&u!==f&&!d.has(u)&&De(u);)u=u.nextSibling;f!==u&&e.insertBefore(f,u),u=f.nextSibling}for(let c of Array.from(e.childNodes))d.has(c)||c.remove()}function re(e,t,n){return e instanceof Element&&t instanceof Element?H(e,t,n):(e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e)}function De(e){return e.nodeType===Node.TEXT_NODE&&(e.nodeValue??"").trim().length===0}function U(e,t){return e.nodeType!==t.nodeType?!1:e instanceof Element&&t instanceof Element?e.tagName===t.tagName&&e.namespaceURI===t.namespaceURI:!0}function Be(e,t){let n=new Map,a;for(let o of Array.from(e.children)){let r=oe(o,t);if(r!==void 0){if(n.has(r)){a??(a=r.slice(r.indexOf("=")+1));continue}n.set(r,o)}}return a!==void 0&&t.onDuplicateKey?.(e,a),n}function _e(e){let t=e.ownerDocument.activeElement;if(!(t instanceof HTMLElement)||!e.contains(t))return null;let n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?[t.selectionStart,t.selectionEnd]:null;return{element:t,selection:n}}function Le(e){if(e===null)return;let{element:t,selection:n}=e;if(!(t.ownerDocument.activeElement===t||!t.isConnected))try{t.focus({preventScroll:!0});let[a,o]=n??[null,null];a!==null&&o!==null&&t.setSelectionRange(a,o)}catch{}}var ae="data-payload-key";var Ce="__livePreviewRouteRefresh";function Ue(){return typ','eof window>"u"?void 0:window}function ie(){return Ue()?.[Ce]}var le="data-payload-strategy",de="data-payload-field",He="data-payload-depends",Ke="x-payload-live-preview",$e=8e3,Ge="route refresh returned no promise; re-applied before the host committed (see LivePreviewRouteRefresh)",We=1e3;function qe(e){let t=e.getAttribute(le);return t!==null?t==="route":e.closest("head")!==null}function ze(e){let t=e.getAttribute(de),n=O(e.getAttribute(He));return t===null||t.length===0?n:[t,...n]}function se(e){return e.hasAttribute(w)?!1:e.tagName==="META"?e.hasAttribute("name")||e.hasAttribute("property"):e.tagName==="LINK"&&e.getAttribute("rel")==="canonical"}function Ve(e,t){let n=Array.from(e.head.children).find(l=>l.tagName==="TITLE"),a=Array.from(t.head.children).find(l=>l.tagName==="TITLE");!n?.hasAttribute(w)&&!a?.hasAttribute(w)&&t.title!==e.title&&(e.title=t.title);let o=Array.from(e.head.children).filter(se),r=Array.from(t.head.children).filter(se),d=Math.min(o.length,r.length);o.slice(0,d).forEach((l,u)=>{let s=r[u];if(s===void 0)return;if(l.tagName===s.tagName){for(let i of Array.from(l.attributes))s.hasAttribute(i.name)||l.removeAttribute(i.name);for(let i of Array.from(s.attributes))l.getAttribute(i.name)!==i.value&&l.setAttribute(i.name,i.value);return}let c=e.importNode(s,!0);l.replaceWith(c),o[u]=c});let m=o.at(-1);for(let l of r.slice(o.length)){let u=e.importNode(l,!0);m===void 0?e.head.append(u):m.after(u),m=u}for(let l of o.slice(r.length))l.remove()}function ue(e={}){let t=e.timeoutMs??$e,n=e.minIntervalMs??We,a=-1/0,o=!1;return{plan(r,d,m){for(let l of r.querySelectorAll(`[${de}], [${le}="route"]`)){if(!qe(l)||m?.inScope(l)===!1)continue;let u=ze(l);if(u.length===0||u.some(s=>d.has(s)))return!0}return!1},async refresh(r){let d=Date.now(),m=n-(d-a);if(m>0)return r.retryAfter?.(m),r.log("LP0805",`route refresh for revision ${String(r.revision)} refused: the previous one was ${String(d-a)} ms ago`),"refused";a=d;let l=e.document??document,u=e.location??location,s=e.window??window,c=k(r.signal,t),i=h=>{if(r.signal.aborted)return"superseded";let p=c.timedOut()?`route refresh timed out after ${String(t)} ms`:R(h);return r.log("LP0801",p),"failed"};try{let h=ie();if(h!==void 0){try{let f=h();typeof f?.then!="function"&&!o&&(o=!0,r.log("LP0810",Ge)),await f}catch(f){return i(f)}return r.isCurrent()?"partial":"superseded"}let p;try{p=await(e.fetch??fetch)(u.href,{method:"GET",credentials:"same-origin",cache:"no-store",headers:{accept:"text/html",[Ke]:"route"},signal:c.signal})}catch(f){return i(f)}if(r.signal.aborted)return"superseded";if(!p.ok||!(p.headers.get("content-type")??"").includes("text/html"))return r.log("LP0802",`route answered ${String(p.status)} ${p.headers.get("content-type")??""}`),"failed";try{let f=await p.text();if(!r.isCurrent())return"superseded";let y=new DOMParser().parseFromString(f,"text/html"),g=s.scrollX,x=s.scrollY;Ve(l,y);let E=Y(l.body);return H(l.body,y.body,{boundary:F,retainBoundary:j,keyAttributes:[ae,I,A],retainChildrenOf:K=>K.hasAttribute(A)}),X(E),s.scrollTo(g,x),"partial"}catch(f){return i(f)}}finally{c.dispose()}}}}function je(e){return{plan:(t,n)=>J(t,n).map(a=>a.element),async render(t,n){let a={rendered:0,failed:0,superseded:0},o={revision:t.revision,receivedAt:t.receivedAt,fields:t.fields,locale:t.locale,collectionSlug:t.collectionSlug,globalSlug:t.globalSlug,signal:t.signal};return await Promise.all(n.map(async r=>{let d=B(r);if(d===null)return;let m;try{m=await e(o,d)}catch(l){m={status:"failed",code:"LP0801",reason:R(l)}}if(!t.isCurrent()||m.status==="superseded"){a.superseded+=1,t.log("LP0804",`fragment "${d.id}" for revision ${String(o.revision)} discarded as superseded`);return}if(m.status==="rendered"){t.morph(r,m.html),t.rendered(r,d.id,d.key),a.rendered+=1;return}t.failed(r,d.id,d.key,m.code,m.reason),t.isCurrent()&&t.patch(r),a.failed+=1})),a}}}function ce(e){return je(ne(e))}return he(Ye);})();'].join(""),na=/* @__PURE__ */['"use strict";var __LIVE_PREVIEW_ROUTE__=(()=>{var S=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var X=(e,t)=>{for(var n in t)S(e,n,{get:t[n],enumerable:!0})},J=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of V(t))!j.call(e,r)&&r!==n&&S(e,r,{get:()=>t[r],enumerable:!(a=G(t,r))||a.enumerable});return e};var Q=e=>J(S({},"__esModule",{value:!0}),e);var Re={};X(Re,{createRouteStrategy:()=>W});var T="data-payload-island",xe=`astro-island, [${T}]`,E="data-payload-owned",Z="data-payload-morph";function b(e){if(e.tagName.toLowerCase().includes("-")&&!e.hasAttribute(Z)||ne(e)||e.hasAttribute(E))return!0;let n=e.getAttribute("contenteditable");return n!==null&&n!=="false"}function ee(e){return e.tagName.toLowerCase()==="astro-island"||e.hasAttribute(T)}function te(e){return e.getAttribute(T)==="patch"}function ne(e){return ee(e)&&!te(e)}var re=["component-url","component-export","renderer-url","client","opts","before-hydration-url"],R=new WeakMap,I=new WeakSet;function N(e){return e.tagName.toLowerCase()==="astro-island"}function M(e){let t="";for(let n of e.querySelectorAll("astro-slot, template[data-astro-template]")){if(n.parentElement?.closest("astro-island")!==e)continue;let a=n.getAttribute("name")??n.getAttribute("data-astro-template")??"";t+=`${a}\\0${n.innerHTML}\\0`}return t}function oe(e){let t=e.ownerDocument.defaultView?.customElements.get("astro-island");return t!==void 0&&e instanceof t&&Array.isArray(t.observedAttributes)&&t.observedAttributes.includes("props")}function v(e,t){if(!N(e)||!N(t))return!0;let n=M(t);if(!(re.every(o=>e.getAttribute(o)===t.getAttribute(o))&&(R.get(e)??M(e))===n&&(e.getAttribute("props")===t.getAttribute("props")||oe(e))))return R.set(t,n),!1;R.set(e,n);let r=t.getAttribute("props");return r!==e.getAttribute("props")&&(e.setAttribute("ssr",""),r===null?e.removeAttribute("props"):e.setAttribute("props",r)),!0}function P(e){return Array.from(e.querySelectorAll("astro-island"))}function D(e){for(let t of e)t.isConnected||I.has(t)||(I.add(t),t.dispatchEvent(new CustomEvent("astro:unmount")))}var ae=new Set(["open","value","checked","selected"]);function C(e,t){for(let n of t.keyAttributes){let a=e.getAttribute(n);if(a!==null&&a.length>0)return`${n}=${a}`}}function w(e,t,n){if(!x(e,t))return t;let a=n.boundary??b,r=a(e),o=a(t);if(r||o)return!r||!o?t:n.retainBoundary?.(e,t)??!0?e:t;let d=ue(e);return ie(e,t),n.retainChildrenOf?.(e,t)!==!0&&le(e,t,n),ce(d),e}function ie(e,t){for(let n of Array.from(e.attributes))t.hasAttribute(n.name)||ae.has(n.name.toLowerCase())||e.removeAttribute(n.name);for(let n of Array.from(t.attributes))e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value)}function le(e,t,n){let a=de(e,n),r=new Set(a.values()),o=Array.from(e.childNodes).filter(f=>!r.has(f)),d=new Set,p=new Set,l=Array.from(t.childNodes),s=e.firstChild,c=0;for(let f=0;f<l.length;f+=1){let i=l[f],g=null,y=i instanceof Element?C(i,n):void 0;if(y!==void 0&&p.has(y)&&(y=void 0),y!==void 0){p.add(y);let u=a.get(y);if(u!==void 0&&!d.has(u)&&(g=B(u,i,n)===u?u:null,g===null)){u.replaceWith(i),d.add(i),s=i.nextSibling;continue}}else{for(;c<o.length;){let u=o[c];if(c+=1,!d.has(u)){if(x(u,i)){g=B(u,i,n)===u?u:null,g===null&&(e.replaceChild(i,u),d.add(i),s=i.nextSibling);break}if(u instanceof Element){let h=l[f+1];if(!(i instanceof Element)||h!==void 0&&x(u,h)){c-=1;break}e.replaceChild(i,u),d.add(i),s=i.nextSibling;break}if(!(i instanceof Element)){e.replaceChild(i,u),d.add(i),s=i.nextSibling;break}}}if(g===null&&d.has(i))continue}let m=g??i;for(d.add(m);s!==null&&s!==m&&!d.has(s)&&se(s);)s=s.nextSibling;m!==s&&e.insertBefore(m,s),s=m.nextSibling}for(let f of Array.from(e.childNodes))d.has(f)||f.remove()}function B(e,t,n){return e instanceof Element&&t instanceof Element?w(e,t,n):(e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e)}function se(e){return e.nodeType===Node.TEXT_NODE&&(e.nodeValue??"").trim().length===0}function x(e,t){return e.nodeType!==t.nodeType?!1:e instanceof Element&&t instanceof Element?e.tagName===t.tagName&&e.namespaceURI===t.namespaceURI:!0}function de(e,t){let n=new Map,a;for(let r of Array.from(e.children)){let o=C(r,t);if(o!==void 0){if(n.has(o)){a??(a=o.slice(o.indexOf("=")+1));continue}n.set(o,r)}}return a!==void 0&&t.onDuplicateKey?.(e,a),n}function ue(e){let t=e.ownerDocument.activeElement;if(!(t instanceof HTMLElement)||!e.contains(t))return null;let n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?[t.selectionStart,t.selectionEnd]:null;return{element:t,selection:n}}function ce(e){if(e===null)return;let{element:t,selection:n}=e;if(!(t.ownerDocument.activeElement===t||!t.isConnected))try{t.focus({preventScroll:!0});let[a,r]=n??[null,null];a!==null&&r!==null&&t.setSelectionRange(a,r)}catch{}}var O="data-payload-key";function F(e){if(e==null)return[];let t=new Set,n=[];for(let a of e.split(/[\\s,]+/)){let r=a.trim();r.length===0||t.has(r)||(t.add(r),n.push(r))}return n}var fe="__livePreviewRouteRefresh";function me(){return typ','eof window>"u"?void 0:window}function _(){return me()?.[fe]}var A="data-payload-fragment",k="data-payload-fragment-key";function L(e,t){let n=new AbortController,a=!1,r=()=>{n.abort()};e.addEventListener("abort",r,{once:!0});let o=setTimeout(()=>{a=!0,n.abort()},t);return{signal:n.signal,timedOut:()=>a,dispose:()=>{clearTimeout(o),e.removeEventListener("abort",r)}}}function U(e){return e instanceof Error?e.message:String(e)}var H="data-payload-strategy",$="data-payload-field",ye="data-payload-depends",pe="x-payload-live-preview",ge=8e3,Ee="route refresh returned no promise; re-applied before the host committed (see LivePreviewRouteRefresh)",he=1e3;function be(e){let t=e.getAttribute(H);return t!==null?t==="route":e.closest("head")!==null}function Ae(e){let t=e.getAttribute($),n=F(e.getAttribute(ye));return t===null||t.length===0?n:[t,...n]}function K(e){return e.hasAttribute(E)?!1:e.tagName==="META"?e.hasAttribute("name")||e.hasAttribute("property"):e.tagName==="LINK"&&e.getAttribute("rel")==="canonical"}function Se(e,t){let n=Array.from(e.head.children).find(l=>l.tagName==="TITLE"),a=Array.from(t.head.children).find(l=>l.tagName==="TITLE");!n?.hasAttribute(E)&&!a?.hasAttribute(E)&&t.title!==e.title&&(e.title=t.title);let r=Array.from(e.head.children).filter(K),o=Array.from(t.head.children).filter(K),d=Math.min(r.length,o.length);r.slice(0,d).forEach((l,s)=>{let c=o[s];if(c===void 0)return;if(l.tagName===c.tagName){for(let i of Array.from(l.attributes))c.hasAttribute(i.name)||l.removeAttribute(i.name);for(let i of Array.from(c.attributes))l.getAttribute(i.name)!==i.value&&l.setAttribute(i.name,i.value);return}let f=e.importNode(c,!0);l.replaceWith(f),r[s]=f});let p=r.at(-1);for(let l of o.slice(r.length)){let s=e.importNode(l,!0);p===void 0?e.head.append(s):p.after(s),p=s}for(let l of r.slice(o.length))l.remove()}function W(e={}){let t=e.timeoutMs??ge,n=e.minIntervalMs??he,a=-1/0,r=!1;return{plan(o,d,p){for(let l of o.querySelectorAll(`[${$}], [${H}="route"]`)){if(!be(l)||p?.inScope(l)===!1)continue;let s=Ae(l);if(s.length===0||s.some(c=>d.has(c)))return!0}return!1},async refresh(o){let d=Date.now(),p=n-(d-a);if(p>0)return o.retryAfter?.(p),o.log("LP0805",`route refresh for revision ${String(o.revision)} refused: the previous one was ${String(d-a)} ms ago`),"refused";a=d;let l=e.document??document,s=e.location??location,c=e.window??window,f=L(o.signal,t),i=g=>{if(o.signal.aborted)return"superseded";let y=f.timedOut()?`route refresh timed out after ${String(t)} ms`:U(g);return o.log("LP0801",y),"failed"};try{let g=_();if(g!==void 0){try{let m=g();typeof m?.then!="function"&&!r&&(r=!0,o.log("LP0810",Ee)),await m}catch(m){return i(m)}return o.isCurrent()?"partial":"superseded"}let y;try{y=await(e.fetch??fetch)(s.href,{method:"GET",credentials:"same-origin",cache:"no-store",headers:{accept:"text/html",[pe]:"route"},signal:f.signal})}catch(m){return i(m)}if(o.signal.aborted)return"superseded";if(!y.ok||!(y.headers.get("content-type")??"").includes("text/html"))return o.log("LP0802",`route answered ${String(y.status)} ${y.headers.get("content-type")??""}`),"failed";try{let m=await y.text();if(!o.isCurrent())return"superseded";let u=new DOMParser().parseFromString(m,"text/html"),h=c.scrollX,q=c.scrollY;Se(l,u);let z=P(l.body);return w(l.body,u.body,{boundary:b,retainBoundary:v,keyAttributes:[O,k,A],retainChildrenOf:Y=>Y.hasAttribute(A)}),D(z),c.scrollTo(h,q),"partial"}catch(m){return i(m)}}finally{f.dispose()}}}}return Q(Re);})();'].join(""),ra=["allowedOrigins","serverURL","apiRoute","mergeDepth","debug","debounceMs","enableA11y","heartbeatMs","disableVisibilityGate","visibilityGateThreshold","intersectionRootMargin","disableReferrerDetection","disableLocalhostMatching","scopeBindingsByOwner","skipUnchanged","eventSourcePolicy","sanitizerPolicy","fragmentEndpoint","revealEditedField","routeStrategy","onUnboundChange","onUnfaithfulPatch","autoBind","hydration","defaults","softNavigationEvents","subfieldCoverage","mergeTimeoutMs","internalLinkPattern"];function ia(e,t){if(0===e.length)throw new Error(`[live-preview] ${t} is empty. Run \`npm run build:runtime\` before bundling.`)}function oa(e){return!0===e.routeStrategy||"after-save"===e.routeStrategy}function sa(e){return null!=e.fragmentEndpoint?(ia(ta,"fragment.generated.ts"),[ta]):oa(e)?(ia(na,"route.generated.ts"),[na]):[]}function aa(e){return`var __LIVE_PREVIEW_CONFIG__=${function(e){t(e);const n=function(e){const t=e.defaults??"v2";return"v1"===t?{...Vs,defaults:t}:{defaults:t}}(e),r=ra.map(t=>{const r=e[t]??n[t];return function(e,t){if("number"!=typeof t||Number.isFinite(t))return;const n="visibilityGateThreshold"===e?" To never defer, set `disableVisibilityGate: true`.":"";throw new Error(`[live-preview] \`${e}\` is ${String(t)}, which the inline configuration writes as null, so the runtime would never see it. Pass a finite number.${n}`)}(t,r),r});for(;void 0===r.at(-1);)r.pop();return`[${r.map(e=>void 0===e?"":JSON.stringify(e)).join(",")}]`.replace(/</g,"\\u003C")}(e)};`}var la,ua=/[\t\n\f\r ]+/;function da(e,t){const n=e.charCodeAt(t);return 9===n||10===n||12===n||13===n||32===n}function ca(e){let t=0,n=e.length;for(;t<n&&da(e,t);)t+=1;for(;n>t&&da(e,n-1);)n-=1;return 0===t&&n===e.length?e:e.slice(t,n)}function fa(e){return e.replace(/[A-Z]/g,e=>e.toLowerCase())}var ha=/* @__PURE__ */new Map([["child-src",["default-src"]],["connect-src",["default-src"]],["font-src",["default-src"]],["frame-src",["child-src","default-src"]],["img-src",["default-src"]],["manifest-src",["default-src"]],["media-src",["default-src"]],["object-src",["default-src"]],["script-src",["default-src"]],["script-src-elem",["script-src","default-src"]],["script-src-attr",["script-src","default-src"]],["style-src",["default-src"]],["style-src-elem",["style-src","default-src"]],["style-src-attr",["style-src","default-src"]],["worker-src",["child-src","script-src","default-src"]]]);function pa(e,t){const n=ha.get(e);if(void 0!==n)for(const e of n){const n=t.get(e);if(void 0!==n)return n}}function ga(e,t){const n=/* @__PURE__ */new Map;for(const t of e.split(";")){const e=ca(t);if(0===e.length)continue;const r=e.search(ua),i=fa(r<0?e:e.slice(0,r));if(n.has(i))continue;const o=r<0?"":ca(e.slice(r));n.set(i,o)}for(const[e,r]of Object.entries(t)){const t=fa(e),i="string"==typeof r?{value:r}:r,o=i.mode??"union",s=n.get(t)??pa(t,n);if("replace"===o||void 0===s||0===s.length){n.set(t,i.value);continue}const a=/* @__PURE__ */new Set,l=[];for(const e of[...s.split(ua),...i.value.split(ua)])0===e.length||a.has(e)||(a.add(e),l.push(e));const u=l.filter(e=>"'none'"!==e);n.set(t,(u.length>0?u:l).join(" "))}const r=[];for(const[e,t]of n)r.push(0===t.length?e:`${e} ${t}`);return r.join("; ")}var ma="payload-live-preview.authorized-preview-context",va=Symbol.for(ma);function isAuthorizedPreviewContext(e){return"object"==typeof e&&null!==e&&!0===e[va]&&Object.isFrozen(e)}function ya(e){const t={...e,scope:Object.freeze({...e.scope,...void 0===e.scope.payload?{}:{payload:Object.freeze({...e.scope.payload,document:Object.freeze({...e.scope.payload.document})})}}),payloadHeaders:Object.freeze({...e.payloadHeaders}),[va]:!0,[ma]:!0};return Object.defineProperty(t,"payloadHeaders",{enumerable:!1}),Object.freeze(t)}var ba=class extends Error{name="PreviewConfigurationError"};function wa(e){return{authorized:!1,outcome:e,context:null}}var Sa="users",Aa=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,ka=/^[A-Za-z0-9._~-]+$/,Ta=/* @__PURE__ */new WeakMap;function Ca(e,t){let n;try{n=new URL(e)}catch{throw new ba(`payload-live-preview: ${t} "${e}" is not an absolute URL`)}if("https:"!==n.protocol&&"http:"!==n.protocol)throw new ba(`payload-live-preview: ${t} must be http(s), got "${n.protocol}"`);return n.origin}var Ra,$a="live-preview",La=36e5,Na="v1";function Pa(){return Ra??=new TextEncoder,Ra}function xa(e){const t="string"==typeof e?Pa().encode(e):e;if(t.byteLength<32)throw new ba(`payload-live-preview: the preview token secret must be at least ${String(32)} bytes`);return t}function Ea(e){if(void 0!==e)return e;const t=globalThis.crypto;return"object"==typeof t?.subtle?t:void 0}async function Ma(e,t){return e.subtle.importKey("raw",t,{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"])}function Oa(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Fa(e){if(!/^[A-Za-z0-9_-]*$/.test(e))return;const t=e.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-e.length%4)%4);try{const e=atob(t),n=new Uint8Array(e.length);for(let t=0;t<e.length;t+=1)n[t]=e.charCodeAt(t);return n}catch{return}}function Ua(e){return"string"==typeof e&&e.length>0&&"."!==e&&".."!==e&&!/[\s\p{Cc}\p{Cs}/\\?#%]/u.test(e)}var Ia=["preview","draft","livePreview"];function _a(e,t={}){const n=new Set(t.signals??["query","fetch-dest","referer"]),r=t.queryParams??Ia;if(n.has("query")){let t;try{t=new URL(e.url)}catch{t=void 0}if(void 0!==t)for(const e of r){const n=t.searchParams.getAll(e).at(-1);if("true"===n||"1"===n)return!0}}if(n.has("fetch-dest")&&"iframe"===e.headers.get("sec-fetch-dest"))return!0;const i=t.adminOrigins;void 0!==i&&Ir("admin-origins","`hasPreviewIntent({ adminOrigins })` is removed in 3.0: name the option `allowedOrigins`; `pll migrate` renames it (ADR 0026).");const o=t.allowedOrigins??i??[],s=n.has("referer")?o:[];if(s.length>0){const t=e.headers.get("referer");if(null!==t)try{const e=new URL(t).origin;for(const t of s)try{if(new URL(t).origin===e)return!0}catch{}}catch{}}return!1}var Da="payload-live-preview-highlight",ja=/* @__PURE__ */new WeakMap,Ba=/* @__PURE__ */new WeakMap,za={name:"highlight",version:"1.0.0",init:e=>{if("undefined"==typeof document||"undefined"==typeof window)return;const t="function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,n=function(e,t){let n=ja.get(e);void 0===n||n.connected()||(ja.delete(e),n=void 0),void 0===n&&(n=function(e,t){const n=e.getElementById(Da);if(n instanceof HTMLStyleElement)return{pluginOwned:!1,connected:()=>n.isConnected,remove:()=>{},owners:0};const r=function(e,t){try{if(!Array.isArray(e.adoptedStyleSheets)||"function"!=typeof CSSStyleSheet)return;const n=new CSSStyleSheet;if("function"!=typeof n.replaceSync)return;return n.replaceSync(t),e.adoptedStyleSheets=[...e.adoptedStyleSheets,n],n}catch{return}}(e,t);if(void 0!==r)return{pluginOwned:!0,connected:()=>e.adoptedStyleSheets.includes(r),remove:()=>{e.adoptedStyleSheets=e.adoptedStyleSheets.filter(e=>e!==r)},owners:0};const i=e.createElement("style");return i.id=Da,i.textContent=t,e.head.appendChild(i),{pluginOwned:!0,connected:()=>i.isConnected,remove:()=>{i.remove()},owners:0}}(e,t?".lp-highlight{outline:2px solid rgba(0,102,204,0.85);outline-offset:2px;}":"@keyframes lp-highlight{0%{outline:2px solid rgba(0,102,204,0.85);outline-offset:2px}100%{outline:2px solid transparent;outline-offset:2px}}.lp-highlight{animation:lp-highlight 0.6s ease-out;}"),ja.set(e,n));const r=n;r.owners+=1;let i=!0;return()=>{i&&(i=!1,r.owners-=1,r.owners>0||(ja.get(e)===r&&ja.delete(e),r.pluginOwned&&r.remove()))}}(document,t),r=t?1e3:600,i=/* @__PURE__ */new WeakMap,o=/* @__PURE__ */new Set;e.registerCleanup?.(()=>{for(const e of[...o])e();n()}),e.events.on("elementUpdate",e=>{const t=e.element;i.get(t)?.();const n=function(e){let t=Ba.get(e);void 0===t&&(t={owners:0,pluginAdded:!e.classList.contains("lp-highlight")},Ba.set(e,t));const n=t;n.owners+=1,e.classList.add("lp-highlight");let r=!0;return()=>{r&&(r=!1,n.owners-=1,n.owners>0||(Ba.delete(e),n.pluginAdded&&e.classList.remove("lp-highlight")))}}(t);let s=!1;const a=()=>{s||(s=!0,window.clearTimeout(l),i.get(t)===a&&i.delete(t),o.delete(a),n())},l=window.setTimeout(a,r);o.add(a),i.set(t,a)})}},Wa={name:"debug",version:"1.0.0",init:e=>{e.events.on("init",()=>{e.log("init")}),e.events.on("connect",t=>{e.log("connect ←",t.origin)}),e.events.on("disconnect",t=>{e.log("disconnect (",t.reason,")")}),e.events.on("cacheRefresh",t=>{e.log("cacheRefresh",t.elementCount,"elements,",t.fieldCount,"fields")}),e.events.on("beforeUpdate",t=>{e.log("beforeUpdate",Object.keys(t.data.fields).length,"fields")}),e.events.on("afterUpdate",t=>{e.log("afterUpdate",t.updatedCount,"in",t.durationMs.toFixed(2),"ms")}),e.events.on("error",t=>{e.log("error in",t.context,":",t.error.message)})}},Ha="payload-live-preview:scroll";function qa(){"undefined"!=typeof window&&(function(){if("undefined"!=typeof window)try{sessionStorage.setItem(Ha,JSON.stringify({href:window.location.href,x:window.scrollX,y:window.scrollY}))}catch{}}(),window.location.reload())}function bind(e,t){return Va(e,t)}function bindByPath(e,t){const n=function(e){const t=[],n=new Proxy({},{get(e,r){if("symbol"!=typeof r)return/^\d+$/.test(r)||t.push(r),n}});try{e(n)}catch{}return t}(e);if(0===n.length)throw new Error("bindByPath: the picker did not read any field — return data.<field> instead of a constant");return Va(n.join("."),t)}function Va(e,t){if(0===e.length)throw new Error("bind: field name must be a non-empty string");const n={"data-payload-field":e};return void 0!==t?.attribute&&(n["data-payload-attribute"]=t.attribute),void 0!==t?.type&&(n["data-payload-type"]=t.type),!0===t?.richtext&&(n["data-payload-richtext"]=""),!0===t?.html&&(n["data-payload-html"]=""),void 0!==t?.locale&&(n["data-payload-locale"]=t.locale),void 0!==t?.alt&&(n["data-payload-alt"]=t.alt),void 0!==t?.href&&(n["data-payload-href"]=t.href),void 0!==t?.arrayTemplate&&(n["data-payload-array-template"]=t.arrayTemplate),void 0!==t?.format&&(n["data-payload-format"]=t.format),!0===t?.text&&(n["data-payload-text"]=""),void 0!==t?.strategy&&(n["data-payload-strategy"]=t.strategy),void 0!==t?.dependsOn&&t.dependsOn.length>0&&(n["data-payload-depends"]=t.dependsOn.join(",")),!0===t?.anchor&&(n["data-payload-boundary"]=""),n}var Ga=/^[a-z][a-z0-9-]{0,63}$/u,Ja=Object.freeze({});function createPreviewBindings(e){const t=isAuthorizedPreviewContext(e.authorization),n=void 0!==e.owner&&e.owner.length>0?e.owner:void 0;return Object.freeze({authorized:t,bind:(e,n)=>t?bind(e,n):Ja,bindByPath:(e,n)=>t?bindByPath(e,n):Ja,owner:()=>t&&void 0!==n?{"data-payload-owner":n}:Ja,boundary:(e,n={})=>{const r=function(e,t){if(!Ga.test(e))throw new RangeError(`createPreviewBindings().boundary(): "${e}" is not a registry id — lowercase, starting with a letter, then letters, digits or hyphens (max 64). The runtime would post it and the endpoint would refuse it.`);const n=t.key;if(void 0!==n&&(0===n.length||n.length>128))throw new RangeError(`createPreviewBindings().boundary(): the key for "${e}" must be 1 to ${String(128)} characters.`);const r=t.dependsOn??[];return{"data-payload-fragment":e,...void 0!==n?{"data-payload-fragment-key":n}:{},...r.length>0?{"data-payload-depends":r.join(",")}:{}}}(e,n);return t?r:Ja},covers:(...e)=>{const n=function(e){for(const t of e)if(0===t.length||/[\s,]/u.test(t))throw new RangeError(`createPreviewBindings().covers(): "${t}" is not a field path — a name or a dotted path without spaces or commas.`);return{"data-payload-covers":e.join(" ")}}(e);return t&&e.length>0?n:Ja}})}exports.AUTHORIZED_PREVIEW_BRAND_KEY=ma,exports.CAPABILITY_DECLARATIONS=g,exports.CAPABILITY_DOCUMENTATION={basic:{gates:"data updates are applied to bound elements",fallback:"none — every peer has it"},"schema-json":{gates:"field typing from fieldSchemaJSON (Payload 2.x) and the payload-2 profile",fallback:"field types come from DOM heuristics and Lexical auto-detection"},locale:{gates:"locale-aware field resolution (`title_de` before `title`) and the locale on island events",fallback:"bindings resolve the unsuffixed field value"},"preview-token":{gates:"per-message token validation (library extension)",fallback:"messages carry no token; validateToken cannot be satisfied"},"nested-arrays":{gates:"keyed array diffs below the top level",fallback:"array updates replace the whole array"},"recursive-diffs":{gates:"recursive object diffs",fallback:"nested objects re-render as a unit"},"document-events":{gates:"the `documentSave` runtime event, the document-save plugin and the payload-3 profile",fallback:"no documentSave event; a save is not distinguishable from an edit"},"relationship-events":{gates:"the `relationshipUpdate` runtime event and an unconditional re-render of the update that carries it",fallback:"a related document edited in a drawer shows up on the next data update only"}},exports.DIAGNOSTIC_CODES=Zs,exports.EventEmitter=EventEmitter,exports.ISLAND_EVENT=lt,exports.LIBRARY_PROTOCOL_VERSION=4,exports.LivePreviewClient=LivePreviewClient,exports.OriginDetector=OriginDetector,exports.PROTOCOL_CAPABILITIES=m,exports.TRUSTED_TYPES_POLICY_NAME=Cr,exports.VERSION=e,exports.authorizePreviewRequest=async function(e,t){switch(t.type){case"payload-session":return async function(e,t){const n=function(e){const t=e??"payload-token";if(!Aa.test(t))throw new ba(`payload-live-preview: cookie name "${t}" is not a valid cookie-name token`);return t}(t.cookieName),r=Ca(t.serverURL,"serverURL"),i=void 0===t.origin?void 0:Ca(t.origin,"origin"),o=function(e,t,n=4096){if(null===e||0===e.length)return null;const r=`${t}=`,i=[];for(const t of e.split(";")){const e=t.trim();e.startsWith(r)&&i.push(e.slice(r.length))}if(1!==i.length)return null;const o=i[0]??"";return 0===o.length||o.length>n||!ka.test(o)?null:o}(e.headers.get("cookie"),n,t.maxCookieLength??4096);if(null===o)return wa("missing-credential");const s=t.now??Date.now,a=Math.max(250,t.timeoutMs??3e3);if(!Number.isSafeInteger(a))return wa("unavailable");const l=t.fetch??globalThis.fetch,u=`${r}/api/${encodeURIComponent(t.usersSlug??Sa)}/me?depth=0`,d=Ta.get(l)??/* @__PURE__ */new Map,c=`${n}=${o}`;let f={cookie:c};void 0!==i?f.origin=i:d.has(u)&&(f.origin=r);const h=new AbortController,p=()=>{h.abort(e.signal?.reason)},g=()=>h.signal.aborted;let m,v;e.signal?.addEventListener("abort",p,{once:!0}),!0===e.signal?.aborted&&p();try{if(g())return wa("unavailable");m=setTimeout(()=>{h.abort(new DOMException("The operation timed out","TimeoutError"))},a);for(let e=0;e<2;e++){const t=await l(u,{headers:{...f,accept:"application/json"},signal:h.signal});if(g())return wa("unavailable");if(!t.ok)return wa(401===t.status?"invalid":"unavailable");if(v=await t.json(),g())return wa("unavailable");const n="object"==typeof v&&null!==v?v.user:void 0;if(0!==e){if("object"!=typeof n||null===n||Array.isArray(n))break;void 0===f.origin?d.delete(u):(Ta.set(l,d),d.set(u,s()));break}if(void 0!==i||null!==n)break;if(void 0!==f.origin){if(s()-(d.get(u)??0)<6e4)break;d.set(u,s()),f={cookie:c}}else f={cookie:c,origin:r}}}catch{return wa("unavailable")}finally{void 0!==m&&clearTimeout(m),e.signal?.removeEventListener("abort",p)}const y=function(e,t){if("object"!=typeof e||null===e||Array.isArray(e))return null;const n=e.user;if("object"!=typeof n||null===n||Array.isArray(n))return null;const r=e.collection??n.collection;if(void 0!==r&&r!==t)return null;const i=n.id;return"string"==typeof i&&i.length>0?i:"number"==typeof i&&Number.isFinite(i)?String(i):null}(v,t.usersSlug??Sa);if(null===y)return wa("invalid");const b=function(e){const t=e.exp;return"number"!=typeof t||!Number.isFinite(t)||t<=0?void 0:t<1e11?1e3*t:t}(v);return void 0!==b&&b<=s()?wa("expired"):{authorized:!0,outcome:"authorized",context:ya({strategy:"payload-session",subject:y,authorizedAt:s(),expiresAt:b,scope:{},payloadHeaders:f})}}(e,t);case"signed-token":return async function(e,t){const n=xa(t.secret),r=Ea(t.crypto);if(void 0===r)return wa("unavailable");const i=function(e,t){if("header"===t?.kind)return e.headers.get(t.name??"x-preview-token");let n;try{n=new URL(e.url)}catch{return null}const r=n.searchParams.getAll(t?.param??"previewToken");return 1===r.length?r[0]??null:null}(e,t.transport);if(null===i||0===i.length)return wa("missing-credential");if(i.length>4096)return wa("invalid");const o=i.split(".");if(3!==o.length||o[0]!==Na)return wa("invalid");const s=o[1]??"",a=Fa(s),l=Fa(o[2]??"");if(void 0===a||32!==l?.byteLength)return wa("invalid");let u;try{const e=await Ma(r,n);u=await r.subtle.verify("HMAC",e,l,Pa().encode(`${Na}.${s}`))}catch{return wa("unavailable")}if(!u)return wa("invalid");const d=function(e){let t;try{t=JSON.parse((new TextDecoder).decode(e))}catch{return}if("object"!=typeof t||null===t)return;const n=t,r=e=>void 0===n[e]||"string"==typeof n[e];return 1===n.v&&"string"==typeof n.aud&&"string"==typeof n.pur&&"number"==typeof n.iat&&"number"==typeof n.exp&&"string"==typeof n.jti&&r("pth")&&r("loc")&&r("sub")?n:void 0}(a);if(void 0===d)return wa("invalid");const c=(t.now??Date.now)();if(d.exp<=c||d.iat>d.exp)return wa("expired");if(d.exp-d.iat>La)return wa("invalid");if(d.aud!==t.audience)return wa("wrong-audience");if(d.pur!==(t.purpose??$a))return wa("wrong-purpose");if(void 0!==d.pth){let t;try{t=new URL(e.url).pathname}catch{return wa("invalid")}if(d.pth!==t)return wa("wrong-path")}if(void 0!==d.loc){const n=t.locale?.(e);if(n!==d.loc)return wa("wrong-locale")}if(void 0!==t.replay){let e;try{e=await async function(e,t,n){return"consume"in e?!0===await e.consume(t,n):(Ir("replay-is-used","A `signed-token` replay store with `isUsed` and `markUsed` is removed in 3.0: implement `consume(id, expiresAt)`, which checks and records in one step (ADR 0026)."),!await e.isUsed(t)&&(await e.markUsed(t,n),!0))}(t.replay,d.jti,d.exp)}catch{return wa("unavailable")}if(!e)return wa("replayed")}return{authorized:!0,outcome:"authorized",context:ya({strategy:"signed-token",subject:d.sub,authorizedAt:c,expiresAt:d.exp,scope:{audience:d.aud,...void 0!==d.pth?{path:d.pth}:{},...void 0!==d.loc?{locale:d.loc}:{}},payloadHeaders:{}})}}(e,t);case"verifier":return async function(e,t){let n;try{n=await t.verify(e)}catch{return wa("unavailable")}if(null===n)return wa("invalid");if(!(void 0===n.scope?.payload||function(e){if("object"!=typeof e||null===e)return!1;const t=e,n=t.document;return!(null===function(e,t="/api"){if("string"!=typeof e||"string"!=typeof t)return null;try{const n=new URL(e);if(!["http:","https:"].includes(n.protocol)||n.username||n.password||n.search||n.hash)return null;const r=e.replace(/^[a-z]+:\/\/[^/]+/iu,"").replace(/\/+$/,""),i=t.replace(/^\//,"").replace(/\/$/,"");return""!==r&&!r.slice(1).split("/").every(Ua)||!i.split("/").every(Ua)?null:`${n.origin}${n.pathname.replace(/\/+$/,"")}/${i}`}catch{return null}}(t.serverURL,t.apiRoute)||"number"!=typeof t.maxDepth||!Number.isSafeInteger(t.maxDepth)||t.maxDepth<0||"object"!=typeof n||null===n||!Ua(n.slug))&&("global"===n.kind||"collection"===n.kind&&function(e){return"number"==typeof e?Number.isSafeInteger(e):Ua(e)}(n.id))}(n.scope.payload)&&Number.isFinite(n.expiresAt)))return wa("invalid");const r=(t.now??Date.now)();return void 0!==n.expiresAt&&n.expiresAt<=r?wa("expired"):{authorized:!0,outcome:"authorized",context:ya({strategy:"verifier",subject:n.subject,authorizedAt:r,expiresAt:n.expiresAt,scope:n.scope??{},payloadHeaders:n.payloadHeaders??{}})}}(e,t)}},exports.bind=bind,exports.bindByPath=bindByPath,exports.bindNavigationLifecycle=function(e,t={}){const n=t.windowTarget??globalThis.window,r=t.documentTarget??globalThis.document,i=[...new Set(t.softNavigationEvents??[])],o=()=>{e.suspend()},s=t=>{!0===t.persisted&&e.resume()};let a=!1;const l=()=>{a=!0},u=t=>{if(t.type===Ks){if(!a)return;a=!1}void 0===e.refreshAfterNavigation?e.refreshCache():e.refreshAfterNavigation()};let d=!1;n?.addEventListener("pagehide",o),n?.addEventListener("pageshow",s);for(const e of i)r?.addEventListener(e,u);const c=i.includes(Ks);return c&&r?.addEventListener(Xs,l),()=>{if(!d){d=!0,n?.removeEventListener("pagehide",o),n?.removeEventListener("pageshow",s);for(const e of i)r?.removeEventListener(e,u);c&&r?.removeEventListener(Xs,l)}}},exports.buildBuiltinRenderers=Hs,exports.buildFrameAncestors=function buildFrameAncestors(e={}){const{self:t=!0,origins:n=[],allowNone:r=!1}=e,i=/* @__PURE__ */new Set,o=[];if(r&&!t&&0===n.length)return"'none'";t&&(o.push("'self'"),i.add("'self'"));for(const e of n){const t=e.trim();0===t.length||i.has(t)||(i.add(t),o.push(t))}return o.length>0?o.join(" "):"'none'"},exports.buildScriptSrcWithNonce=function buildScriptSrcWithNonce(e,t={}){if(0===e.length)throw new RangeError("buildScriptSrcWithNonce: nonce is empty");const{self:n=!0,extra:r=[],strictDynamic:i=!1}=t,o=[];n&&o.push("'self'"),o.push(`'nonce-${e}'`),i&&o.push("'strict-dynamic'");for(const e of r){const t=e.trim();t.length>0&&o.push(t)}return o.join(" ")},exports.createAnalyticsPlugin=function(){let e=0,t=0,n=0;return{name:"analytics",version:"1.0.0",init:r=>{r.events.on("afterUpdate",r=>{e+=1,t+=r.updatedCount,n+=r.durationMs})},getStats:()=>({updateCount:e,totalElements:t,totalDurationMs:n,averageDurationMs:0===e?0:n/e})}},exports.createPreviewBindings=createPreviewBindings,exports.createPreviewFocusReporter=function(e,t){return n=>{const r=e();null!=r&&Js(r,n,t)}},exports.debugPlugin=Wa,exports.detectInitialLocale=detectInitialLocale,exports.detectProtocolProfile=detectProtocolProfile,exports.documentSavePlugin=function(e={}){const t=e.strategy??"silent";return{name:"document-save",version:"1.1.0",init:n=>{let r=!0;const i=/* @__PURE__ */new Set;n.registerCleanup?.(()=>{r=!1;for(const e of i)e.abort();i.clear()}),function(){if("undefined"!=typeof window)try{const e=sessionStorage.getItem(Ha);if(null===e)return;sessionStorage.removeItem(Ha);const t=JSON.parse(e);if(t.href!==window.location.href)return;window.scrollTo(t.x??0,t.y??0)}catch{}}(),n.events.on("documentSave",()=>{if(!r)return;if("silent"===t)return;if("reload"===t)return void qa();const o=new AbortController;i.add(o);const s="fetch"===t?async function(e,t,n){if(e.handler)try{await e.handler(n)}catch(e){if(!r||n.aborted)return;t("document-save handler threw:",e)}else t("document-save: fetch strategy selected but no handler supplied")}(e,n.log,o.signal):async function(e,t,n,r){if("undefined"==typeof fetch)return void t("document-save: revalidate strategy needs fetch — not available");const i=e.revalidateUrl??"/api/revalidate";let o=!1;try{const s=await fetch(i,{method:"POST",signal:n,headers:{"Content-Type":"application/json",...e.revalidateHeaders??{}},body:JSON.stringify({source:"payload-live-preview"})});if(!r()||n.aborted)return;o=s.ok,o||t("document-save revalidate non-2xx:",s.status)}catch(e){if(!r()||n.aborted)return;t("document-save revalidate failed:",e)}o||"reload"!==e.onRevalidateFailure||qa()}(e,n.log,o.signal,()=>r);s.finally(()=>{i.delete(o)})})}}},exports.escapeHtml=escapeHtml,exports.escapeHtmlAttribute=escapeHtmlAttribute,exports.generateCspNonce=function generateCspNonce(e=16){if(!Number.isInteger(e)||e<8)throw new RangeError(`generateCspNonce: bytes must be an integer >= 8, got ${String(e)}`);const t=function(){if(la?.getRandomValues)return la;const e=globalThis.crypto;return e?.getRandomValues?e:void 0}();if(!t)throw new Error("generateCspNonce: Web Crypto is unavailable. On Node 18 call setCspCrypto(webcrypto) once at startup, or run with --experimental-global-webcrypto. We won't fabricate a predictable nonce — that would silently defeat the entire CSP.");const n=new Uint8Array(e);return t.getRandomValues(n),function(e){let t="";for(const n of e)t+=String.fromCharCode(n);return("function"==typeof btoa?btoa(t):Buffer.from(e).toString("base64")).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}(n)},exports.generateInlineScript=function generateInlineScript(e={}){var t;"v1"===(t={defaults:e.defaults,onUnboundChange:e.onUnboundChange}).defaults&&Ir("defaults-v1","`defaults: 'v1'` is removed in 3.0: `pll migrate` writes the 1.x rows it stands for into your options, where they keep working (ADR 0026)."),void 0!==t.onUnboundChange&&Ir("on-unbound-change","`onUnboundChange` is removed in 3.0: name it `onUnfaithfulPatch`, where 'route' is 'escalate'; `pll migrate` renames it (ADR 0026).");const n=function(e){const t=e.runtime;if(void 0===t)return ia(Ys,"runtime.generated.ts"),Ys;if(ia(t.source,`the ${t.profile} runtime`),null!=e.fragmentEndpoint||oa(e))throw new Error(`[live-preview] the ${t.profile} runtime and the fragment or route strategy exclude each other: it carries no strategy runner, so the prelude would have nothing to talk to. Drop the runtime option, or drop \`fragmentEndpoint\`/\`routeStrategy\`.`);return t.source}(e);return[aa(e),...sa(e),n].join("\n")},exports.hasCapability=function hasCapability(e,t){return e.capabilities.has(t)},exports.hasPreviewIntent=_a,exports.highlightPlugin=za,exports.initLivePreview=function initLivePreview(e={}){const t=new LivePreviewClient({...e,autoStart:!1});return t.start()?t:null},exports.isAuthorizedPreviewContext=isAuthorizedPreviewContext,exports.isDevMode=isDevMode,exports.isExternalHttpUrl=isExternalHttpUrl,exports.isInIframe=isInIframe,exports.isInPopup=isInPopup,exports.isInPreviewContext=isInPreviewContext,exports.isInsideIsland=isInsideIsland,exports.isLexicalContent=Uo,exports.isPreviewRequest=(e,t)=>(Ir("is-preview-request","`isPreviewRequest()` is removed in 3.0: call `hasPreviewIntent()`, which takes the same arguments; `pll migrate` renames it (ADR 0026)."),_a(e,t)),exports.isSafeUrl=isSafeUrl,exports.issuePreviewToken=async function(e,t){const n=Ea(t.crypto);if(void 0===n)throw new Error("payload-live-preview: no Web Crypto implementation available to sign tokens");const r=xa(t.secret),i=(t.now??Date.now)(),o=Math.min(La,Math.max(1,e.ttlMs??6e5)),s=new Uint8Array(16);n.getRandomValues(s);const a={v:1,aud:e.audience,...void 0!==e.path?{pth:e.path}:{},...void 0!==e.locale?{loc:e.locale}:{},...void 0!==e.subject?{sub:e.subject}:{},pur:e.purpose??$a,iat:i,exp:i+o,jti:Oa(s)},l=Oa(Pa().encode(JSON.stringify(a))),u=`${Na}.${l}`,d=await Ma(n,r);return`${u}.${Oa(new Uint8Array(await n.subtle.sign("HMAC",d,Pa().encode(u))))}`},exports.lexicalToHtml=Io,exports.lexicalToPlainText=_o,exports.markHydrated=function(){const e=Wn();void 0!==e&&Un(e)},exports.mergeCspHeader=function(e,t){const n=e.split(",").filter(e=>e.trim().length>0);return 0===n.length?ga("",t):n.map(e=>ga(e,t)).join(", ")},exports.negotiateProtocol=negotiateProtocol,exports.previewBindingsFromLocals=function(e,t={}){return createPreviewBindings({authorization:("object"==typeof e&&null!==e?e.livePreviewAuthorization:void 0)??null,...void 0!==t.owner?{owner:t.owner}:{}})},exports.registerBlockRenderer=function(e,t){Lo.set(e,t)},exports.registerBuiltinRenderer=function(e){zs.set(e.name,e)},exports.registerRouteRefresh=function registerRouteRefresh(e){const t="undefined"==typeof window?void 0:window;return void 0===t?()=>{}:(t[Qs]=e,()=>{t[Qs]===e&&(t[Qs]=void 0)})},exports.reportPreviewFocus=Js,exports.runtimeBuildInfo=function(){return ea},exports.sanitizeHtml=sanitizeHtml,exports.setCspCrypto=function setCspCrypto(e){la=e??void 0},exports.setSanitizerDocument=function setSanitizerDocument(e){Ir("set-sanitizer-document","`setSanitizerDocument()` is removed in 3.0: pass the document per call, `sanitizeHtml(html, { document })` or `lexicalToHtml(content, { document })` (ADR 0026)."),globalThis[Qr]=e??void 0},exports.setSanitizerPolicy=function(e){Xr=e},exports.setTrustedTypesPolicy=function(e){$r().override=e},exports.trustedHtml=Lr,exports.wrapWithScriptTag=function(e,t={}){return`<script${void 0!==t.nonce?` nonce="${function(e){if(!/^[A-Za-z0-9+/=_-]+$/.test(e))throw new RangeError("nonce contains characters CSP does not allow");return e}(t.nonce)}"`:""}>${e}<\/script>`};
2
2
  //# sourceMappingURL=index.cjs.map